aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-10-20 00:53:08 +0200
committerDuncaen <mail@duncano.de>2017-10-20 00:53:08 +0200
commit32c8d970af6116134fc3b8a0fef08861cdf4667b (patch)
tree44cd4250f7b37c630872b9d1a0263dbf548a3536
parent771f747aae92149668a0f641520cadc4e2bcd65c (diff)
downloaddotfiles-32c8d970af6116134fc3b8a0fef08861cdf4667b.tar.gz
vim: continue cleaning up settings
-rw-r--r--vimrc116
1 files changed, 51 insertions, 65 deletions
diff --git a/vimrc b/vimrc
index 1ffa4af..ccb7ff1 100644
--- a/vimrc
+++ b/vimrc
@@ -9,7 +9,6 @@ endif
" Navigation
Plug 'ctrlpvim/ctrlp.vim', { 'on': '<plug>(ctrlp)' }
-" Plug 'bling/vim-bufferline'
" Editing
Plug 'tpope/vim-surround'
@@ -22,36 +21,28 @@ endif
" Basic settings
" ============================================================================
-let mapleader = ','
-let maplocalleader = ','
+set autoread " automatically read changed files
-set showcmd " show current command
-set number " show line numbers
-set list " show tabs, whitespaces etc
-set cursorline " highlight current line
-set scrolloff=5 " scroll 5 lines before reaching top/bottom
-sil! set colorcolumn=80 " show line after 80 chars
-set diffopt=filler,vertical " vertical vimdiff
-set ruler " cursor position in status line
-set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
-set laststatus=1 " show the statusline if there are at least two windows
+" syntax
syntax off " no syntax highlighting by default
-sil! colorscheme shblah " default colorscheme
+sil! colorscheme shblah " default colorscheme
let g:is_kornshell = 1 " ksh syntax by default
-set visualbell
-
+" interface
+set cursorline " highlight current line
+sil! set colorcolumn=80 " show line after 80 chars
+set list " show tabs, whitespaces etc
+set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
+set vb t_vb= " disable beep
set timeoutlen=500 " time to wait for key code, mapped key sequence
-set history=1000 " store a ton of history (default is 20)
+" search
set incsearch " match search while typing
set hlsearch " hightligt search results
set smartcase " search casesensitive if pattern contains uppercase chars
-set ignorecase "
-
-set autoread " automatically read changed files
-set backspace=indent,eol,start
+set ignorecase " overwritten by smartcase if it contains uppercase chars
+" compelete
set complete-=i
set completeopt=longest,menuone
@@ -63,20 +54,52 @@ set undodir=~/.vim/undo//
set backupdir=~/.vim/backup//
set directory=~/.vim/swp//
+" histroy/undo
+set history=1000 " store a ton of history (default is 20)
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
-set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
" Formating
+set backspace=indent,eol,start
filetype plugin indent on
set autoindent
-set tabstop=8
-set shiftwidth=8
set smartindent
set smarttab
set foldlevelstart=99
-set foldmethod=indent
-set textwidth=0 " dont wrap text automatically
+
+" ============================================================================
+" MAPPINGS
+" ============================================================================
+
+let mapleader = ','
+let maplocalleader = ','
+
+" w!! to write with doas/sudo
+if executable('doas')
+ cmap w!! w !doas tee % >/dev/null
+else
+ cmap w!! w !sudo tee % >/dev/null
+endif
+
+command! W w " too often i type W instead of w
+nnoremap Y y$ " Make Y behave like other capitals
+nnoremap Q @q " qq to record, Q to replay
+
+" Reselect visual block after indent/outdent
+vnoremap < <gv
+vnoremap > >gv
+vnoremap = =gv
+
+" ,s - reload vim rc
+nmap <leader>s :source $MYVIMRC<cr>
+
+" ,c - toggle comment
+nmap <leader>c <plug>Commentary
+vmap <leader>c <plug>Commentary
+
+" ctrlp plugin on-demand loading
+map <c-p> <plug>(ctrlp)
+let g:ctrlp_map = ''
" ----------------------------------------------------------------------------
" co? : Toggle options (inspired by unimpaired.vim) from: https://github.com/junegunn/dotfiles
@@ -84,9 +107,10 @@ set textwidth=0 " dont wrap text automatically
fu! s:map_change_option(...)
let [key, opt] = a:000[0:1]
let op = get(a:, 3, 'set '.opt.'!')
- execute printf("nnoremap co%s :%s<BAR>echo '%s: '. &%s<CR>", key, op, opt, opt)
+ execute printf("nnoremap <silent> co%s :%s<bar>echo '%s: '. &%s<cr>", key, op, opt, opt)
endf
+call s:map_change_option('c', 'spell', 'setlocal spell!')
call s:map_change_option('n', 'number', 'setlocal number!')
call s:map_change_option('h', 'hlsearch', 'setlocal hlsearch!')
call s:map_change_option('l', 'list', 'setlocal list!')
@@ -98,46 +122,8 @@ call s:map_change_option('t', 'textwidth',
call s:map_change_option('w', 'wrap', 'setlocal wrap!')
" ============================================================================
-" ctrlp
-" ============================================================================
-
-map <c-p> <plug>(ctrlp)
-let g:ctrlp_map = ''
-let g:ctrlp_custom_ignore = {
- \ 'dir': '\v[\/]\.(git|hg|svn)$',
- \ 'file': '\.pyc$\|\.pyo$\|\.rbc$|\.rbo$\|\.class$\|\.o$\|\~$\',
-\ }
-
-" ============================================================================
" FILETYPES
" ============================================================================
" void-packages template file
autocmd BufNewFile,BufRead template set ft=sh sts=0 sw=0 noet
-
-" ============================================================================
-" MAPPINGS
-" ============================================================================
-
-" w!! to write with doas/sudo
-if executable('doas')
- cmap w!! w !doas tee % >/dev/null
-else
- cmap w!! w !sudo tee % >/dev/null
-endif
-
-command! W w " too often i type W instead of w
-nnoremap Y y$ " Make Y behave like other capitals
-nnoremap Q @q " qq to record, Q to replay
-
-" Reselect visual block after indent/outdent
-vnoremap < <gv
-vnoremap > >gv
-vnoremap = =gv
-
-" ,s - reload vim rc
-nmap <Leader>s :source $MYVIMRC<cr>
-
-" ,c - toggle comment
-nmap <Leader>c <Plug>Commentary
-vmap <Leader>c <Plug>Commentary