1
0

core config cleanup

This commit is contained in:
valeth 2015-06-19 03:32:25 +02:00
parent 0febddb3dd
commit 0945cef703
35 changed files with 245 additions and 196 deletions

View File

@ -1,3 +0,0 @@
" disable visualbell
set visualbell
set t_vb=

42
core/buffer.vim Normal file
View File

@ -0,0 +1,42 @@
set autowrite
set autoread
command! Wq wq
command! WQ wq
command! Q q
command! W w
" set the history far higher (default 50)
if &history < 1000
set history=1000
endif
nnoremap U :redo<CR>
nnoremap <C-R> <NOP>
if v:version >= 704
set undofile
set undolevels=1000
endif
" write swap file to disk after n millisecs
set updatetime=1500
set switchbuf=useopen,usetab
" more clipboard options
set clipboard=unnamed,unnamedplus,autoselect
" allow explicit writing of read-only files with sudo
cnoremap sudow w !sudo tee % >/dev/null
aug ReadonlyFiles
au BufNewFile,BufRead /var/log/* set readonly
au BufNewFile,BufRead /var/log/* set nomodifiable
aug END
if v:version >= 704
set cryptmethod=blowfish
au BufReadPost * if &key != "" | set noswapfile nowritebackup viminfo= nobackup noshelltemp history=0 secure | endif
endif

View File

@ -1 +0,0 @@
set clipboard=unnamed,unnamedplus,autoselect

View File

@ -1,5 +0,0 @@
" show a ruler and show the current command in the bottom right
if has('cmdline_info')
set ruler
set showcmd
endif

39
core/control.vim Normal file
View File

@ -0,0 +1,39 @@
nnoremap Y y$
nnoremap j gj
nnoremap k gk
inoremap jk <ESC>
inoremap JK <ESC>
inoremap Jk <ESC>
set ttimeout
set timeoutlen=500
nnoremap <F1> <NOP>
inoremap <F1> <NOP>
let g:mapleader = ","
noremap <silent> <Leader><CR> :noh<CR>
nnoremap <Leader>vl :setlocal cursorline!<CR>
nnoremap <Leader>vc :setlocal cursorcolumn!<CR>
nnoremap <Leader>ve :setlocal colorcolumn=80<CR>
nnoremap <Leader>vn :setlocal colorcolumn=0<CR>
" enable mouse support
if has('mouse')
set mouse=a
endif
" some useful backspace settings
set backspace=indent,eol,start
" change the current directory to the one containing the current file
if has('autochdir')
set autochdir
endif
" octal is not really that important
set nrformats-=octal
set confirm

View File

@ -1,5 +0,0 @@
aug CursorLineColumn
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn
au WinLeave * setlocal nocursorline nocursorcolumn
aug END

View File

@ -1,4 +0,0 @@
if has('multi_byte')
set encoding=utf-8
set termencoding=utf-8
endif

View File

@ -1,6 +0,0 @@
imap jk <ESC>
imap JK <ESC>
imap Jk <ESC>
set ttimeout
set timeoutlen=500

View File

@ -1,36 +1,34 @@
if has("folding")
set foldcolumn=1
set foldlevel=1
set foldmethod=syntax
set foldtext=MyFoldText()
if has('folding')
set foldcolumn=1
set foldlevel=1
set foldmethod=syntax
set foldtext=MyFoldText()
let g:sh_fold_enabled=1
let g:sh_fold_enabled=1
function! MyFoldText()
" get actual numberwidth of the current document
let nw_add = (len(line('$')) - (&numberwidth - 1))
if nw_add > 0
let nw = &numberwidth + nw_add
else
let nw = &numberwidth
endif
function! MyFoldText()
" get actual numberwidth of the current document
let nw_add = (len(line('$')) - (&numberwidth - 1))
if nw_add > 0
let nw = &numberwidth + nw_add
else
let nw = &numberwidth
endif
let numfold_w =(nw * &number) + &foldcolumn
let window_w = winwidth(0) - numfold_w
let numfold_w =(nw * &number) + &foldcolumn
let window_w = winwidth(0) - numfold_w
let onetab = strpart(' ', 0, &tabstop)
let foldtxt_start = getline(v:foldstart)
let foldtxt_start_w = len(foldtxt_start)
let foldtxt_start = getline(v:foldstart) . ' …'
let foldtxt_start = substitute(foldtxt_start, '\t', onetab, 'g')
let foldtxt_start_w = len(foldtxt_start) - 2
let foldtxt_end = "+" . string(foldclosedend(v:foldend) - foldclosed(v:foldstart)) . "  "
let foldtxt_end_w = len(foldtxt_end)
let foldtxt_end = '+' . string(foldclosedend(v:foldend) - foldclosed(v:foldstart)) . '  '
let foldtxt_end_w = len(foldtxt_end)
let foldtxt_mid_w = window_w - (foldtxt_start_w + foldtxt_end_w)
let foldtxt_mid = repeat(" ", foldtxt_mid_w + 2)
let foldtxt_mid_w = window_w - (foldtxt_start_w + foldtxt_end_w)
let foldtxt_mid = repeat(' ', foldtxt_mid_w + 2)
""let onetab = strpart(" ", 0, &tabstop)
"let foldtext_start = getline(v:foldstart) . " …"
"let foldtext_start = substitute(foldtext_start, "\t", onetab, "g")
return foldtxt_start . foldtxt_mid . foldtxt_end
endfunction
return foldtxt_start . foldtxt_mid . foldtxt_end
endfunction
endif

26
core/formatting.vim Normal file
View File

@ -0,0 +1,26 @@
set autoindent
set smarttab
" round the indent to a multiple o shiftwidth
set shiftround
if has("smartindent")
set smartindent
endif
" enable filetype plugins
if has('autocmd')
filetype indent on
filetype plugin on
endif
vnoremap < <gv
vnoremap > >gv
" fix indentation of an entire file
nnoremap <F2> gg=G<CR>``
inoremap <F2> <ESC>gg=G<CR>``a
" local replace
nnoremap gr gd[{V%::s/<C-R>///g<left><left>
nnoremap gR gD:%s/<C-R>///g<left><left>

View File

@ -1,2 +0,0 @@
nnoremap <F1> <NOP>
inoremap <F1> <NOP>

View File

@ -1,4 +0,0 @@
" set the history far higher (default 50)
if &history < 1000
set history=1000
endif

View File

@ -1,2 +0,0 @@
vnoremap < <gv
vnoremap > >gv

View File

@ -1,5 +0,0 @@
set listchars=tab:»\ ,trail:◆,extends:▹,precedes:◃,eol:↲,nbsp
nnoremap <silent> <F4> :set invlist<CR>
inoremap <silent> <F4> <C-O>:set invlist<CR>
vnoremap <silent> <F4> :<C-W>set invlist<CR>

View File

@ -1,7 +0,0 @@
let g:mapleader = ","
noremap <silent> <Leader><CR> :noh<CR>
nnoremap <Leader>vl :setlocal cursorline!<CR>
nnoremap <Leader>vc :setlocal cursorcolumn!<CR>
nnoremap <Leader>ve :setlocal colorcolumn=80<CR>
nnoremap <Leader>vn :setlocal colorcolumn=0<CR>

View File

@ -1,9 +0,0 @@
set number
if v:version >= 704
aug LineNumbers
au!
au VimEnter,WinEnter,InsertLeave * setlocal relativenumber
au WinLeave,InsertEnter * setlocal norelativenumber
aug END
endif

View File

@ -1,5 +0,0 @@
if has('linebreak')
let &showbreak = '↳ '
set breakindent
set breakindentopt=sbr
endif

View File

@ -1,32 +0,0 @@
set backspace=indent,eol,start
set complete-=i
set nrformats-=octal
set shiftround
set display+=lastline
set showmatch
set shortmess=aoOtTI
set autochdir
set report=0
set updatetime=1500
set switchbuf=useopen,usetab
set pumheight=10
set diffopt+=context:3
set matchtime=2
" set the terminal colors to 256 if not in a VT
if exists($TERM)
if &t_Co == 8 && $TERM !~# '^linux'
set t_Co=256
endif
endif
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
" load the matchit macros
if !exists('g:loaded_matchit') && findfile('plugins/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif

View File

@ -1,4 +0,0 @@
" enable mouse support
if has('mouse')
set mouse=a
endif

View File

@ -1,3 +0,0 @@
nnoremap Y y$
nnoremap j gj
nnoremap k gk

View File

@ -12,7 +12,7 @@ Plug 'vim-scripts/gnupg'
Plug 'tomasr/molokai'
Plug 'junegunn/seoul256.vim'
Plug 'baeuml/summerfruit256.vim'
Plug 'zefei/vim-colortuner', { 'on': 'Colortuner' }
"Plug 'zefei/vim-colortuner', { 'on': 'Colortuner' }
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }

View File

@ -1,4 +0,0 @@
aug ReadonlyFiles
au BufNewFile,BufRead /var/log/* set readonly
au BufNewFile,BufRead /var/log/* set nomodifiable
aug END

View File

@ -1,2 +0,0 @@
nnoremap <F2> gg=G<CR>``
inoremap <F2> <ESC>gg=G<CR>``a

View File

@ -1,4 +0,0 @@
" local replace
nnoremap gr gd[{V%::s/<C-R>///g<left><left>
nnoremap gR gD:%s/<C-R>///g<left><left>

View File

@ -1,10 +0,0 @@
" set scroll offset slightly higher so that the next or previous line can be seen
if !&scrolloff
set scrolloff=1
endif
" same as with scroll offset but for horizontal scrolling
if !&sidescrolloff
set sidescrolloff=5
endif

View File

@ -9,3 +9,8 @@ if has('extra_search')
nnoremap <silent><C-L> :nohlsearch<CR><C-L>
endif
endif
" load the matchit macros
if !exists('g:loaded_matchit') && findfile('plugins/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif

View File

@ -1,5 +0,0 @@
" split the windows more 'naturally'
if has('windows')
set splitbelow
set splitright
endif

View File

@ -1,2 +0,0 @@
" always show a status line
set laststatus=2

View File

@ -1,9 +0,0 @@
" enable filetype plugins
if has('autocmd')
filetype plugin indent on
endif
" enable syntax highlighting
if has('syntax')
syntax enable
endif

View File

@ -1,9 +0,0 @@
"set softtabstop=4
"set shiftwidth=4
"set expandtab
set autoindent
set smarttab
if has("smartindent")
set smartindent
endif

View File

@ -1,7 +0,0 @@
nnoremap U :redo<CR>
nnoremap <C-R> <NOP>
if v:version >= 704
set undofile
set undolevels=1000
endif

View File

@ -1,4 +0,0 @@
" allow the cursor to be positioned where no characters are in virtual block mode
if has('virtualedit')
set virtualedit=block
endif

View File

@ -1,6 +0,0 @@
set wildmode=longest:full,list
set wildignore=.bak,.old,.swp,~
if has('wildmenu')
set wildmenu
endif

106
core/window.vim Normal file
View File

@ -0,0 +1,106 @@
" split the windows more 'naturally'
if has('windows')
set splitbelow
set splitright
set showtabline=2
endif
" set scroll offset slightly higher so that the next or previous line can be seen
if !&scrolloff
set scrolloff=1
endif
" same as with scroll offset but for horizontal scrolling
if !&sidescrolloff
set sidescrolloff=5
endif
set number
if v:version >= 704
aug LineNumbers
au!
au VimEnter,WinEnter,InsertLeave * setlocal relativenumber
au WinLeave,InsertEnter * setlocal norelativenumber
aug END
endif
if has('linebreak')
let &showbreak = '↳ '
set breakindent
set breakindentopt=sbr
endif
" show a ruler and show the current command in the bottom right
if has('cmdline_info')
set ruler
set showcmd
endif
" show invisible characters
set listchars=tab:»\ ,trail:◆,extends:▹,precedes:◃,eol:↲,nbsp
"if &listchars ==# 'eol:$'
"set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
"endif
nnoremap <silent> <F4> :set invlist<CR>
inoremap <silent> <F4> <C-O>:set invlist<CR>
vnoremap <silent> <F4> :<C-W>set invlist<CR>
if has('wildmenu')
set wildmenu
set wildmode=longest:full,list
set wildignore=.bak,.old,.swp,~
endif
" maximum height of a popup menu
set pumheight=10
" allow the cursor to be positioned where no characters are in virtual block mode
if has('virtualedit')
set virtualedit=block
endif
" enable syntax highlighting
if has('syntax')
syntax enable
endif
if has('multi_byte')
set encoding=utf-8
set termencoding=utf-8
endif
" always show a status line
set laststatus=2
" show as much as possible of the last line
set display+=lastline
" show matching brackets
set showmatch
set matchtime=2
" shorten some messages
set shortmess=aoOtTI
" set the terminal colors to 256 if not in a VT
if exists($TERM)
if &t_Co == 8 && $TERM !~# '^linux'
set t_Co=256
endif
endif
aug CursorLineColumn
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn
au WinLeave * setlocal nocursorline nocursorcolumn
aug END
" disable visualbell
set visualbell
set t_vb=

View File

@ -1,8 +0,0 @@
set confirm
set autowrite
set autoread
command! Wq wq
command! WQ wq
command! Q q
command! W w