Skip to content

Instantly share code, notes, and snippets.

@aejh
Last active December 11, 2015 15:08
Show Gist options
  • Save aejh/4618962 to your computer and use it in GitHub Desktop.
Save aejh/4618962 to your computer and use it in GitHub Desktop.
vimrc file, with specific customisations for editing python and makefiles.
set tabstop=4
set shiftwidth=4
set softtabstop=4
set hlsearch
set ai
set expandtab
set ruler
autocmd Filetype python match Todo '\%>79v.\+'
autocmd FileType make setlocal noexpandtab
"match Todo /\s\+$/
"match Todo '\%>79v.\+'
"This will vertically center a search result
"set scrolloff=999
"highlight SpellBad cterm=underline ctermbg=bg ctermfg=Red gui=undercurl guisp=Red
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
"For a full list: ls /usr/share/vim/vim72/colors
"or cycle and test them with :colorscheme <tab>
colorscheme delek
au BufNewFile,BufRead *.mxml set filetype=mxml
au BufNewFile,BufRead *.as set filetype=actionscript
"au BufWinLeave * mkview
"au BufWinEnter * silent loadview
"Enable folds
"set foldmethod=syntax
"set foldcolumn=3
"Set F9 to toggle code folds
"inoremap <F9> <C-O>za
"nnoremap <F9> za
"onoremap <F9> <C-C>za
"vnoremap <F9> zf
"Set F10 to open all folds within current block
"noremap <F10> zO
"Set F11/12 to open/close all folds
"nnoremap <F11> zR
"nnoremap <F12> zM
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
"Toggle settings
function ShowCustomMatch()
match Todo /\s\+$/
autocmd Filetype python match Todo '\%>79v.\+'
set hlsearch
endfunction
function HideCustomMatch()
match none
set hls!
endfunction
map <silent> <F7> :call ShowCustomMatch()<CR>
map <silent> <F8> :call HideCustomMatch()<CR>
map <F9> :set ai!<bar>set ai?<CR>
map <F10> :set hls!<bar>set hls?<CR>
map <F11> :set list!<bar>set list?<CR>
noremap <F12> :set invpaste paste?<CR>
map U :redo<CR>
"Autoindent for python files
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
"let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
"if &term == "screen"
" set t_ts=
" set t_fs=
"endif
"if &term == "screen" || &term == "xterm"
" set title
"endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment