From d8caa0875a850e2cbe93050ef030205f96fc1e32 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 09:34:11 +1300 Subject: Remove pre-7.0 Vim handling/boilerplate --- vim/after/indent/vim.vim | 11 +++++---- vim/vimrc | 62 ++++++++++++++++++------------------------------ 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 548d3e5c..3d439458 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,8 +1,11 @@ +" Remove inapplicable defaults from 'indentkeys' +" Should only need to undo this if the stock plugin didn't +setlocal indentkeys-=0#,0{,0},0),: +if !exists('b:undo_indent') + let b:undo_indent = '|setlocal indentkeys<' +endif + " Observe VimL conventions for two-space indents setlocal shiftwidth=2 setlocal softtabstop=2 let b:undo_indent .= '|setlocal shiftwidth< softtabstop<' - -" Remove inapplicable defaults from 'indentkeys' -setlocal indentkeys-=0#,0{,0},0),: -let b:undo_indent .= '|setlocal indentkeys<' diff --git a/vim/vimrc b/vim/vimrc index d8832fb7..09b9ca0f 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,20 +1,24 @@ " Tom Ryder (tejr)'s vimrc: " -" This file is designed to load without unsuppressed errors on Vim 6.0 and up. -" Anything older than that will probably break. There are also some odd bits -" of logic to cope with loading as much config as possible on vim-tiny. +" This file is designed to load on any build of Vim version 7.0 or newer, +" including tiny builds without +eval. + +" Require at least Vim 7.0 (released 2006-05-08) +if v:version < 700 + finish +endif " Undo anything the operating system's vimrc may have broken runtime system.vim " Load filetype settings, plugins, and maps -if has('autocmd') && v:version >= 700 +if has('autocmd') let g:maplocalleader = ',' filetype plugin indent on endif " Options dependent on the syntax feature -if has('syntax') && v:version >= 700 +if has('syntax') " Use syntax highlighting if !exists('g:syntax_on') @@ -223,7 +227,7 @@ nnoremap :nohlsearch vnoremap :nohlsearchgv " Remap insert Ctrl-C to undo the escaped insert operation -if &loadplugins " Don't break the key if we won't be getting the plugin +if &loadplugins " Don't break the key if we won't be loading the plugin imap (InsertCancel) endif @@ -232,16 +236,14 @@ imap (DigraphSearch) " Remap normal space to scroll down a page nnoremap -" If we have plugins, do a :next after hitting the last line -if &loadplugins +" 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 normal/visual & to preserve substitution flags nnoremap & :&& -if exists(':xnoremap') - xnoremap & :&& -endif +xnoremap & :&& " Map g: as a 'colon operator' nmap g: (ColonOperator) @@ -275,9 +277,7 @@ nmap b (CopyLinebreakToggle) nnoremap c :setlocal cursorline! cursorline? " \C toggles 'cursorcolumn'; works in visual mode nnoremap C :setlocal cursorcolumn! cursorcolumn? -if exists(':xnoremap') - xnoremap C :setlocal cursorcolumn! cursorcolumn?gv -endif +xnoremap C :setlocal cursorcolumn! cursorcolumn?gv " \d inserts the local date (POSIX date) nnoremap d :read !date @@ -313,9 +313,7 @@ nnoremap k :marks " \l toggles showing tab, end-of-line, and trailing whitespace nnoremap l :setlocal list! list? -if exists(':xnoremap') - xnoremap l :setlocal list! list?gv -endif +xnoremap l :setlocal list! list?gv " \m shows normal maps nnoremap m :map @@ -324,14 +322,10 @@ nnoremap M :map " \n toggles line number display nnoremap n :setlocal number! number? -if exists(':xnoremap') - xnoremap n :setlocal number! number?gv -endif +xnoremap n :setlocal number! number?gv " \N toggles position display in bottom right nnoremap N :set ruler! ruler? -if exists(':xnoremap') - xnoremap N :set ruler! ruler?gv -endif +xnoremap N :set ruler! ruler?gv " \o opens a line below in paste mode nmap o (PasteOpenBelow) @@ -346,9 +340,7 @@ nnoremap q gqap " \r acts as a replacement operator nmap r (ReplaceOperator) -if exists(':xmap') - xmap r (ReplaceOperator) -endif +xmap r (ReplaceOperator) " \R reloads ~/.vimrc nnoremap R :source $MYVIMRC @@ -371,21 +363,15 @@ nnoremap V :let b: t: w: " \w toggles wrapping nnoremap w :setlocal wrap! wrap? -if exists(':xnoremap') - xnoremap w :setlocal wrap! wrap?gv -endif +xnoremap w :setlocal wrap! wrap?gv " \x strips trailing whitespace via a custom plugin nmap x :StripTrailingWhitespace -if exists(':xmap') - xmap x :StripTrailingWhitespace -endif +xmap x :StripTrailingWhitespace " \X squeezes repeated blank lines via a custom plugin nmap X :SqueezeRepeatBlanks -if exists(':xmap') - xmap X :SqueezeRepeatBlanks -endif +xmap X :SqueezeRepeatBlanks " \y shows all registers nnoremap y :registers @@ -416,10 +402,8 @@ nmap { (VerticalRegionUpNormal) nmap } (VerticalRegionDownNormal) omap { (VerticalRegionUpOperator) omap } (VerticalRegionDownOperator) -if exists(':xmap') - xmap { (VerticalRegionUpVisual) - xmap } (VerticalRegionDownVisual) -endif +xmap { (VerticalRegionUpVisual) +xmap } (VerticalRegionDownVisual) " \/ types :vimgrep for me ready to enter a search pattern nnoremap / :vimgrep /\c/ ** -- cgit v1.2.3 From 9310f1291c79c4adfb88f03cfa943b88f89bd9ab Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 09:34:34 +1300 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 334920ab..e7ac2aed 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v2.0.1 -Thu Nov 29 11:12:22 UTC 2018 +tejr dotfiles v2.1.0 +Thu Nov 29 20:34:34 UTC 2018 -- cgit v1.2.3