Created
January 20, 2016 15:27
-
-
Save koirikivi/4f9f98c113dda39c4708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
set wildignore=.venv,venv,node_modules | |
" Simplified stuff | |
nmap ,x :!python %<cr> | |
" Based on http://www.derekwyatt.org/vim/the-vimrc-file/the-absolute-bare-minimum | |
" Forget being compatible with good ol' vi | |
set nocompatible | |
" FU BELL | |
set visualbell | |
set t_vb= | |
nmap { gT | |
nmap } gt | |
if has("multi_byte") | |
if &termencoding == "" | |
let &termencoding = &encoding | |
endif | |
set encoding=utf-8 " better default than latin1 | |
setglobal fileencoding=utf-8 " change default file encoding when writing new files | |
endif | |
" Case insensitive searches | |
set ignorecase | |
" ...but not when search pattern contains uppercase characters | |
set smartcase | |
"set hlsearch | |
" remember a couple of commands more | |
set history=500 | |
" No sql maps | |
let g:omni_sql_no_default_maps = 1 | |
" Tags in .ctags | |
set tags=./.ctags,.ctags,../.ctags | |
set expandtab | |
set tabstop=4 | |
set shiftwidth=4 | |
set autoindent | |
" Get that filetype stuff happening | |
filetype on | |
filetype plugin on | |
filetype indent on | |
" Turn on that syntax highlighting | |
syntax on | |
" PEP8: Maximum 79 characters per line for python | |
autocmd FileType python set textwidth=79 | |
autocmd FileType html set textwidth=0 | |
autocmd FileType html set syntax=htmldjango | |
"autocmd FileType * nmap <silent> <leader>x :!./%<cr> | |
autocmd FileType c nmap <leader>x :!gcc -Wall -Wextra --pedantic % && ./a.out<cr> | |
autocmd FileType javascript nmap <leader>x :!node %<cr> | |
autocmd FileType javascript nmap <leader>h :!jshint %<cr> | |
autocmd FileType python nmap <leader>h <leader>lint<cr> | |
" Numbarz | |
set number | |
" Comment color more readable | |
" hi Comment ctermfg=darkgray | |
colorscheme desert | |
" Why is this not a default | |
set hidden | |
" Don't update the display while executing macros | |
set lazyredraw | |
" At least let yourself know what mode you're in | |
set showmode | |
" Enable enhanced command-line completion. Presumes you have compiled | |
" with +wildmenu. See :help 'wildmenu' | |
set wildmenu | |
" Map shift-tab to unindent (insert mode) | |
imap <S-Tab> <ESC><<i | |
" F8 removes unwanted whitespace | |
nnoremap <silent> <F8> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR> | |
" Hilight extra whitespace | |
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen | |
match ExtraWhitespace /\s\+\%#\@<!$/ | |
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
au InsertLeave * match ExtraWhitespace /\s\+$/ | |
" Custom leader commands | |
let mapleader = "," | |
" Teemun tabihöskä | |
nmap <leader>t :tabe %:p:h/ | |
" Sama mutta bufferille | |
nmap <leader>e :e %:p:h/ | |
" Ja windowille | |
nmap <leader>w :new %:p:h/ | |
" Ylemmät globeille | |
nmap <leader>gt :tabe **/ | |
nmap <leader>ge :e **/ | |
nmap <leader>gw :new **/ | |
" Nerdtree localille | |
nmap <silent> <leader>nd :NERDTree %:p:h<cr> | |
" Scrolling through buffers? | |
nmap <leader>b :b <c-i> | |
" python debugger -- now with IPDB! | |
nmap <silent> <leader>pdb oimport ipdb; ipdb.set_trace()<esc> | |
" lame django tempate python debugger | |
nmap <silent> <leader>ddb o{% load debug_tags %}{% pdb_context %}<esc> | |
" Let's make it easy to edit this file (mnemonic for the key sequence is | |
" 'm'odify 'v'imrc) | |
nmap <silent> <leader>mv :tabe $MYVIMRC<cr> | |
" And to source this file as well (mnemonic for the key sequence is | |
" 's'ource 'v'imrc) | |
nmap <silent> <leader>sv :so $MYVIMRC<cr> | |
func! DeleteLintTmpBufferIfExists() | |
if bufloaded("/tmp/vimlint") | |
bdelete /tmp/vimlint | |
endif | |
endfunction | |
" With lint: | |
nmap <silent> <leader>lint :call DeleteLintTmpBufferIfExists()<cr>:!echo -e "PEP8:" > /tmp/vimlint<cr>:!pep8 % >> /tmp/vimlint<cr>:!echo -e "\nPyFlakes:" >> /tmp/vimlint<cr>:!pyflakes % >> /tmp/vimlint<cr>:!echo -e "\nPyLint:" >> /tmp/vimlint<cr>:!pylint % -r n -i y >> /tmp/vimlint<cr>:tabe /tmp/vimlint<cr> | |
" Without lint: | |
nmap <silent> <leader>fl :call DeleteLintTmpBufferIfExists()<cr>:!echo -e "PEP8:" > /tmp/vimlint<cr>:!pep8 % >> /tmp/vimlint<cr>:!echo -e "\nPyFlakes:" >> /tmp/vimlint<cr>:!pyflakes % >> /tmp/vimlint<cr>:tabe /tmp/vimlint<cr> | |
" Python eval | |
" TODO: change the binding | |
"nmap <silent> <C-p> :!python %<cr> | |
" Try to remove ugly flashes on <cr> from supertab | |
" Incidentally also removes completion by <cr> | |
let g:SuperTabCrMapping = 0 | |
" Should be compiled with python support on | |
"let g:SuperTabDefaultCompletionType = "context" | |
" Clear last search | |
nnoremap <silent> <leader>c :let @/ = ""<cr> | |
command! Spacestotabs s/ /<Tab>/g | |
" Easier up/down moving and scrolling | |
map § 4j | |
map ± 4k | |
if filereadable("~/.localvimrc") | |
source ~/.localvimrc | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment