From 1c51d2e98e0e0ec91da7ff3a93ad84f9767d0658 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 20:20:03 +1200 Subject: Dispense with system-dependent files Let's see how well just :set all& works. --- Makefile | 5 ----- vim/system/centos.vim | 33 --------------------------------- vim/system/debian.vim | 18 ------------------ vim/vimrc | 4 ++-- 4 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 vim/system/centos.vim delete mode 100644 vim/system/debian.vim diff --git a/Makefile b/Makefile index 2a5abdbd..350d891f 100644 --- a/Makefile +++ b/Makefile @@ -591,11 +591,6 @@ install-vim-compiler: install-vim-config: install-vim-cache cp -p -- vim/vimrc.stub.vim $(HOME)/.vimrc cp -p -- vim/vimrc $(VIMRC) - if [ -e /etc/debian_version ] ; then \ - cp -p -- vim/system/debian.vim $(VIMDIR)/system.vim ; \ - elif [ -e /etc/centos-release ] ; then \ - cp -p -- vim/system/centos.vim $(VIMDIR)/system.vim ; \ - fi install-vim-filetype: cp -p -- vim/filetype.vim vim/scripts.vim $(VIMDIR) diff --git a/vim/system/centos.vim b/vim/system/centos.vim deleted file mode 100644 index 3c1dbc48..00000000 --- a/vim/system/centos.vim +++ /dev/null @@ -1,33 +0,0 @@ -" Revert settings that CentOS might have touched -if $VIM !=# '/usr/share/vim' - \ || !filereadable('/etc/centos-release') - finish -endif - -" Set options back to appropriate defaults -set history& -if has('cmdline_info') - set ruler& -endif -if has('cscope') - set cscopeprg& - set cscopetag& - set cscopetagorder& - set cscopeverbose& - silent! cscope kill -endif -if has('gui') - set guicursor& -endif -if has('viminfo') - set viminfo& -endif - -" Restore terminal settings to reflect terminfo -set t_Co& t_Sf& t_Sb& - -" Delete autocmd groups -augroup redhat - autocmd! -augroup END -augroup! redhat diff --git a/vim/system/debian.vim b/vim/system/debian.vim deleted file mode 100644 index 07649f07..00000000 --- a/vim/system/debian.vim +++ /dev/null @@ -1,18 +0,0 @@ -" Revert settings that Debian might have touched -if $VIM !=# '/usr/share/vim' - \ || !filereadable('/etc/debian_version') - finish -endif - -" Set options back to appropriate defaults -set history& -set printoptions& -set ruler& -set suffixes& - -" Restore terminal settings to reflect terminfo -set t_Co& t_Sf& t_Sb& - -" Remove addons directories from 'runtimepath' if present -set runtimepath-=/var/lib/vim/addons -set runtimepath-=/var/lib/vim/addons/after diff --git a/vim/vimrc b/vim/vimrc index 915b02b0..6caf77bc 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,8 +1,8 @@ " Tom Ryder (tejr)'s vimrc: " Requires Vim 7.0 or newer with +eval. -" Undo anything the operating system's vimrc may have broken -runtime system.vim +" Revert everything to Vim defaults +set all& " Set an environment variable for the user runtime directory if !exists('$MYVIMRUNTIME') -- cgit v1.2.3 From 6fbe041164f21a8f5ed1f9d43ade397f51bf7c7e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 23:13:34 +1200 Subject: Leverage negative 'softtabstop' value From :help 'softtabstop': > When 'sts' is negative, the value of 'shiftwidth' is used. --- vim/after/indent/vim.vim | 11 +++++++---- vim/vimrc | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) 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/vimrc b/vim/vimrc index 6caf77bc..8358b9f4 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -32,10 +32,19 @@ catch 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 +set autoindent " Use indent of previous line on new lines +set expandtab " Use spaces instead of tabs +set shiftwidth=4 " Indent with four spaces + +" 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 " Let me backspace over pretty much anything set backspace+=eol " Line breaks -- cgit v1.2.3 From 15ee35b4655329449d1b2d52c07e6e6531647fd7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 23:14:39 +1200 Subject: Adjust order of some directives --- vim/vimrc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 8358b9f4..1b2c3a1b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -205,10 +205,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 @@ -216,9 +216,12 @@ set virtualedit+=block " Never beep at me set visualbell t_vb= -" Stack normal/visual/select Ctrl-L to clear search highlight -nnoremap :nohlsearch -vnoremap :nohlsearchgv +" Remap normal space to scroll down a page +nnoremap +" Do a :next after hitting the last line +if &loadplugins " Don't change the mapping if we won't be loading the plugin + nmap (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 @@ -228,12 +231,9 @@ endif " Map double Ctrl-K in insert mode to search digraph names imap (DigraphSearch) -" Remap normal space to scroll down a page -nnoremap -" Do a :next after hitting the last line -if &loadplugins " Don't change the mapping if we won't be loading the plugin - nmap (ScrollNext) -endif +" Stack normal/visual/select Ctrl-L to clear search highlight +nnoremap :nohlsearch +vnoremap :nohlsearchgv " Remap normal/visual & and g& to preserve substitution flags nnoremap & :&& -- cgit v1.2.3 From ee0b0d17aee342881ea2fe0f5f0436d8a35802e8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 23:43:12 +1200 Subject: Adjust order of 'backspace' flags per docs --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 1b2c3a1b..f5f46ed8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -47,8 +47,8 @@ else endif " 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 -- cgit v1.2.3 From c6161fe72debbb2fe02e435b4cf0cd35c8a3bfe8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 23:43:35 +1200 Subject: Remove `a` and `A` flags from 'cpoptions' --- vim/vimrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f5f46ed8..f432df5d 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -84,8 +84,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 -- cgit v1.2.3 From 420337569e98083944f3300e45a3b1e086b38811 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 16 May 2019 23:43:52 +1200 Subject: Move filetype and syntax logic to end of .vimrc --- vim/vimrc | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f432df5d..18640b81 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -13,24 +13,6 @@ if !exists('$MYVIMRUNTIME') \ ) endif -" Load filetype settings, plugins, and maps -let maplocalleader = ',' -filetype plugin indent on - -" Use syntax highlighting -if !exists('syntax_on') - syntax enable -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 @@ -120,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 @@ -423,5 +406,23 @@ nnoremap : ^"zyg_:z " \! executes line with 'shell' nnoremap ! ^"zyg_:!z +" Load filetype settings, plugins, and maps +let maplocalleader = ',' +filetype plugin indent on + +" Use syntax highlighting +if !exists('syntax_on') + syntax enable +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 + " Source any .vim files from ~/.vim/config runtime! config/*.vim -- cgit v1.2.3 From b6a7873017c30960e29d971c25ba5aa34a72f949 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:01:00 +1200 Subject: Restore 'ttymouse' option existence test The option does not exist in NeoVim. --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 18640b81..5e3508f0 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -175,7 +175,7 @@ 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 !=# '' +if exists('+ttymouse') && &ttymouse !=# '' set ttymouse= endif -- cgit v1.2.3 From f1959d5b9842c86ddc6358d5e2b754ad8e9dbb01 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:04:47 +1200 Subject: Add note about 'ttymouse' option existence --- vim/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 5e3508f0..2b63ab2b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -173,8 +173,9 @@ 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 +" 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 -- cgit v1.2.3 From 0a7c016f4d3f46b2087b573076a847f0b6d41e56 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:11:48 +1200 Subject: Rearrange filetype and syntax logic --- vim/vimrc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 2b63ab2b..7b2485a6 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -199,6 +199,24 @@ set virtualedit+=block " Never beep at me set visualbell t_vb= +" Load filetype settings, plugins, and maps +let maplocalleader = ',' +filetype plugin indent on + +" Use syntax highlighting +if !exists('syntax_on') + syntax enable +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 + " Remap normal space to scroll down a page nnoremap " Do a :next after hitting the last line @@ -407,23 +425,5 @@ nnoremap : ^"zyg_:z " \! executes line with 'shell' nnoremap ! ^"zyg_:!z -" Load filetype settings, plugins, and maps -let maplocalleader = ',' -filetype plugin indent on - -" Use syntax highlighting -if !exists('syntax_on') - syntax enable -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 - " Source any .vim files from ~/.vim/config runtime! config/*.vim -- cgit v1.2.3 From adb22b6357e8a7e8f091b028b2094c48ff5c542c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:16:09 +1200 Subject: Adjust formatting of autocmd --- vim/filetype.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 9b53214dc18da5c54ea18435edf603d95a08f741 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:22:36 +1200 Subject: Revert "Dispense with system-dependent files" This reverts commit 1c51d2e98e0e0ec91da7ff3a93ad84f9767d0658. Already found problems--trips up using the -V command line option. --- Makefile | 5 +++++ vim/system/centos.vim | 33 +++++++++++++++++++++++++++++++++ vim/system/debian.vim | 18 ++++++++++++++++++ vim/vimrc | 4 ++-- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 vim/system/centos.vim create mode 100644 vim/system/debian.vim diff --git a/Makefile b/Makefile index 350d891f..2a5abdbd 100644 --- a/Makefile +++ b/Makefile @@ -591,6 +591,11 @@ install-vim-compiler: install-vim-config: install-vim-cache cp -p -- vim/vimrc.stub.vim $(HOME)/.vimrc cp -p -- vim/vimrc $(VIMRC) + if [ -e /etc/debian_version ] ; then \ + cp -p -- vim/system/debian.vim $(VIMDIR)/system.vim ; \ + elif [ -e /etc/centos-release ] ; then \ + cp -p -- vim/system/centos.vim $(VIMDIR)/system.vim ; \ + fi install-vim-filetype: cp -p -- vim/filetype.vim vim/scripts.vim $(VIMDIR) diff --git a/vim/system/centos.vim b/vim/system/centos.vim new file mode 100644 index 00000000..3c1dbc48 --- /dev/null +++ b/vim/system/centos.vim @@ -0,0 +1,33 @@ +" Revert settings that CentOS might have touched +if $VIM !=# '/usr/share/vim' + \ || !filereadable('/etc/centos-release') + finish +endif + +" Set options back to appropriate defaults +set history& +if has('cmdline_info') + set ruler& +endif +if has('cscope') + set cscopeprg& + set cscopetag& + set cscopetagorder& + set cscopeverbose& + silent! cscope kill +endif +if has('gui') + set guicursor& +endif +if has('viminfo') + set viminfo& +endif + +" Restore terminal settings to reflect terminfo +set t_Co& t_Sf& t_Sb& + +" Delete autocmd groups +augroup redhat + autocmd! +augroup END +augroup! redhat diff --git a/vim/system/debian.vim b/vim/system/debian.vim new file mode 100644 index 00000000..07649f07 --- /dev/null +++ b/vim/system/debian.vim @@ -0,0 +1,18 @@ +" Revert settings that Debian might have touched +if $VIM !=# '/usr/share/vim' + \ || !filereadable('/etc/debian_version') + finish +endif + +" Set options back to appropriate defaults +set history& +set printoptions& +set ruler& +set suffixes& + +" Restore terminal settings to reflect terminfo +set t_Co& t_Sf& t_Sb& + +" Remove addons directories from 'runtimepath' if present +set runtimepath-=/var/lib/vim/addons +set runtimepath-=/var/lib/vim/addons/after diff --git a/vim/vimrc b/vim/vimrc index 7b2485a6..eeb468ff 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,8 +1,8 @@ " Tom Ryder (tejr)'s vimrc: " Requires Vim 7.0 or newer with +eval. -" Revert everything to Vim defaults -set all& +" Undo anything the operating system's vimrc may have broken +runtime system.vim " Set an environment variable for the user runtime directory if !exists('$MYVIMRUNTIME') -- cgit v1.2.3 From 8488f7c4873d4ed8e529a0e7aa6c2f2f3e16cd1f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 17 May 2019 00:25:40 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index bf278408..29f7527e 100644 --- a/VERSION +++ b/VERSION @@ -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 -- cgit v1.2.3