diff --git a/core/bell.vim b/core/bell.vim deleted file mode 100644 index fc9f84e..0000000 --- a/core/bell.vim +++ /dev/null @@ -1,3 +0,0 @@ -" disable visualbell -set visualbell -set t_vb= diff --git a/core/buffer.vim b/core/buffer.vim new file mode 100644 index 0000000..da86d94 --- /dev/null +++ b/core/buffer.vim @@ -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 +nnoremap + +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 diff --git a/core/clipboard.vim b/core/clipboard.vim deleted file mode 100644 index 711e6cd..0000000 --- a/core/clipboard.vim +++ /dev/null @@ -1 +0,0 @@ -set clipboard=unnamed,unnamedplus,autoselect diff --git a/core/cmdline_info.vim b/core/cmdline_info.vim deleted file mode 100644 index 16614cf..0000000 --- a/core/cmdline_info.vim +++ /dev/null @@ -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 diff --git a/core/control.vim b/core/control.vim new file mode 100644 index 0000000..f298883 --- /dev/null +++ b/core/control.vim @@ -0,0 +1,39 @@ +nnoremap Y y$ +nnoremap j gj +nnoremap k gk + +inoremap jk +inoremap JK +inoremap Jk + +set ttimeout +set timeoutlen=500 + +nnoremap +inoremap + +let g:mapleader = "," + +noremap :noh +nnoremap vl :setlocal cursorline! +nnoremap vc :setlocal cursorcolumn! +nnoremap ve :setlocal colorcolumn=80 +nnoremap vn :setlocal colorcolumn=0 + +" 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 diff --git a/core/cursor_line_column.vim b/core/cursor_line_column.vim deleted file mode 100644 index b2c6700..0000000 --- a/core/cursor_line_column.vim +++ /dev/null @@ -1,5 +0,0 @@ -aug CursorLineColumn - au! - au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn - au WinLeave * setlocal nocursorline nocursorcolumn -aug END diff --git a/core/encoding.vim b/core/encoding.vim deleted file mode 100644 index bf3a2d3..0000000 --- a/core/encoding.vim +++ /dev/null @@ -1,4 +0,0 @@ -if has('multi_byte') - set encoding=utf-8 - set termencoding=utf-8 -endif diff --git a/core/escape.vim b/core/escape.vim deleted file mode 100644 index dd173a8..0000000 --- a/core/escape.vim +++ /dev/null @@ -1,6 +0,0 @@ -imap jk -imap JK -imap Jk - -set ttimeout -set timeoutlen=500 diff --git a/core/folding.vim b/core/folding.vim index cd36a79..17c4a61 100644 --- a/core/folding.vim +++ b/core/folding.vim @@ -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 diff --git a/core/formatting.vim b/core/formatting.vim new file mode 100644 index 0000000..f125d08 --- /dev/null +++ b/core/formatting.vim @@ -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 + +" fix indentation of an entire file +nnoremap gg=G`` +inoremap gg=G``a + +" local replace +nnoremap gr gd[{V%::s////g +nnoremap gR gD:%s////g diff --git a/core/help.vim b/core/help.vim deleted file mode 100644 index 1518993..0000000 --- a/core/help.vim +++ /dev/null @@ -1,2 +0,0 @@ -nnoremap -inoremap diff --git a/core/history.vim b/core/history.vim deleted file mode 100644 index 85e0bff..0000000 --- a/core/history.vim +++ /dev/null @@ -1,4 +0,0 @@ -" set the history far higher (default 50) -if &history < 1000 - set history=1000 -endif diff --git a/core/ident.vim b/core/ident.vim deleted file mode 100644 index b34623a..0000000 --- a/core/ident.vim +++ /dev/null @@ -1,2 +0,0 @@ -vnoremap < >gv diff --git a/core/invlist.vim b/core/invlist.vim deleted file mode 100644 index 603e7cc..0000000 --- a/core/invlist.vim +++ /dev/null @@ -1,5 +0,0 @@ -set listchars=tab:»\ ,trail:◆,extends:▹,precedes:◃,eol:↲,nbsp:· - -nnoremap :set invlist -inoremap :set invlist -vnoremap :set invlist diff --git a/core/leaderkey.vim b/core/leaderkey.vim deleted file mode 100644 index e4d82c9..0000000 --- a/core/leaderkey.vim +++ /dev/null @@ -1,7 +0,0 @@ -let g:mapleader = "," - -noremap :noh -nnoremap vl :setlocal cursorline! -nnoremap vc :setlocal cursorcolumn! -nnoremap ve :setlocal colorcolumn=80 -nnoremap vn :setlocal colorcolumn=0 diff --git a/core/line_numbers.vim b/core/line_numbers.vim deleted file mode 100644 index cf90baa..0000000 --- a/core/line_numbers.vim +++ /dev/null @@ -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 diff --git a/core/linewrap.vim b/core/linewrap.vim deleted file mode 100644 index 8ac9be3..0000000 --- a/core/linewrap.vim +++ /dev/null @@ -1,5 +0,0 @@ -if has('linebreak') - let &showbreak = '↳ ' - set breakindent - set breakindentopt=sbr -endif diff --git a/core/misc.vim b/core/misc.vim deleted file mode 100644 index 9aa3718..0000000 --- a/core/misc.vim +++ /dev/null @@ -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 - - diff --git a/core/mouse.vim b/core/mouse.vim deleted file mode 100644 index c676d66..0000000 --- a/core/mouse.vim +++ /dev/null @@ -1,4 +0,0 @@ -" enable mouse support -if has('mouse') - set mouse=a -endif diff --git a/core/movement.vim b/core/movement.vim deleted file mode 100644 index 5bb11dd..0000000 --- a/core/movement.vim +++ /dev/null @@ -1,3 +0,0 @@ -nnoremap Y y$ -nnoremap j gj -nnoremap k gk diff --git a/core/plugins.vim b/core/plugins.vim index 87b754d..5a4bf5a 100644 --- a/core/plugins.vim +++ b/core/plugins.vim @@ -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' } diff --git a/core/readonly_files.vim b/core/readonly_files.vim deleted file mode 100644 index 46c2f3c..0000000 --- a/core/readonly_files.vim +++ /dev/null @@ -1,4 +0,0 @@ -aug ReadonlyFiles - au BufNewFile,BufRead /var/log/* set readonly - au BufNewFile,BufRead /var/log/* set nomodifiable -aug END diff --git a/core/reformat.vim b/core/reformat.vim deleted file mode 100644 index 9767ef5..0000000 --- a/core/reformat.vim +++ /dev/null @@ -1,2 +0,0 @@ -nnoremap gg=G`` -inoremap gg=G``a diff --git a/core/replace.vim b/core/replace.vim deleted file mode 100644 index 740ca7e..0000000 --- a/core/replace.vim +++ /dev/null @@ -1,4 +0,0 @@ -" local replace -nnoremap gr gd[{V%::s////g - -nnoremap gR gD:%s////g diff --git a/core/scrolling.vim b/core/scrolling.vim deleted file mode 100644 index e97734f..0000000 --- a/core/scrolling.vim +++ /dev/null @@ -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 diff --git a/core/search.vim b/core/search.vim index 3196b14..5e4a900 100644 --- a/core/search.vim +++ b/core/search.vim @@ -9,3 +9,8 @@ if has('extra_search') nnoremap :nohlsearch endif endif + +" load the matchit macros +if !exists('g:loaded_matchit') && findfile('plugins/matchit.vim', &rtp) ==# '' + runtime! macros/matchit.vim +endif diff --git a/core/split.vim b/core/split.vim deleted file mode 100644 index ca09d80..0000000 --- a/core/split.vim +++ /dev/null @@ -1,5 +0,0 @@ -" split the windows more 'naturally' -if has('windows') - set splitbelow - set splitright -endif diff --git a/core/statusline.vim b/core/statusline.vim deleted file mode 100644 index f11b610..0000000 --- a/core/statusline.vim +++ /dev/null @@ -1,2 +0,0 @@ -" always show a status line -set laststatus=2 diff --git a/core/syntax_highlighting.vim b/core/syntax_highlighting.vim deleted file mode 100644 index 35d06c7..0000000 --- a/core/syntax_highlighting.vim +++ /dev/null @@ -1,9 +0,0 @@ -" enable filetype plugins -if has('autocmd') - filetype plugin indent on -endif - -" enable syntax highlighting -if has('syntax') - syntax enable -endif diff --git a/core/tabstops.vim b/core/tabstops.vim deleted file mode 100644 index 4140cc2..0000000 --- a/core/tabstops.vim +++ /dev/null @@ -1,9 +0,0 @@ -"set softtabstop=4 -"set shiftwidth=4 -"set expandtab -set autoindent -set smarttab - -if has("smartindent") - set smartindent -endif diff --git a/core/undo.vim b/core/undo.vim deleted file mode 100644 index c07c72c..0000000 --- a/core/undo.vim +++ /dev/null @@ -1,7 +0,0 @@ -nnoremap U :redo -nnoremap - -if v:version >= 704 - set undofile - set undolevels=1000 -endif diff --git a/core/visual.vim b/core/visual.vim deleted file mode 100644 index b2c031a..0000000 --- a/core/visual.vim +++ /dev/null @@ -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 diff --git a/core/wildmenu.vim b/core/wildmenu.vim deleted file mode 100644 index 49ebb5b..0000000 --- a/core/wildmenu.vim +++ /dev/null @@ -1,6 +0,0 @@ -set wildmode=longest:full,list -set wildignore=.bak,.old,.swp,~ - -if has('wildmenu') - set wildmenu -endif diff --git a/core/window.vim b/core/window.vim new file mode 100644 index 0000000..ef5d2b2 --- /dev/null +++ b/core/window.vim @@ -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 :set invlist +inoremap :set invlist +vnoremap :set invlist + + + +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= diff --git a/core/write_and_quit.vim b/core/write_and_quit.vim deleted file mode 100644 index d797417..0000000 --- a/core/write_and_quit.vim +++ /dev/null @@ -1,8 +0,0 @@ -set confirm -set autowrite -set autoread - -command! Wq wq -command! WQ wq -command! Q q -command! W w