From f000733bc67b92ff3b97a00ff85d9e8532350fd9 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 8 Jun 2015 12:19:27 +0200 Subject: Cleaned up vimrc --- vim/.vimrc | 59 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 24 deletions(-) (limited to 'vim') diff --git a/vim/.vimrc b/vim/.vimrc index a8c93c5..97f6ee1 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,51 +1,34 @@ execute pathogen#infect() +""" DEFAULT VIM SETTINGS + let mapleader=" " syntax on filetype plugin indent on +" Set colorscheme when the terminal has 256 color support if &t_Co == 256 colorscheme Benokai endif -" On arch linux install the following: -" otf-powerline-symbols-git -" powerline-fonts-git -let g:airline_powerline_fonts = 1 -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif -let g:airline_symbols.space = "\ua0" - -set number +" Some vim settings +set relativenumber set hlsearch set list set modeline -set relativenumber - set background=dark set foldmethod=indent set listchars=trail:·,tab:▸\ ,eol:¬ set scrolloff=1 -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif - -function! AppendModeline() - let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", - \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') - let l:modeline = substitute(&commentstring, "%s", l:modeline, "") - call append(line("$"), l:modeline) -endfunction -nnoremap ml :call AppendModeline() - +" Switch windows with [direction] map j map k map h map l +" Never use the arrow keys noremap "" noremap! noremap "" @@ -55,4 +38,32 @@ noremap! noremap "" noremap! +" Append modeline when pressing ml +function! AppendModeline() + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", + \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') + let l:modeline = substitute(&commentstring, "%s", l:modeline, "") + call append(line("$"), l:modeline) +endfunction +nnoremap ml :call AppendModeline() + +""" PLUGIN SPECIFIC SETTINGS + +" NERDTree: +" Open NERDTree when no file is specified +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + +" Airline: +" On arch linux install the following: +" otf-powerline-symbols-git +" powerline-fonts-git +let g:airline_powerline_fonts = 1 +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif +let g:airline_symbols.space = "\ua0" +set laststatus=2 + " vim: set ts=8 sw=8 tw=78 noet : -- cgit v1.2.3