Skip to content

Instantly share code, notes, and snippets.

@OskarSigvardsson
Created April 8, 2015 10:47
Show Gist options
  • Save OskarSigvardsson/ea6a349ea56f59bf5134 to your computer and use it in GitHub Desktop.
Save OskarSigvardsson/ea6a349ea56f59bf5134 to your computer and use it in GitHub Desktop.
autocmd!
"Start pathogen
execute pathogen#infect()
"Recognize filetypes and indentation
filetype indent on
"Turn on syntax highlighting
syntax on
"Show line numbers on the left (absolutely essential)
set number
"Automatically saves on certain actions
set autowrite
"Tab settings
set shiftwidth=4
set expandtab
set tabstop=4
set smartindent
"Highlight searching
set hls is
"GUI specific options
if has('gui_running')
"Use Solarized for GUI
set background=dark
colorscheme solarized
"Use Source Code Pro as the font (specifically, the Powerline version)
set guifont=Source\ Code\ Pro\ for\ Powerline:h12
"Remove scrollbars. For crazy people
set guioptions-=r
set guioptions-=R
set guioptions-=l
set guioptions-=L
set guioptions-=b
endif
"Change the background color of the line numbers
hi LineNr cterm=NONE ctermfg=darkyellow guibg=NONE
"Ruler
set ruler
"Nicer matchparen (disabled)
"hi MatchParen ctermbg=gray guibg=NONE
"Status line (disabled, using powerline instead)
"set statusline=%F%m%r\ %y\ [%l,%c][%p%%]
"Use powerline status line plugin
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
"Good powerline options
set guioptions-=e
set laststatus=2
set showtabline=2
set noshowmode
"Highlight current line
set cul
"Nicer menu (disabled)
"hi Pmenu ctermfg=4 ctermbg=7
"hi PmenuSel cterm=bold ctermfg=5 ctermbg=7
"Set swp file directory to prevent .swp files from polluting the filesystem
set backupdir=$HOME/.vimfiles/
set directory=$HOME/.vimfiles/
"Use space to open and close folds (disabled)
"map <space> za
"Remove highlighting with backspace
nmap <bs> :noh <CR>
"Esc twice saves buffer in normal mode
nmap <Esc><Esc> :w<CR>
"Enter moves a line down in normal mode
nmap <CR> O<C-c>j
"Use Prolog syntax highlighting for .pl files (otherwise it thinks it's Perl)
au BufNewFile,BufRead *.pl set filetype=prolog
"Turn off expandtabs for makefiles (makefiles need \t tabs, not spaces)
au BufNewFile,BufRead makefile set noexpandtab
"Always show at a few lines above and below cursor when scrolling
set scrolloff=5
"Move text using Alt+[JK]
nmap √ mz:m+<cr>`z
nmap ª mz:m-2<cr>`z
vmap √ :m'>+<cr>`<my`>mzgv`yo`z
vmap ª :m'<-2<cr>`>my`<mzgv`yo`z
"Use jk to exit insertion mode
inoremap jk <C-c>
"Disable <Esc> in insertion mode to force myself to learn! (disabled)
"inoremap <Esc> <nop>
"Disable arrow-keys in all modes, for crazy people only
"(some keys rebound later)
nmap <Up> <nop>
imap <Up> <nop>
vmap <Up> <nop>
nmap <Down> <nop>
imap <Down> <nop>
vmap <Down> <nop>
nmap <Left> <nop>
imap <Left> <nop>
vmap <Left> <nop>
nmap <Right> <nop>
imap <Right> <nop>
vmap <Right> <nop>
"Use left/right arrow keys to move between vertically split windows
map <Left> <C-w>h
map <Right> <C-w>l
imap <Left> <Esc><C-w>hi
imap <Right> <Esc><C-w>li
"Use up/down to move between split windows
map <Up> <C-W>k
map <Down> <C-W>j
imap <Up> <Esc><C-w>ki
imap <Down> <Esc><C-w>ji
"Use shift-left/right to move between tabs
map <S-Left> gT
map <S-Right> gt
imap <S-Left> <Esc>gT
imap <S-Right> <Esc>gt
"Highligt character in position 81 to warn about long lines
hi OverLength guibg=gray
au BufNew,BufNewFile,BufRead * match OverLength /\%81c/
"Proper python indents on all important keywords
au FileType python setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class
"Use ä and ö to move through location list generated by Syntastic
nmap ä :lnext<CR>
nmap ö :lprev<CR>
"Syntastic settings
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['jshint']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment