vimrc: Group autocommands, change colorcolumn color
This commit is contained in:
52
.vimrc
52
.vimrc
@@ -34,19 +34,35 @@ else
|
|||||||
command CloneVundle execute "!git clone " . vundle_repo . " " . vundle_dir
|
command CloneVundle execute "!git clone " . vundle_repo . " " . vundle_dir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set updatetime=1000 " Default is 4s, but reduce it to make things more real time, like git gutter
|
if !exists("vimrc_autocmds_loaded")
|
||||||
highlight Search ctermbg=5
|
let vimrc_autocmds_loaded = 1
|
||||||
|
|
||||||
filetype plugin indent on " required
|
" Set the filetype based on the file's extension, but only if
|
||||||
syntax on
|
" 'filetype' has not already been set
|
||||||
"
|
|
||||||
" Set the filetype based on the file's extension, but only if
|
|
||||||
" 'filetype' has not already been set
|
|
||||||
augroup filetypedetect
|
|
||||||
au BufRead,BufNewFile .i3initrc setfiletype sh
|
au BufRead,BufNewFile .i3initrc setfiletype sh
|
||||||
au BufRead,BufNewFile *.config setfiletype conf
|
au BufRead,BufNewFile *.config setfiletype conf
|
||||||
au BufRead,BufNewFile [Ss]nakefile.* setfiletype snakemake
|
au BufRead,BufNewFile [Ss]nakefile.* setfiletype snakemake
|
||||||
augroup END
|
|
||||||
|
au BufWritePost * if search('\s\+$', 'wn') | call WhitespaceWarn() | endif
|
||||||
|
|
||||||
|
au BufRead,BufNewFile * setlocal textwidth=0 | setlocal colorcolumn=
|
||||||
|
au BufRead,BufNewFile *.md setlocal textwidth=80 | setlocal colorcolumn=80
|
||||||
|
|
||||||
|
if exists(":NERDTree")
|
||||||
|
" Open NERDTree if no file specified
|
||||||
|
au StdinReadPre * let s:std_in=1
|
||||||
|
au VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
au BufEnter,FocusGained,InsertLeave * set rnu
|
||||||
|
au BufLeave,FocusLost,InsertEnter * set nornu
|
||||||
|
endif
|
||||||
|
set updatetime=1000 " Default is 4s, but reduce it to make things more real time, like git gutter
|
||||||
|
highlight Search ctermbg=5
|
||||||
|
highlight ColorColumn ctermbg=4
|
||||||
|
|
||||||
|
filetype plugin indent on " required
|
||||||
|
syntax on
|
||||||
|
|
||||||
set tabstop=4 " show existing tab with 4 spaces width
|
set tabstop=4 " show existing tab with 4 spaces width
|
||||||
set shiftwidth=4 " when indenting with '>', use 4 spaces width
|
set shiftwidth=4 " when indenting with '>', use 4 spaces width
|
||||||
@@ -75,17 +91,11 @@ function! StripTrailingWhitespace()
|
|||||||
call winrestview(l:save)
|
call winrestview(l:save)
|
||||||
echo "Stripped trailing whitespace"
|
echo "Stripped trailing whitespace"
|
||||||
endfunction
|
endfunction
|
||||||
au BufRead,BufNewFile *.md setlocal textwidth=80
|
|
||||||
autocmd BufWritePost * if search('\s\+$', 'wn') | call WhitespaceWarn() | endif
|
|
||||||
command TrailWhitespace call StripTrailingWhitespace()
|
command TrailWhitespace call StripTrailingWhitespace()
|
||||||
|
|
||||||
" Hybrid line numbers on active buffer
|
" Hybrid line numbers on active buffer
|
||||||
set nu rnu
|
set nu rnu
|
||||||
augroup numbertoggle
|
|
||||||
autocmd!
|
|
||||||
autocmd BufEnter,FocusGained,InsertLeave * set rnu
|
|
||||||
autocmd BufLeave,FocusLost,InsertEnter * set nornu
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" Do incremental searching when it's possible to timeout.
|
" Do incremental searching when it's possible to timeout.
|
||||||
if has('reltime')
|
if has('reltime')
|
||||||
@@ -118,11 +128,6 @@ set statusline+=\ %l:%c"
|
|||||||
set statusline+=%#MoreMsg#
|
set statusline+=%#MoreMsg#
|
||||||
set statusline+=\ "
|
set statusline+=\ "
|
||||||
|
|
||||||
if exists(":NERDTree")
|
|
||||||
" Open NERDTree if no file specified
|
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
|
||||||
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" CtrlP
|
" CtrlP
|
||||||
let g:ctrlp_working_path_mode = 'ra'
|
let g:ctrlp_working_path_mode = 'ra'
|
||||||
@@ -172,11 +177,6 @@ vnoremap <leader>* y:%sno/<c-r>"//g<left><left>
|
|||||||
nmap <F2> :NERDTreeToggle<CR>
|
nmap <F2> :NERDTreeToggle<CR>
|
||||||
nmap <F3> :NERDTreeFind<CR>
|
nmap <F3> :NERDTreeFind<CR>
|
||||||
map <F5> :call CurtineIncSw()<CR>
|
map <F5> :call CurtineIncSw()<CR>
|
||||||
nmap <F8> :silent !/home/efjtjkb/bin/comp<enter>
|
|
||||||
" Remap <F9> (c-vim uses this)
|
|
||||||
"nmap <F9> :silent !/home/efjtjkb/bin/run<enter>
|
|
||||||
autocmd VimEnter * noremap <F9> :silent !/home/efjtjkb/bin/run<enter>
|
|
||||||
nmap <F10> :silent !/home/efjtjkb/bin/run old<enter>
|
|
||||||
|
|
||||||
nmap <Leader>cf :cd %:p:h <CR> " Change dir to parent of current file
|
nmap <Leader>cf :cd %:p:h <CR> " Change dir to parent of current file
|
||||||
nmap <Leader>cg :cd $git_root_location <CR> " Change dir to git root
|
nmap <Leader>cg :cd $git_root_location <CR> " Change dir to git root
|
||||||
|
|||||||
Reference in New Issue
Block a user