diff options
Diffstat (limited to 'base/vimrc')
-rw-r--r-- | base/vimrc | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/base/vimrc b/base/vimrc new file mode 100644 index 0000000..8897bff --- /dev/null +++ b/base/vimrc @@ -0,0 +1,151 @@ +" Setting editor defaults +set nu +syntax on +set bg=dark +set diffopt=filler,iwhite " keep files synced and ignore whitespace +set expandtab " Get rid of tabs altogether and replace with spaces +"set guioptions-=m " Remove menu from the gui +set guioptions-=T " Remove toolbar +set hidden " hide buffers instead of closing +set history=50 " keep 50 lines of command line history +set ignorecase " Do case insensitive matching +set smartcase " Ignore case only when doing a lowercase search +set incsearch " Incremental search +set linebreak " This displays long lines as wrapped at word boundries +set matchtime=10 " Time to flash the brack with showmatch +set nobackup " Don't keep a backup file +set nocompatible " Use Vim defaults (much better!) +set hlsearch " Use highlighted search (I am blind) +set t_Co=256 " Set terminal to use 256 colors +set backspace=indent,eol,start +set clipboard=unnamed " Use system clipboard for all cut/copy operations +set ruler +set foldmethod=indent +set nofen +set mouse=a +set spell spelllang=en +set wildmode=list:longest,full +set nomousehide +set sessionoptions+=resize,winpos +set listchars=tab:>-,trail:. +set list +set colorcolumn=100,+0 +set guifont=Inconsolata\ Medium\ 12 + +" Status Line Settings +set laststatus=2 " always have status bar +set statusline= +set statusline+=%n\ +set statusline+=%<%f\ %h%m%r +set statusline+=%= +set statusline+=%-14.(%l,%c%V%)\ %P + +" Emacs-like bindings in the command line +cnoremap <C-a> <Home> +cnoremap <C-e> <End> +cnoremap <C-p> <Up> +cnoremap <C-n> <Down> +cnoremap <C-b> <Left> +cnoremap <C-f> <Right> +cnoremap <M-b> <S-Left> +cnoremap <M-f> <S-Right> + +" filetypes +filetype plugin on +filetype indent on +filetype on + +"Set colorscheme. +colorscheme slate +highlight ColorColumn ctermbg=DarkGrey guibg=DarkGrey + +" Turn off highlighting after search +map ,, :nohl<CR> + +" Remove all trailing whitespaces +map <Leader>s :%s/\s\+$//g <cr> + +" toggle line number with F11 or Ctrl-L +map <F11> : set number! <cr> +map <C-L> : set number! <cr> + +" Move between split windows +map O5B <C-W>j +map O5A <C-W>k +map O5D <C-W>h +map O5C <C-W>l +imap O5B <C-W>j +imap O5A <C-W>k +imap O5D <C-W>h +imap O5C <C-W>l + +"Set tab to 4 spaces +set shiftwidth=4 +set softtabstop=4 +set tabstop=4 +set smarttab + +" Paste from GUI into vim and not lose indendation +" F7 to toggle paste mode +map <F7> :set invpaste<CR> +set pastetoggle=<F7> + +"normal mode maps + +" Switch to/from header file +map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> + +"Map \e to edit a file from the directory of the current buffer +if has("unix") + nmap <Leader>e :e <C-R>=expand("%:p:h") . "/"<CR> +else + nmap <Leader>,e :e <C-R>=expand("%:p:h") . "\\"<CR> +endif + +cabbr <expr> %% expand('%:p:h') + +"When editing a file, make screen display the name of the file you are editing +function! SetTitle() + if $TERM =~ "^screen" + let l:title = 'vi: ' . expand('%:t') + + if (l:title != 'vi: __Tag_List__') + let l:truncTitle = strpart(l:title, 0, 15) + silent exe '!echo -e -n "\033k' . l:truncTitle . '\033\\"' + endif + endif +endfunction + +" Run it every time we change buffers +autocmd BufEnter,BufFilePost * call SetTitle() + +" Scratch Plugin +let g:scratchBackupFile="/tmp/scratch.txt" + +" Quicker compile & check +map <C-x> :silent make<Enter>:copen<Enter><C-w><C-w>:redraw<Enter> + +let g:GPGFilePattern = '*.\(gpg\|pgp\)' + +execute pathogen#infect() + +" Spell Check colors +highlight clear SpellBad +highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline +highlight clear SpellCap +highlight SpellCap term=underline cterm=underline +highlight clear SpellRare +highlight SpellRare term=underline cterm=underline +highlight clear SpellLocal +highlight SpellLocal term=underline cterm=underline + +" ctrlp +let g:ctrlp_extensions = ['tag', 'buffertag'] +map <C-r> :CtrlPTag<Enter> +map <C-y> :redo<Enter> +set scroll=2 + +" Load host-specific settings +set runtimepath^=~/.host-specific/vim, +set runtimepath+=~/.host-specific/vim/after +source ~/.host-specific/vimrc |