diff options
Diffstat (limited to 'init.vim')
| -rwxr-xr-x | init.vim | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/init.vim b/init.vim new file mode 100755 index 0000000..bd5ad71 --- /dev/null +++ b/init.vim @@ -0,0 +1,151 @@ +" Return to last edit position when opening files (You want this!) +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + +if expand('%:t') =~ '*ms' + set filetype=nroff +endif + +" Enable filetype plugins +filetype plugin on +filetype indent on + +" Set to auto read when a file is changed from the outside +set autoread +au FocusGained,BufEnter * checktime + + +"Always show current position +set ruler + +" Height of the command bar +set cmdheight=1 + +" Enable mouse + +set mouse=nv + +" Configure backspace so it acts as it should act +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Ignore case when searching +set ignorecase + +" When searching try to be smart about cases +set smartcase + +" Highlight search results +set hlsearch + +" Makes search act like search in modern browsers +set incsearch + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" For regular expressions turn magic on +set magic + +" Show matching brackets when text indicator is over them +set showmatch +" How many tenths of a second to blink when matching brackets +set mat=2 + + +" Enable syntax highlighting +syntax enable + + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set ffs=unix,dos,mac + + +" Turn backup off, since most stuff is in SVN, git etc. anyway... +set nobackup +set nowb +set noswapfile + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Text, tab and indent related +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Use spaces instead of tabs +set expandtab + +" Be smart when using tabs ;) +set smarttab + +" 1 tab == 4 spaces +set shiftwidth=4 +set tabstop=4 + +" Linebreak on 75 characters +set lbr +set tw=75 + +" linebreak at 70 characters in a tex file of ms file +" +autocmd FileType plaintex set filetype=tex + +autocmd FileType tex set textwidth=70 +autocmd FileType nroff set textwidth=70 +autocmd FileType markdown set textwidth=70 + +au BufRead /tmp/mutt-* set textwidth=70 +au BufRead /tmp/mutt-* set formatoptions+=a + + +"if expand('%:t') == 'paper.tex' +" set formatoptions+=a +" set textwidth=70 +" set filetype=tex +" autocmd BufWritePost * silent! execute "!./compile.sh&" +"endif + +if expand('%:t') == 'paper.md' || expand('%:t') == 'paper.ms' + "set fo+=a + "autocmd BufWritePost * silent! execute "!./compile.sh&" +endif + + +map <leader>q :wqa<cr> +map <leader>m :w\|!make<cr> +map <leader>n :w\|!make > /dev/null&<cr> +map <leader>r :w\|!make read<cr> + +set ai "Auto indent +set si "Smart indent +set wrap "Wrap lines +set spelllang=en_gb + +" Disable highlight when <leader><cr> is pressed +map <silent> <leader><cr> :noh<cr> + +" Remap VIM 0 to first non-blank character +" map 0 ^ + +map <leader>ss :setlocal spell!<cr> +map <leader>nn :set relativenumber! number!<cr> + +autocmd FileType bib map <buffer> <leader>ar A<cr>@article{,<cr>title = "",<cr>author = "",<cr>year = "",<cr>journal = "",<cr>url = ""<cr>}<cr><Esc>kkkkkkkwwa +autocmd FileType bib map <buffer> <leader>mi A<cr>@misc{,<cr>title = {{}},<cr>author = "",<cr>year = "",<cr>note = "\url{}"<cr>}<cr><Esc>kkkkkkwwa + +autocmd FileType tex map <buffer> <leader>it a\textit{}<Esc>i +autocmd FileType tex map <buffer> <leader>bf a\textbf{}<Esc>i + +" marker at 70th character +set colorcolumn=71 + +set relativenumber +set number + +set cursorline +set modeline + +colorscheme vim |
