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