vim: general tidying

This commit is contained in:
2019-11-04 13:05:54 +00:00
parent de0c54a495
commit 2a41a89d90

48
vimrc
View File

@@ -12,15 +12,16 @@ call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim',
Plug 'pbogut/fzf-mru.vim',
Plug 'tpope/vim-fugitive'
" Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
Plug 'jreybert/vimagit'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'wesQ3/vim-windowswap'
Plug 'majutsushi/tagbar'
" be sure to read full install instructions. this still needs
" you to cd ~/.vim/plugged/YouCompleteMe
@@ -78,7 +79,11 @@ set complete=.,b,u,]
set wildignore+=deps/*,node_modules/*,*.sw?
color desert
let g:airline_theme="papercolor"
if has("AirlineTheme")
if has("gui_running")
let g:airline_theme="papercolor"
endif
endif
" enable syntax highlighting if it is supported
if has("syntax")
@@ -100,13 +105,7 @@ set lazyredraw
set splitbelow
set splitright
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <c-left> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-right> :TmuxNavigateDown<cr>
nnoremap <silent> <c-up> :TmuxNavigateUp<cr>
nnoremap <silent> <c-down> :TmuxNavigateRight<cr>
nnoremap <silent> <c-f2> :TmuxNavigatePrevious<cr>
map <C-T> :pop<CR>
" tabbing and indent options
function! TabSize (size)
@@ -132,8 +131,7 @@ augroup filetype
au BufRead,BufNewFile *.[ch]@@.+ set filetype=c
au bufRead,BufNewFile *.cc set filetype=cpp
au bufRead,BufNewFile *.cpp set filetype=cpp
" au BufRead,BufNewFile *.ex set filetype=elixir
" au BufRead,BufNewFile *.exs set filetype=elixir
au bufRead,BufNewFile *.inc set filetype=make
au BufRead,BufNewFile *.eex set filetype=html
augroup END
@@ -142,33 +140,22 @@ augroup cppprog
au BufRead,BufNewFile *.h set cindent
au BufRead,BufNewFile *.cc set cindent
au BufRead,BufNewFile *.cpp set cindent
call TabSize(4)
augroup END
augroup dropbox
au!
au BufRead,BufNewFile ~/Dropbox/* set directory=~/tmp,/var/tmp,/tmp
au BufRead,BufNewFile Dropbox/* set directory=~/tmp,/var/tmp,/tmp
au BufRead,BufNewFile /home/paul/Dropbox/* set directory=~/tmp,/var/tmp,/tmp
augroup END
" Turn C syntax on for C and header files
augroup cprog
au!
au BufRead,BufNewFile *.[ch] set cindent
" simulate C++ comments (sort of) and provide a means to uncomment easily
map // ^i/* <ESC>$a */<ESC>
map \\ bhh/ *[*][/]<CR>d/[/]<CR>x?[/][*]<CR>dw
" Normal tabsizes
" call TabSize(4)
call TabSize(4)
augroup END
" Apply the muttrc colouring to mutt setup files:
au BufNewFile,BufRead .mutt.* set ft=muttrc
" Automatic typo fixing
iab Cunt Count
iab cunt count
iab LOG_LVL_NOTIFY LOG_LVL_NOTICE
iab KREN_EMERG KERN_EMERG
" Disable the command 'K' (keyword lookup)
@@ -219,7 +206,9 @@ map <C-CR> @a
" Set swapsync to 'nothing' - potentially more data loss (no forced write to disk
" on swap write), but makes writes faster. I'm willing to take the chance. :-)
set sws=
if !has("nvim")
set sws=
endif
" Set showmatch - this flashes the cursor briefly at the matching ( or {
" when ) or } is entered. (If user keeps typing, cursor just pops up very
@@ -315,10 +304,10 @@ map <F1> :!man <cword><CR>
" Use fzf to find files
map <F2> :Files<CR>
map <C-P> :Files<CR>
map <C-S-P> :Files <C-R>=expand("%:p:h")<CR>
nnoremap <silent> <leader>m :FZFMru<CR>
map <F3> :Ag <C-R>=expand("<cword>")<CR><CR>
nnoremap <leader>f :Ag <C-R>=expand("<cword>")<CR><CR>
@@ -336,6 +325,8 @@ map <F9> :only<CR>
" map <F11> :cal SetSyn("c")<CR>
map <F11> :syntax sync fromstart<CR>
nnoremap <leader>t :TagbarToggle<CR>
" repeat the last command on the next line (F12 is Again on Sun keyboards)
map <F12> j.
@@ -369,6 +360,7 @@ if has("cscope")
set cscopepathcomp=2
endif
set csverb
map ,scs0 :cs add cscope.out<CR>
map ,fs :cs find s <C-R>=expand("<cword>")<CR><CR>
map ,fg :cs find g <C-R>=expand("<cword>")<CR><CR>
map ,fd :cs find d <C-R>=expand("<cword>")<CR><CR>
@@ -406,5 +398,5 @@ function! ToggleWindowHorizontalVerticalSplit()
endif
endfunction
nnoremap <silent> <leader>wt :call ToggleWindowHorizontalVerticalSplit()<cr>
nnoremap <silent> <leader>wst :call ToggleWindowHorizontalVerticalSplit()<cr>