[vim]indent in .vimrc is now all 8spaces

This commit is contained in:
Mathieu Maret 2015-02-27 16:38:02 +01:00 committed by Mathieu Maret
parent 6ec7ecf12d
commit 534d9217cb
1 changed files with 89 additions and 87 deletions

176
.vimrc
View File

@ -2,7 +2,8 @@
" SHORTCUTS " " SHORTCUTS "
""""""""""""" """""""""""""
" F1 help " F1 help
" F2 open file " F2 open file in a new tab
" S-F2 Split and open file
" F3 autotags Update " F3 autotags Update
" S-F3 autotags Add " S-F3 autotags Add
" F4 open include file " F4 open include file
@ -43,10 +44,10 @@ set nobackup
set autowrite set autowrite
" jump to last known position when reopening a file " jump to last known position when reopening a file
if has("autocmd") if has("autocmd")
autocmd BufReadPost * autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") | \ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute "normal! g`\"" | \ execute "normal! g`\"" |
\ endif \ endif
endif endif
" command line history " command line history
set history=50 set history=50
@ -122,17 +123,17 @@ set shiftwidth=8
" set noexpandtab " set noexpandtab
if has("autocmd") if has("autocmd")
" python " python
" autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab " autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
autocmd BufRead,BufNewFile *.py syntax on autocmd BufRead,BufNewFile *.py syntax on
autocmd BufRead,BufNewFile *.py set ai autocmd BufRead,BufNewFile *.py set ai
autocmd BufRead,BufNewFile *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd BufRead,BufNewFile *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufRead,BufNewFile *.py set tabstop=4 autocmd BufRead,BufNewFile *.py set tabstop=4
autocmd BufRead,BufNewFile *.py set expandtab autocmd BufRead,BufNewFile *.py set expandtab
autocmd BufRead,BufNewFile *.py set shiftwidth=4 autocmd BufRead,BufNewFile *.py set shiftwidth=4
autocmd BufRead,BufNewFile *.py set softtabstop=4 autocmd BufRead,BufNewFile *.py set softtabstop=4
autocmd BufRead,BufNewFile *.py set modeline autocmd BufRead,BufNewFile *.py set modeline
autocmd BufRead,BufNewFile *.py set ft=python autocmd BufRead,BufNewFile *.py set ft=python
endif endif
if has("autocmd") if has("autocmd")
@ -141,32 +142,32 @@ endif
" vim -b : edit binary using xxd-format! " vim -b : edit binary using xxd-format!
augroup Binary augroup Binary
au! au!
au BufReadPre *.bin let &bin=1 au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif au BufWritePost *.bin set nomod | endif
augroup END augroup END
if has("autocmd") if has("autocmd")
" enable file type detection and do language-dependent indenting " enable file type detection and do language-dependent indenting
" filetype plugin indent on " filetype plugin indent on
" detect indentation see http://www.freehackers.org/Indent_Finder " detect indentation see http://www.freehackers.org/Indent_Finder
if has('python') if has('python')
autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output "' . expand('%') . '"' ) autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output "' . expand('%') . '"' )
endif endif
else else
" auto-indent " auto-indent
set autoindent set autoindent
" smart-indent " smart-indent
set smartindent set smartindent
" C-indent " C-indent
"set cindent "set cindent
" indent-expr " indent-expr
"set indentexpr "" "set indentexpr ""
endif endif
map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR> map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR>
@ -196,16 +197,16 @@ runtime macros/matchit.vim
" imap <F5> <ESC><F5>i " imap <F5> <ESC><F5>i
" try to go to definition or declaration with , and go back with ; " try to go to definition or declaration with , and go back with ;
function GoToDefinition() function GoToDefinition()
try try
execute "cscope find g " . expand("<cword>") execute "cscope find g " . expand("<cword>")
catch /:E259:/ catch /:E259:/
try try
execute "tag " . expand("<cword>") execute "tag " . expand("<cword>")
catch /:E257:/ catch /:E257:/
execute "normal! gd" execute "normal! gd"
execute "nohlsearch" execute "nohlsearch"
endtry endtry
endtry endtry
endfunction endfunction
nmap <silent> , :call GoToDefinition()<CR> nmap <silent> , :call GoToDefinition()<CR>
nmap <silent> ; <C-t> nmap <silent> ; <C-t>
@ -232,18 +233,18 @@ map <silent> <F8> :TlistToggle<CR>
" close preview window after a completion " close preview window after a completion
if has("autocmd") if has("autocmd")
autocmd CursorMovedI *.{[hc],cpp} if pumvisible() == 0|pclose|endif autocmd CursorMovedI *.{[hc],cpp} if pumvisible() == 0|pclose|endif
autocmd InsertLeave *.{[hc],cpp} if pumvisible() == 0|pclose|endif autocmd InsertLeave *.{[hc],cpp} if pumvisible() == 0|pclose|endif
endif endif
function! TagInNewTab() function! TagInNewTab()
let word = expand("<cword>") let word = expand("<cword>")
redir => tagsfiles redir => tagsfiles
silent execute 'set tags' silent execute 'set tags'
redir END redir END
tabe tabe
execute 'setlocal' . strpart(tagsfiles, 2) execute 'setlocal' . strpart(tagsfiles, 2)
execute 'tag ' . word execute 'tag ' . word
endfunction endfunction
nmap <S-Enter> :call TagInNewTab()<CR> nmap <S-Enter> :call TagInNewTab()<CR>
@ -269,31 +270,32 @@ set splitbelow
set splitright set splitright
" if multiple windows " if multiple windows
if bufwinnr(1) if bufwinnr(1)
" vertically increase/decrease window size with alt+up/alt+down " vertically increase/decrease window size with alt+up/alt+down
map <M-Up> <C-W>+ map <M-Up> <C-W>+
map <M-Down> <C-W>- map <M-Down> <C-W>-
imap <M-Up> <ESC><M-Up>a imap <M-Up> <ESC><M-Up>a
imap <M-Down> <ESC><M-Down>a imap <M-Down> <ESC><M-Down>a
" horizontally increase/decrease window size with alt+right/alt+left " horizontally increase/decrease window size with alt+right/alt+left
map <M-Right> <C-W>> map <M-Right> <C-W>>
map <M-Left> <C-W>< map <M-Left> <C-W><
imap <M-Right> <ESC><M-Right>a imap <M-Right> <ESC><M-Right>a
imap <M-Left> <ESC><M-Left>a imap <M-Left> <ESC><M-Left>a
" switch to next/previous tab with ctrl+right/ctrl+left " switch to next/previous tab with ctrl+right/ctrl+left
map <C-Right> gt map <C-Right> gt
map <C-Left> gT map <C-Left> gT
imap <C-Right> <ESC><C-Right>a imap <C-Right> <ESC><C-Right>a
imap <C-Left> <ESC><C-Left>a imap <C-Left> <ESC><C-Left>a
" switch to next/previous window with ctrl+down/ctrl+up " switch to next/previous window with ctrl+down/ctrl+up
map <C-Down> <C-W>w map <C-Down> <C-W>w
map <C-Up> <C-W>W map <C-Up> <C-W>W
imap <C-Down> <ESC><C-Down>a imap <C-Down> <ESC><C-Down>a
imap <C-Up> <ESC><C-Up>a imap <C-Up> <ESC><C-Up>a
endif endif
" open automatically quickfix window " open automatically quickfix window
if has("autocmd") if has("autocmd")
autocmd QuickFixCmdPost * cw autocmd QuickFixCmdPost * cw
endif endif
" open a file in the same directory as the current file with F2 and split with shift+F2 " open a file in the same directory as the current file with F2 and split with shift+F2
map <F2> :tabe <C-R>=expand("%:h") . "/"<CR> map <F2> :tabe <C-R>=expand("%:h") . "/"<CR>
nmap <S-F2> :split <C-R>=expand("%:h") . "/"<CR> nmap <S-F2> :split <C-R>=expand("%:h") . "/"<CR>
@ -308,15 +310,15 @@ nmap <silent> <S-F1> :tabe ~/.vimrc<CR>gg
imap <S-F1> <Esc><S-F1> imap <S-F1> <Esc><S-F1>
" show contextual help with F1 " show contextual help with F1
function Help() function Help()
try try
if b:current_syntax == "python" if b:current_syntax == "python"
:call ShowPyDoc(expand("<cword>"), 1) :call ShowPyDoc(expand("<cword>"), 1)
else else
execute "Man " . expand("<cword>") execute "Man " . expand("<cword>")
endif endif
catch /:E149:/ catch /:E149:/
execute "help " . expand("<cword>") execute "help " . expand("<cword>")
endtry endtry
endfunction endfunction
nmap <silent> <F1> :call Help()<CR> nmap <silent> <F1> :call Help()<CR>
imap <F1> <Esc><F1> imap <F1> <Esc><F1>
@ -329,7 +331,7 @@ imap <M-S-F1> <Esc><M-S-F1>
""""""""" """""""""
" show current changes with F10 " show current changes with F10
command! DiffOrig command! DiffOrig
\ vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis \ vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis
map <M-F10> :DiffOrig<CR> map <M-F10> :DiffOrig<CR>
imap <M-F10> <ESC><M-F10>a imap <M-F10> <ESC><M-F10>a
" show git diff when committing " show git diff when committing