Vim reconfig
This commit is contained in:
+3
-12
@@ -1,6 +1,3 @@
|
||||
[submodule ".vim/bundle/ag.vim"]
|
||||
path = .vim/bundle/ag.vim
|
||||
url = https://github.com/rking/ag.vim
|
||||
[submodule ".vim/bundle/ctrlp.vim"]
|
||||
path = .vim/bundle/ctrlp.vim
|
||||
url = https://github.com/kien/ctrlp.vim
|
||||
@@ -10,12 +7,6 @@
|
||||
[submodule ".vim/bundle/nerdcommenter"]
|
||||
path = .vim/bundle/nerdcommenter
|
||||
url = https://github.com/scrooloose/nerdcommenter
|
||||
[submodule ".vim/bundle/nerdtree"]
|
||||
path = .vim/bundle/nerdtree
|
||||
url = https://github.com/scrooloose/nerdtree
|
||||
[submodule ".vim/bundle/vim-fugitive"]
|
||||
path = .vim/bundle/vim-fugitive
|
||||
url = https://github.com/tpope/vim-fugitive
|
||||
[submodule ".vim/bundle/vim-showmarks"]
|
||||
path = .vim/bundle/vim-showmarks
|
||||
url = https://github.com/jacquesbh/vim-showmarks
|
||||
@@ -31,9 +22,6 @@
|
||||
[submodule ".vim/bundle/supertab"]
|
||||
path = .vim/bundle/supertab
|
||||
url = https://github.com/ervandew/supertab
|
||||
[submodule ".vim/bundle/tagbar"]
|
||||
path = .vim/bundle/tagbar
|
||||
url = https://github.com/majutsushi/tagbar
|
||||
[submodule ".vim/bundle/vim-pathogen"]
|
||||
path = .vim/bundle/vim-pathogen
|
||||
url = https://github.com/tpope/vim-pathogen.git
|
||||
@@ -49,3 +37,6 @@
|
||||
[submodule ".vim/bundle/vim-javascript"]
|
||||
path = .vim/bundle/vim-javascript
|
||||
url = https://github.com/pangloss/vim-javascript.git
|
||||
[submodule ".vim/bundle/vim-lastplace"]
|
||||
path = .vim/bundle/vim-lastplace
|
||||
url = https://github.com/farmergreg/vim-lastplace.git
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
setlocal shiftwidth=4
|
||||
setlocal expandtab
|
||||
@@ -0,0 +1,2 @@
|
||||
setlocal shiftwidth=2
|
||||
setlocal expandtab
|
||||
Submodule .vim/bundle/ag.vim deleted from 4a0dd6e190
Submodule .vim/bundle/nerdcommenter updated: 285902752f...fd61bc71f6
Submodule .vim/bundle/nerdtree deleted from 5782b228e4
+1
-1
Submodule .vim/bundle/supertab updated: 22aac5c2cb...40fe711e08
Submodule .vim/bundle/tagbar deleted from 59ea6d656a
Submodule .vim/bundle/vim-fugitive deleted from 8f60d1d459
Submodule .vim/bundle/vim-gitgutter updated: dc73a81bfe...1e60667322
+1
-1
Submodule .vim/bundle/vim-go updated: 52c5b1f74d...40e2e19926
Submodule .vim/bundle/vim-javascript updated: ee376ba5c8...7c73d8e1f9
Submodule
+1
Submodule .vim/bundle/vim-lastplace added at 102b68348e
+1
-1
Submodule .vim/bundle/vim-startify updated: 7f910ed436...c905a0c959
@@ -6,82 +6,39 @@ set nocompatible
|
||||
" For multi-byte character support (CJK support, for example):
|
||||
set fileencodings=utf-8,cp1251,latin1
|
||||
|
||||
" Indentation settings. Dragons ahead!
|
||||
set tabstop=4 " The width of the TAB character, plain and simple.
|
||||
|
||||
set shiftwidth=4 " Auto indentation, >>, <<, ==
|
||||
|
||||
set softtabstop=0 " Number of spaces that a <Tab> counts for while performing editing
|
||||
" operations, like inserting a <Tab> or using <BS>.
|
||||
|
||||
set copyindent " Copy the structure of the existing lines indent when
|
||||
" autoindenting a new line (no tab-space reconstruction).
|
||||
|
||||
set preserveindent " When changing the indent of the current line, preserve as much
|
||||
" of the indent structure as possible.
|
||||
|
||||
set noexpandtab " Use the appropriate number of spaces to insert a <Tab>.
|
||||
" Spaces are used in indents with the '>' and '<' commands
|
||||
" and when 'autoindent' is on. To insert a real tab when
|
||||
" 'expandtab' is on, use CTRL-V <Tab>.
|
||||
|
||||
set nowrap " No text wrapping
|
||||
|
||||
set nowrap
|
||||
set modeline
|
||||
|
||||
" Suggested config options
|
||||
set cf " Enable error files & error jumping
|
||||
set clipboard+=unnamed " Yanks go to clipboard instead
|
||||
" Enable error files and error jumping.
|
||||
set cf
|
||||
|
||||
set number " Show line numbers.
|
||||
" Show line numbers.
|
||||
set number
|
||||
|
||||
set showmatch " When a bracket is inserted, briefly jump to the matching
|
||||
" one. The jump is only done if the match can be seen on the
|
||||
" screen. The time to show the match can be set with
|
||||
" 'matchtime'.
|
||||
|
||||
set hlsearch " When there is a previous search pattern, highlight all
|
||||
" its matches.
|
||||
" Highlight matching bracket.
|
||||
set showmatch
|
||||
|
||||
" Search options.
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set smartcase " Override the 'ignorecase' option if the search pattern
|
||||
" contains upper case characters.
|
||||
set smartcase
|
||||
|
||||
set formatoptions=c,q,r " This is a sequence of letters which describes how
|
||||
" automatic formatting is to be done.
|
||||
"
|
||||
" letter meaning when present in 'formatoptions'
|
||||
" ------ ---------------------------------------
|
||||
" c Auto-wrap comments using textwidth, inserting
|
||||
" the current comment leader automatically.
|
||||
" q Allow formatting of comments with "gq".
|
||||
" r Automatically insert the current comment leader
|
||||
" after hitting <Enter> in Insert mode.
|
||||
" t Auto-wrap text using textwidth (does not apply
|
||||
" to comments)
|
||||
|
||||
set background=dark " When set to "dark", Vim will try to use colors that look
|
||||
" good on a dark background. When set to "light", Vim will
|
||||
" try to use colors that look good on a light background.
|
||||
" Any other value is illegal.
|
||||
|
||||
set list " Display tabs and trailing spaces
|
||||
" Display tabs and trailing spaces.
|
||||
set list
|
||||
|
||||
if has("mouse")
|
||||
set mouse=a " Enable the use of the mouse.
|
||||
" Enable the use of the mouse.
|
||||
set mouse=a
|
||||
endif
|
||||
|
||||
if exists("+undofile")
|
||||
" Enable the persistent undo file(s)
|
||||
" Enable the persistent undo file(s)
|
||||
set undodir=~/.vim/undo
|
||||
set undofile
|
||||
endif
|
||||
|
||||
set switchbuf+=usetab " Switch to existing tab; open a new tab for the new buf
|
||||
|
||||
" Custom status line with Git Branch name
|
||||
set statusline=%<%f\ %h%m%r\ %{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
|
||||
|
||||
let mapleader=","
|
||||
|
||||
filetype off
|
||||
@@ -89,46 +46,84 @@ filetype off
|
||||
runtime bundle/vim-pathogen/autoload/pathogen.vim
|
||||
execute pathogen#infect()
|
||||
|
||||
let g:SuperTabDefaultCompletionType = "context"
|
||||
let g:go_fmt_command = "goimports"
|
||||
|
||||
set background=dark
|
||||
colorscheme mydark
|
||||
|
||||
nnoremap ` :ShowMarksOnce<cr>`
|
||||
"command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis | wincmd p
|
||||
" Configure plugins.
|
||||
|
||||
" supertab: tab-complete based on preceding characters (::, ->, . etc).
|
||||
let g:SuperTabDefaultCompletionType = "context"
|
||||
|
||||
" vim-go: not just format the code; insert imports, too.
|
||||
let g:go_fmt_command = "goimports"
|
||||
|
||||
" saving cursor pos and such
|
||||
" Tell vim to remember certain things when we exit
|
||||
" '10 : marks will be remembered for up to 10 previously edited files
|
||||
" "100 : will save up to 100 lines for each register
|
||||
" :20 : up to 20 lines of command-line history will be remembered
|
||||
" 'N : marks will be remembered for up to N previously edited files
|
||||
" "N : will save up to N lines for each register
|
||||
" :N : up to N lines of command-line history will be remembered
|
||||
" % : saves and restores the buffer list
|
||||
" n... : where to save the viminfo files
|
||||
set viminfo='10,\"100,:20,n~/.viminfo
|
||||
function! ResCur()
|
||||
if line("'\"") <= line("$")
|
||||
normal! g`"
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup resCur
|
||||
autocmd!
|
||||
autocmd BufWinEnter * call ResCur()
|
||||
augroup END
|
||||
set viminfo='10,\"100,:100,n~/.viminfo
|
||||
|
||||
" Line width limit hint.
|
||||
augroup EditorWidth
|
||||
autocmd BufEnter * highlight OverLength ctermbg=darkred
|
||||
autocmd BufEnter * match OverLength /\%81v.*/
|
||||
autocmd BufEnter *.go match OverLength /\%101v.*/
|
||||
autocmd BufEnter *.yml match OverLength /\%151v.*/
|
||||
autocmd BufEnter *.data match OverLength /\%151v.*/
|
||||
autocmd BufEnter *.java match OverLength /\%101v.*/
|
||||
" colorcolumn breaks copy from terminal, so we use this instead.
|
||||
au!
|
||||
au BufEnter * highlight OverLength ctermbg=darkred
|
||||
au BufEnter * match OverLength /\%81v./
|
||||
|
||||
au BufEnter *.go match OverLength /\%101v./
|
||||
au BufEnter *.java match OverLength /\%101v./
|
||||
|
||||
au BufEnter *.yml match OverLength /$$/
|
||||
au BufEnter *.data match OverLength /$$/
|
||||
au BufEnter .vimrc match OverLength /$$/
|
||||
augroup END
|
||||
|
||||
" Window navigation map
|
||||
" Custom filetypes.
|
||||
au BufNewFile,BufRead *.pi setf python
|
||||
|
||||
filetype indent off
|
||||
|
||||
" Automatically insert the current comment leader after hitting <Enter> in Insert mode.
|
||||
set formatoptions=r
|
||||
|
||||
" Indentation settings.
|
||||
|
||||
" Width of the TAB column displayed on the screen, in spaces. A value of 8
|
||||
" means that it will be consistent with console, printer and others.
|
||||
set tabstop=8
|
||||
|
||||
" Number of spaces inserted when pressing TAB, or removed when pressing
|
||||
" BACKSPACE. If 0, TAB inserts <tabstop> spaces, and automatically converts
|
||||
" them to TAB characters per <tabstop> and <expandtab>.
|
||||
set softtabstop=0
|
||||
|
||||
" shiftwidth: number of spaces inserted when using indentation methods,
|
||||
" like >>, <<, ==. If shiftwidth=tabstop, a TAB character is inserted instead
|
||||
" of spaces. When shifting, spaces will be replaced by TAB characters as
|
||||
" necessary.
|
||||
set shiftwidth=8
|
||||
" smarttab: typing TAB in front of the line behaves like >>, while in text,
|
||||
" typing TAB will add <softtabstop> spaces and convert spaces to TAB
|
||||
" characters per <tabstop> and <expandtab>.
|
||||
set smarttab
|
||||
|
||||
" When a new line is added, keep indentation level of the previous line.
|
||||
set autoindent
|
||||
" When a new line is added, copy exactly indentation level of the previous
|
||||
" line (i.e. do not try to replace <tabstop> spaces with tabs).
|
||||
set copyindent
|
||||
set preserveindent
|
||||
|
||||
" expandtab: ALWAYS insert <shiftwidth> spaces when typing TAB.
|
||||
set noexpandtab
|
||||
|
||||
" Shortcuts.
|
||||
nnoremap ` :ShowMarksOnce<cr>`
|
||||
noremap <C-\> :let @/ = ""<CR>
|
||||
|
||||
" Window navigation map.
|
||||
fu! Amap(key, cmd, ...)
|
||||
let l:cr="<CR>"
|
||||
let l:p=":"
|
||||
@@ -147,52 +142,19 @@ fu! Amap(key, cmd, ...)
|
||||
exe "imap " . l:key . " <c-o>" . l:key . ""
|
||||
endf
|
||||
|
||||
"call Amap("C-t", "tabnew")
|
||||
"call Amap("C-b", ":ls<CR>:b<Space>", 0)
|
||||
"call Amap("C-w", "close")
|
||||
|
||||
"call Amap("F2", "update")
|
||||
"call Amap("F3", "NERDTreeToggle")
|
||||
"call Amap("F7", "TagbarToggle")
|
||||
|
||||
" Navigate by tabs with Shift+Left/Right
|
||||
"call Amap("S-Left", "tabprev")
|
||||
"call Amap("S-Right", "tabnext")
|
||||
|
||||
" Navigate by windows with Ctrl+direction
|
||||
"call Amap("C-Left", "wincmd h")
|
||||
"call Amap("C-Down", "wincmd j")
|
||||
"call Amap("C-Up", "wincmd k")
|
||||
"call Amap("C-Right", "wincmd l")
|
||||
|
||||
" Resize windows with Alt+direction
|
||||
call Amap("M-Left", "vertical resize -1")
|
||||
call Amap("M-Down", "resize +1")
|
||||
call Amap("M-Up", "resize -1")
|
||||
call Amap("M-Right", "vertical resize +1")
|
||||
|
||||
" Move windows with Ctrl+Shift+direction
|
||||
"call Amap("C-S-Left", "wincmd H")
|
||||
"call Amap("C-S-Down", "wincmd J")
|
||||
"call Amap("C-S-Up", "wincmd K")
|
||||
"call Amap("C-S-Right", "wincmd L")
|
||||
call Amap("C-t", "tabnew")
|
||||
call Amap("C-b", ":ls<CR>:b<Space>", 0)
|
||||
call Amap("C-w", "close")
|
||||
|
||||
" Backspace navigates 'Back'
|
||||
nmap <BS> <C-O>
|
||||
nmap <S-BS> <C-I>
|
||||
"call Amap("C-p", "cp")
|
||||
"call Amap("C-n", "cn")
|
||||
|
||||
" Working with SSH clipboard
|
||||
" Working with clipboard over SSH
|
||||
" This doesn't paste; it prepares vim to do so. Use ^D when finished.
|
||||
call Amap("zp", "r !cat", 1)
|
||||
"setl noai nocin nosi inde= formatoptions-=c formatoptions-=r formatoptions-=o nonumber
|
||||
" This doesn't yank; it (un)prepares vim to do so.
|
||||
"call Amap("zy", "setl paste! number! list! <bar> NoShowMarks <bar> GitGutterToggle", 1)
|
||||
|
||||
"noremap <silent> <Leader>y :w !printf "\e]52;c;$(base64 -w0)\a"<Return><Esc>
|
||||
"noremap <silent> <Leader>y :w !printf "\eP\e]52;c;$(base64 -w0)\a\e\\"<Return><Esc>
|
||||
|
||||
call Amap("zy", "setl paste! number! list! <bar> NoShowMarks <bar> GitGutterToggle", 1)
|
||||
" https://github.com/mobile-shell/mosh/issues/637 D'oh, really Mosh?!
|
||||
" Well at least works with SecureShell + screen.
|
||||
noremap <silent> <Leader>y :w !printf "
|
||||
@@ -200,12 +162,8 @@ noremap <silent> <Leader>y :w !printf "
|
||||
\\e]52;c;$(base64 -w0)\a
|
||||
\$([[ "${TERM/-*/}" == screen ]] && printf "\e\\")"<Return><Esc>
|
||||
|
||||
" custom filetypes
|
||||
au BufNewFile,BufRead *.fasm setf fasm
|
||||
au BufNewFile,BufRead *.pi setf python
|
||||
|
||||
" Convenient write commands. w!! for sudo, others for holding Shift for too long.
|
||||
cmap w!! %!sudo tee >/dev/null %<CR>
|
||||
|
||||
command WQ wq
|
||||
command Wq wq
|
||||
command W w
|
||||
@@ -213,23 +171,7 @@ command Q q
|
||||
command Qa qa
|
||||
command QA qa
|
||||
|
||||
" keep in sync with https://github.com/dasfoo/travis/blob/master/go.sh
|
||||
let g:go_metalinter_command = "gometalinter " .
|
||||
\ "--disable=unconvert " .
|
||||
\ "--disable=dupl " .
|
||||
\ "--disable=gas " .
|
||||
\ "--enable=testify " .
|
||||
\ "--enable=test ".
|
||||
\ "--enable=goimports " .
|
||||
\ "--enable=gofmt " .
|
||||
\ "--enable=lll " .
|
||||
\ "--enable=misspell " .
|
||||
\ "--deadline=1m " .
|
||||
\ "--line-length=100 " .
|
||||
\ "--exclude='\.pb\.go:' " .
|
||||
\ "./..."
|
||||
|
||||
|
||||
" Local machine overrides.
|
||||
if filereadable(expand("~/.vimrc_local"))
|
||||
source ~/.vimrc_local
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user