1
0
Fork 0
vim-config/vimrc

158 lines
5.2 KiB
VimL

" This is my vimrc. There are many like it, but this one is mine.
set nocompatible " Must come first because it changes other options.
execute pathogen#infect()
set t_Co=256 " Set terminal colors
syntax enable " Turn on syntax highlighting.
filetype plugin indent on " Turn on file type detection.
runtime macros/matchit.vim " Load the matchit plugin.
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
" set hlsearch " Highlight matches.
set nowrap " Turn off line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
set title " Set the terminal's title
set visualbell " No beeping.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set directory=$HOME/.vim/tmp//,. " Keep swap files in one location
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
set laststatus=2 " Show the status line all the time
" Useful status information at bottom of screen
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
" Use :make to execute Ruby files"
set makeprg=ruby\ %
" Use system clipboard
" set clipboard=unnamedplus
" Tab mappings.
" map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabnext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmove
map <leader>md :!pandoc -f markdown -t html -o /tmp/readme-%.html % && firefox /tmp/readme-%.html<cr>
" Record macros with qq and play them with space
:nnoremap <Space> @q
cnoremap %% <C-R>=expand('%:h').'/'<cr>
" map <leader>e :edit %%
" map <leader>v :view %%
" Uncomment to use Jamis Buck's file opening plugin
"map <Leader>t :FuzzyFinderTextMate<Enter>
" Controversial...swap colon and semicolon for easier commands
"nnoremap ; :
"nnoremap : ;
"vnoremap ; :
"vnoremap : ;
" Automatic fold settings for specific files. Uncomment to use.
" autocmd FileType ruby setlocal foldmethod=syntax
autocmd FileType css setlocal shiftwidth=2 tabstop=2
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType jade setlocal shiftwidth=2 tabstop=2
autocmd FileType md setlocal shiftwidth=2 tabstop=2
" For the MakeGreen plugin and Ruby RSpec. Uncomment to use.
autocmd BufNewFile,BufRead *_spec.rb compiler rspec
" let ts=4 sw=4 et
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
au BufRead,BufNewFile *.json set filetype=json
au! Syntax json source ~/.vim/ftplugin/json.vim
au BufRead,BufNewFile /usr/local/nginx/conf/* set ft=nginx
" Highlight trailing whitespaces
highlight ExtraWhitespace ctermbg=red guibg=red
au ColorScheme * highlight ExtraWhitespace guibg=red
au BufEnter * match ExtraWhitespace /\s\+$/
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhiteSpace /\s\+$/
" Vimroom
let g:vimroom_background = 'white'
map <Leader>vr :VimroomToggle
let g:vimroom_width = 120
" CTags
map <Leader>ct :!/usr/bin/ctags -R --extra=+q .<CR>
set tags+=gems.tags
" Color scheme
colorscheme smyck
let g:syntastic_mode_map = { 'mode': 'active', 'active_filetypes': ['ruby', 'js', 'javascript', 'ts', 'typescript'], 'passive_filetypes': ['puppet'] }
let g:syntastic_javascript_checkers = ['eslint']
" Highlight the current line when in insert mode
:autocmd InsertEnter,InsertLeave * set cul!
hi CursorLine cterm=NONE ctermbg=black
" Spell-checking and automatic line breaks for Git commit messages
autocmd Filetype gitcommit setlocal spell textwidth=72
let loaded_matchparen = 1
" au InsertEnter * hi StatusLine term=reverse ctermbg=1
" au InsertLeave * hi StatusLine term=reverse cterm=none ctermbg=8 ctermfg=15 gui=none guibg=#5D5D5D guifg=#FBFBFB
" bind control-l to hashrocket
imap <C-l> <Space>=><Space>"
" xmpfilter
map <F4> <Plug>(xmpfilter-mark)
map <F5> <Plug>(xmpfilter-run)
" Use normal tabs, not spaces, in Makefiles
autocmd filetype make setlocal noexpandtab
let g:ycm_server_python_interpreter = '/usr/bin/python3'
" TypeScript
let g:syntastic_typescript_checkers = ['eslint', 'tsuquyomi']
let g:tsuquyomi_disable_quickfix = 1
" Store swap files etc. in a central location instead of next to source files
set directory^=$HOME/.vim/tmp//