vim: add a lot of config

This commit is contained in:
Thomas Preisner 2016-11-12 00:33:39 +01:00
parent 6241e95096
commit c468ace9e3

128
vimrc
View file

@ -1,40 +1,114 @@
" .vimrc " .vimrc
" Visual " only vim and not vi
syntax enable set nocompatible
colorscheme ron " disable autocmd
set background=dark set secure
" use utf8 only
set encoding=utf8 set encoding=utf8
set number
set cursorline
highlight CursorLine term=bold cterm=bold " file/directory matching
set wildmode=list:longest,full
" ignore case when completing
if exists('+wildignorecase')
set wildignorecase
endif
" ignorelist
set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc
"set list " show completion menu even with only one match
"set listchars=tab:<- if exists('+completeopt')
set completeopt+=menuone
endif
" Tabs " increase command history
set smarttab set history=1000
" increase count of possible undos
set undolevels=1000
" encrypt buffers when saved to files
if exists('+cryptmethod')
set cryptmethod=blowfish
endif
" enable fast terminal for tmux but not for ssh connection
if &term =~# '^screen' && !exists('SSH_CONNECTION')
set ttyfast
endif
" enable automatic file detection, plugin and indention support
if has('autocmd')
filetype off "for pathogen
filetype plugin indent on
endif
" use utf8 encoding for all files and recognize latin1
set fileencodings=utf-8,latin1
" use unix line-endings and recognize dos endings
set fileformats=unix,dos
" tabs
set tabstop=4 set tabstop=4
set shiftwidth=4 set shiftwidth=4
set ai set autoindent
set si set smartindent
set smarttab
" Searching " allow backspacing over autoindent and line breaks
set hlsearch set backspace=indent,eol
set showmatch
" already display matches while searching
set incsearch set incsearch
" only check for case if the searched word contains a capital
set ignorecase
set smartcase
" highlight all matches. use <C-L> to remove the highlights
set hlsearch
" Splitting " syntax folding
set splitbelow if has('folding')
set foldmethod=syntax
" only use folding when there is enough space
" if &columns > 80
" set foldcolumn=2
" endif
set foldlevel=99
" dont open fold for block movements
set foldopen-=block
endif
" allow buffers with changes to be hidden
set hidden
" correct splitting
if has('vertsplit')
set splitright set splitright
set splitbelow
endif
" KeyRemapping " Visual
nnoremap <C-J> <C-W><C-J> " set text color for dark terminal background
nnoremap <C-K> <C-W><C-K> set background=dark
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H> " activate syntax highlighting
if has('syntax')
syntax enable
endif
" set colorscheme
colorscheme ron
" display line at which the current is positioned
if exists('+cursorline')
set cursorline
" remove line and make the line bold instead
highlight CursorLine term=bold cterm=bold
endif
" display line numbers
set number
" Disable arrow keys " Disable arrow keys
map <Right> <Nop> map <Right> <Nop>
@ -47,6 +121,12 @@ map! <Left> <Nop>
map! <Up> <Nop> map! <Up> <Nop>
map! <Down> <Nop> map! <Down> <Nop>
" allow easier pane switching
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Misc " Misc
set mouse=n set mouse=n
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm