diff options
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/indent/vim.vim | 11 | ||||
-rw-r--r-- | vim/filetype.vim | 4 | ||||
-rw-r--r-- | vim/vimrc | 84 |
4 files changed, 59 insertions, 44 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v4.28.0 -Thu May 16 01:16:29 UTC 2019 +tejr dotfiles v4.29.0 +Thu May 16 12:25:40 UTC 2019 diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 6e2eb7f3..0767bca0 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,5 +1,5 @@ -" Remove inapplicable defaults from 'indentkeys' -" Should only need to undo this if the stock plugin didn't +" Remove inapplicable defaults from 'indentkeys'; we should only need to undo +" this if the stock plugin didn't already arrange that (before v7.3.539) setlocal indentkeys-=0#,0{,0},0),: if !exists('b:undo_indent') let b:undo_indent = 'setlocal indentkeys<' @@ -7,5 +7,8 @@ endif " Observe VimL conventions for two-space indents setlocal shiftwidth=2 -setlocal softtabstop=2 -let b:undo_indent .= '|setlocal shiftwidth< softtabstop<' +let b:undo_indent .= '|setlocal shiftwidth<' +if &softtabstop != -1 + let &l:softtabstop = &l:shiftwidth + let b:undo_indent .= '|setlocal softtabstop<' +endif diff --git a/vim/filetype.vim b/vim/filetype.vim index 66936f34..d7ca5255 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -505,6 +505,8 @@ augroup filetypedetect " On leaving insert mode, check whether the first line was changed and looks " like a shebang format, and if so, re-run filetype detection - autocmd InsertLeave * call filetype#CheckShebang() + autocmd InsertLeave + \ * + \ call filetype#CheckShebang() augroup END @@ -13,33 +13,24 @@ if !exists('$MYVIMRUNTIME') \ ) endif -" Load filetype settings, plugins, and maps -let maplocalleader = ',' -filetype plugin indent on +" The all-important default indent settings; filetypes to tweak +set autoindent " Use indent of previous line on new lines +set expandtab " Use spaces instead of tabs +set shiftwidth=4 " Indent with four spaces -" Use syntax highlighting -if !exists('syntax_on') - syntax enable +" The number of spaces the Tab key should insert should follow 'shiftwidth'; +" if Vim is new enough (v7.3.693), use a negative value to automate this, +" otherwise just use its present value +if v:version > 703 + \ || v:version == 703 && has('patch693') + set softtabstop=-1 +else + let &softtabstop = &shiftwidth endif -" Try to use sahara colorscheme with 'cursorline' set; otherwise, use the -" default colorscheme with a dark background -try - colorscheme sahara - set cursorline -catch - set background=dark -endtry - -" The all-important default indent settings; filetypes to tweak -set autoindent " Use indent of previous line on new lines -set expandtab " Use spaces instead of tabs -set shiftwidth=4 " Indent with four spaces -set softtabstop=4 " Insert four spaces with tab key - " Let me backspace over pretty much anything -set backspace+=eol " Line breaks set backspace+=indent " Spaces from 'autoindent' +set backspace+=eol " Line breaks set backspace+=start " The start of current insertion " Try to keep backups in one system-appropriate dir, including full encoded @@ -75,8 +66,7 @@ set completeopt+=menuone " Show the menu even if only one match " Give me a prompt instead of just rejecting risky :write, :saveas set confirm -" Require two spaces for sentence objects -" Yes, I have become a filthy two-spacer +" Sentence objects are separated by two spaces set cpoptions+=J " Try to keep swapfiles in one system-appropriate dir, including full encoded @@ -112,7 +102,8 @@ if v:version > 801 set formatoptions+=p endif -" Don't load GUI menus; set here before GUI starts +" Don't load GUI menus; set here before GUI starts or any filetype or syntax +" logic is performed if has('gui_running') set guioptions+=M endif @@ -182,9 +173,10 @@ set showbreak=... set splitbelow " Below the current window, not above set splitright " Right of the current window, not left -" No terminal mouse, even if we could -" The manual says to set 't_RV', but I don't like that -if &ttymouse !=# '' +" No terminal mouse, even if we could; the manual says to set 't_RV', but I +" don't like that +" Not in NeoVim +if exists('+ttymouse') && &ttymouse !=# '' set ttymouse= endif @@ -196,10 +188,10 @@ if has('persistent_undo') endif " Tab completion settings; see also plugin/wildignore.vim -set wildmode=list:longest " Tab press completes and lists if exists('+wildignorecase') set wildignorecase " Case insensitive, if supported (v7.3.072) endif +set wildmode=list:longest " Tab press completes and lists " Let me move beyond buffer text in visual block mode set virtualedit+=block @@ -207,17 +199,23 @@ set virtualedit+=block " Never beep at me set visualbell t_vb= -" Stack normal/visual/select Ctrl-L to clear search highlight -nnoremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L> -vnoremap <silent> <C-L> :<C-U>nohlsearch<CR>gv<C-L> +" Load filetype settings, plugins, and maps +let maplocalleader = ',' +filetype plugin indent on -" Remap insert Ctrl-C to undo the escaped insert operation -if &loadplugins " Don't break the key if we won't be loading the plugin - imap <C-C> <Plug>(InsertCancel) +" Use syntax highlighting +if !exists('syntax_on') + syntax enable endif -" Map double Ctrl-K in insert mode to search digraph names -imap <C-K><C-K> <Plug>(DigraphSearch) +" Try to use sahara colorscheme with 'cursorline' set; otherwise, use the +" default colorscheme with a dark background +try + colorscheme sahara + set cursorline +catch + set background=dark +endtry " Remap normal space to scroll down a page nnoremap <Space> <PageDown> @@ -226,6 +224,18 @@ if &loadplugins " Don't change the mapping if we won't be loading the plugin nmap <Space> <Plug>(ScrollNext) endif +" Remap insert Ctrl-C to undo the escaped insert operation +if &loadplugins " Don't break the key if we won't be loading the plugin + imap <C-C> <Plug>(InsertCancel) +endif + +" Map double Ctrl-K in insert mode to search digraph names +imap <C-K><C-K> <Plug>(DigraphSearch) + +" Stack normal/visual/select Ctrl-L to clear search highlight +nnoremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L> +vnoremap <silent> <C-L> :<C-U>nohlsearch<CR>gv<C-L> + " Remap normal/visual & and g& to preserve substitution flags nnoremap <silent> & :&&<CR> xnoremap <silent> & :&&<CR> |