Skip to content

Instantly share code, notes, and snippets.

@skriticos
Created July 10, 2009 19:43
Show Gist options
  • Save skriticos/144742 to your computer and use it in GitHub Desktop.
Save skriticos/144742 to your computer and use it in GitHub Desktop.
config
" Seth Kriticos' vimrc file
" Last update: 2010-03-19
" Note - This configuration is for cterm mode (color terminal)
" Never got around liking the GUI version
" (problematic command line integration)
" For GUI use, the highlight commands should be adjusted
" Editor behaviour
set nocompatible
set autoread
" File/Buffer preferences
set tabstop=4
set shiftwidth=4
set expandtab
set textwidth=80
set linebreak
set smartindent
" Editor display preferences
set laststatus=2
set statusline=%t\ %y\ format:\ %{&ff};\ [%c,%l]
set novisualbell
syntax on
set number
" Editor interaction behaviour
set incsearch
set backspace=start,indent,eol
" Set spelling highlight options to something that does not
" burn the eye
highlight clear SpellBad
highlight SpellBad ctermfg=1 cterm=underline
highlight clear SpellCap
highlight SpellCap cterm=underline
highlight clear SpellRare
highlight SpellRare cterm=underline
highlight clear SpellLocal
highlight SpellLocal cterm=underline
" Fold highlight style (same reason as spelling)
highlight clear Folded
highlight Folded ctermfg=cyan guifg=cyan
" ---------- KEY BINDINGS ----------
" Spell checking shortcuts (ctrl+[sS] to switch it on/off)
map ,s :set spell<CR> :setlocal spell spelllang=en_us<CR>
\ :set spellfile=~/.vim/spellfile.{encoding}.add<CR>
map ,S :set nospell<CR>
" Add save all and exit shortcut to ctrl+d
nmap <C-d> <esc>:xa<CR>
" Edit / reload vimrc
map ,v :tabe ~/.vimrc<CR>
map <silent> ,V :source ~/.vimrc<CR>:filetype detect<CR>
\ :exe ":echo 'vimrc reloaded'"<CR>
" Suppress all spaces at end/beginning of lines
nmap ,c :%s/\s\+$//<CR>
nmap ,C :%s/^\s\+//<CR>
nmap <F9> :loadview<CR>
nmap <F6> :w<CR>:!clear<CR>:!python ../xtests.py<CR>
" Add current buffer save and python execution to F2 and F5
au filetype python nmap <F2> <esc>:w<CR>:!python %<CR>
au filetype python nmap <F5> <esc>:w<CR>:!python %
nmap <F9> :!clear<CR>:wa<CR>:!/home/seth/netar-src/xtests.py<CR>
nmap <F10> :!clear<CR>:wa<CR>:!/home/seth/netar-src/xtests.py -full<CR>
" ------------ AUTO COMPLETITION -----------
" Automatically add closing braces
""au filetype c,cpp,php,javascript,python inoremap [ []<Left>
""au filetype c,cpp,php,javascript,python inoremap { {}<Esc>O
""au filetype c,cpp,php,javascript,python
"" \ inoremap {<CR> {<CR>}<Esc>O
""au filetype c,cpp,php,javascript,python inoremap ( ()<Left>
""au filetype c,cpp,php,javascript,python inoremap " ""<Left>
""au filetype c,cpp,php,javascript,python inoremap ' ''<Left>
" Set execution bit for scripts on saving
au bufwritepost *.sh silent !chmod +x %
" If we edit makefiles, make sure that tabs are not replaced
" with spaces
au filetype make setlocal noexpandtab
" Remember fold views on close and load them on open
au BufWinLeave * mkview
# Turn off console beep.
echo -ne '\033[11;0]'
xset -b
# Switch to vi like command editing
set -o vi
# Prompt looks
PS1='\[\e[36m\]$(date +%d\ %b\ %H:%M) \u@\h:\w\n%\[\e[33m\] '
EDITOR='vim'
alias cursor="cd ~/p/netar-src; ctags -R; ./ntests.py;"
# Clear screen
clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment