Skip to content

Instantly share code, notes, and snippets.

@ChrisAichinger
Created May 13, 2015 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisAichinger/dbeefd9936b97e50c5c5 to your computer and use it in GitHub Desktop.
Save ChrisAichinger/dbeefd9936b97e50c5c5 to your computer and use it in GitHub Desktop.
My vimrc 13.05.2015
let $LANG = 'en_US.UTF-8'
let $LC_MESSAGES = 'en_US.UTF-8'
set langmenu="en_US.utf-8"
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set nobackup " Don't keep a backup file
set viminfo='20,<50 " read/write a .viminfo file, don't store more than
" 50 lines per registers
set nofoldenable " disable folding
set nojoinspaces " Make gq use only one space when joining sentences.
set winminheight=0 " Allow squishing windows to just show the statusbar
set guifont=Courier\ New:h8
set colorcolumn=80 " Color column 80
set clipboard+=unnamed
set expandtab " Death to tabs
set scrolloff=2 " Show at least 3 lines before/past the cursor in buf
set virtualedit=block " Allow putting the cursor anywhere in Visual block
" mode, e.g. past the end of the line.
set tags=tags,/usr/include/tags
set writebackup
set backupcopy=no
set backupskip=
set dir=~/vimfiles/vim_backups
set showmatch " Show matching brackets.
"set smartcase " Do smart case matching
"set autowrite " Automatically save before commands like :next and :make
set spell " Enable spell checking where sensible
" Standard statusline except for Syntastic support.
set statusline=%<%f\ [%{strlen(&fenc)?&fenc:'none'},%{&ff}]%h%m%r%y " fname & flags
set statusline+=\ %#StatusBarWarning#%{SyntasticStatuslineFlag()}%* " syntastic
set statusline+=%= " right align
set statusline+=%-14.(%l,%c%V%)\ %P " row & column
syntax on
set background=dark
colorscheme evening
hi Folded ctermbg=bg ctermfg=red
hi Normal ctermbg=black
hi ColorColumn ctermbg=darkgrey guibg=#3A3A3A " Column 80
hi StatusBarWarning term=standout ctermfg=LightRed guifg=#CC0000 guibg=White " Syntax errors in SB
hi OverLength ctermbg=darkred ctermfg=white guibg=darkred " Overly long lines
hi TrailingWhitespace ctermbg=darkred guibg=darkred " Trailing Whitespace
au BufWinEnter,WinEnter * let w:m1=matchadd('TrailingWhitespace', '\s\+$', -1)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Filetype specific stuff
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Override Modula2 filetype.
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
autocmd FileType python compiler pytest
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Command and key mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
command! -nargs=* Set set <args>
command! -nargs=* Q q <args>
command! -nargs=* -complete=file W w <args>
command! -nargs=* -complete=file Wq wq <args>
command! -nargs=* -complete=file WQ wq <args>
command! -nargs=* -complete=file Wa wa <args>
command! -nargs=1 -complete=file E e <args>
command! -nargs=* Tsel tsel <cword>
command! -nargs=* Make make <args> | cwindow 10
" Saner behavior of Y
noremap Y y$
" Make Alt-Enter follow the word under the cursor as tag.
noremap gt g<C-]>
noremap gT g<C-]>
noremap g<C-T> <C-W>g}
noremap gp :psearch <C-R><C-W><CR>
noremap gs :grep "<cword>" *<CR>
noremap g<C-D> [I
noremap <C-W>u <C-W>z
noremap W e
noremap B ge
noremap - <nop>
noremap + <nop>
noremap ö/ [/ " Goto start of comment
noremap ä/ ]/ " Goto end of comment
noremap ö# [# " Goto start of ifdef
noremap ä# ]# " Goto end of ifdef
noremap ö( [( " Goto start of () expression
noremap ä) ]) " Goto end of () expression
noremap ö{ [{ " Goto start of {} block
noremap ä} ]} " Goto end of {} block
" Forward to pymode
map öC [[ " Pymode goto previous class or toplevel function
map äC ][ " Pymode goto previous class or toplevel function
map öM [M " Pymode goto previous method
map äM ]M " Pymode goto previous method
" Accept popup menu with tab, otherwise forward default tab (insert snippet).
" Wanted to try this out when I noticed Scriptmate didn't work any more.
" imap <Tab> <C-R>=pumvisible() ? "\<lt>C-Y>" : "\<lt>C-R>=TriggerSnippet()\<lt>CR>"<CR>
" Function key mappings
"nmap <F1> <Esc>
"imap <F1> <Esc>
noremap <F2> <ESC>:bp!<CR>
noremap <F3> <ESC>:bn!<CR>
noremap <F4> <ESC>:cp!<CR>
noremap <F5> <ESC>:cn!<CR>
noremap <S-F4> <ESC>:lprev<CR>
noremap <S-F5> <ESC>:lnext<CR>
noremap <F9> :Make<CR>
nnoremap <silent> <F10>
\ :if exists('w:long_line_match') <Bar>
\ silent! call matchdelete(w:long_line_match) <Bar>
\ unlet w:long_line_match <Bar>
\ elseif &textwidth > 0 <Bar>
\ let w:long_line_match = matchadd('OverLength', '\%>'.&tw.'v.\+', -1) <Bar>
\ else <Bar>
\ let w:long_line_match = matchadd('OverLength', '\%>80v.\+', -1) <Bar>
\ endif<CR>
inoremap <F10> <Esc><F10>
nnoremap <silent> <F11> :set invlist<CR>
inoremap <silent> <F11> :set invlist<CR>
set pastetoggle=<F12>
noremap J <nop>
noremap K <nop>
" Emacs-style line editing in commandline and insert mode
noremap! <C-A> <Home>
noremap! <C-B> <Left>
noremap! <C-D> <Del>
noremap! <C-E> <End>
noremap! <C-F> <Right>
noremap! <C-G> <Esc>
noremap! <C-f> <Right>
noremap! <C-b> <Left>
" Easy window switching within vim.
noremap <C-J> <C-W>j
noremap <C-K> <C-W>k
noremap <C-H> <C-W>h
noremap <C-L> <C-W>l
" Let <Left> and <Right> still have their original meanings in wildmenu.
cnoremap <Left> <Space><BS><Left>
cnoremap <Right> <Space><BS><Right>
noremap <silent> <A-t> :tab split<CR>
noremap <silent> <A-1> :tabfirst<CR>1gt
noremap <silent> <A-2> :tabfirst<CR>2gt
noremap <silent> <A-3> :tabfirst<CR>3gt
noremap <silent> <A-4> :tabfirst<CR>4gt
noremap <silent> <A-5> :tabfirst<CR>5gt
noremap <silent> <A-6> :tabfirst<CR>6gt
noremap <silent> <A-7> :tabfirst<CR>7gt
noremap <silent> <A-8> :tabfirst<CR>8gt
noremap <silent> <A-9> :tabfirst<CR>9gt
noremap <silent> <A-0> :tabfirst<CR>10gt
inoremap <esc> <nop>
inoremap jk <esc>
":vnoremap <esc> <nop>
"vnoremap jk <esc>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
execute pathogen#infect()
" consider: https://github.com/reinh/vim-makegreen
" https://github.com/tpope/vim-dispatch
let mapleader = "," " set <Leader> to comma.
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
let g:EasyMotion_keys = 'ASDGHKLQWERTYUIOPZXCVBNMFJ,'
let g:EasyMotion_use_upper = 1
"nmap s <Plug>(easymotion-s)
nmap s <Plug>(easymotion-s)
nmap S <Plug>(easymotion-bd-jk)
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ["flake8"]
" Disable for now - use pymode.
let g:syntastic_python_checkers = []
let g:syntastic_python_python_exec = 'py.exe'
let g:syntastic_python_python_args = "-3.4"
let g:syntastic_python_flake8_exec = 'C:\Users\Chris\Downloads\flake8\Scripts\flake8'
let g:ctrlp_map = '<Leader>p'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|\.hg|\.svn|build)$',
\ 'file': '\v\.(obj|pdb|dll|pyc|tlog|log|idb|ilk|exe|lib|pyd|exp|sdf|ncb|lastbuildstate|ipch|suo|png|tif)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:pymode_python = 'python'
let g:pymode_rope = 0
let g:pymode_folding = 0
let g:pymode_options = 0
let g:pymode_doc = 0 " Disable pymode doc in favor of jedi.
let g:pymode_breakpoint_bind = '<Leader>b'
let g:pymode_lint = 1
let g:pymode_lint_on_write = 1
let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe']
let g:pymode_lint_cwindow = 0
let g:jedi#force_py_version = 3
let g:jedi#goto_command = 'gt'
let g:jedi#goto_assignments_command = 'gT'
let g:jedi#documentation_command = '<Leader>d'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment