summaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc89
1 files changed, 89 insertions, 0 deletions
diff --git a/vim/vimrc b/vim/vimrc
new file mode 100644
index 0000000..e9afda3
--- /dev/null
+++ b/vim/vimrc
@@ -0,0 +1,89 @@
+" general options
+set nocompatible
+set background=dark
+set showcmd
+set showmatch
+set smartcase
+set incsearch
+set autowrite
+
+syntax on
+filetype plugin indent on
+
+" TODO: reconsider this, possible risk
+set modeline
+set wrapmargin=4
+set linebreak
+set ruler
+set cryptmethod=blowfish
+set foldmethod=syntax
+set scrolloff=3
+set wildmenu
+set hlsearch
+set conceallevel=2
+set ttyfast
+set undofile
+set nojoinspaces
+
+" tabs handling
+set expandtab
+set shiftwidth=4
+set tabstop=4
+
+" mouse
+set mouse=a
+set ttymouse=sgr
+
+" trailing whitespace highlighting
+highlight WhiteSpaceEOL ctermbg=darkgreen
+match WhiteSpaceEOL /\s\+$/
+
+" put all the vim files under ~/.vim to avoid polluting the rest of the
+" filesystem with them
+set dir=~/.cache/vim/swap
+set backupdir=~/.cache/vim/bkp
+set undodir=~/.vim/undo
+set viminfo="n~/.vim/viminfo"
+
+if &t_Co < 88
+ colorscheme default
+else
+ let g:inkpot_black_background = 1
+ colorscheme inkpot
+endif
+
+" extension-based filetypes
+let filetype_m="mma"
+let filetype_par="config"
+
+".tex files default to latex
+let g:tex_flavor='latex'
+
+" enable syntax folding in viml files
+let g:vimsyn_folding = 'af'
+
+" autodisable syntax folding for c files (it's slow)
+autocmd BufEnter *.c,*.h setlocal foldmethod=manual
+" C indent options
+set cinoptions=(0
+
+""" key mappings
+map zJ zjzo
+" the default mapping enters the ex mode, which is very annoying since it's
+" easy to trigger by mistake (going for ZQ, missing Z)
+map Q <Nop>
+nmap gb :bnext<CR>
+nmap gB :bprevious<CR>
+map <leader>m :make<CR>
+
+" line diff mode
+" TODO: split off into plugin?
+function LineDiff()
+ silent execute "!linediff " . v:fname_in . " " . v:fname_new . " > " . v:fname_out
+endfunction
+
+function SetLineDiff()
+ set diffexpr=LineDiff()
+ diffupdate
+ redraw
+endfunction