From 8ffc267a1f97278bd98b5028e2dc7463aca2a61a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Nov 2017 00:00:17 +1300 Subject: Move misplaced command.vim file Looks like this was added in a1ee04d for v0.4.0 and was intended to replace the file in its correct path at vim/config/comment.vim. --- vim/config/command.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vim/config') diff --git a/vim/config/command.vim b/vim/config/command.vim index 1d2b647a..2a60bab3 100644 --- a/vim/config/command.vim +++ b/vim/config/command.vim @@ -22,7 +22,9 @@ set shellpipe=> " Always use forward slashes, I very seldom need to use Vim on Windows for " more than scratch space anyway -set shellslash +if exists('+shellslash') + set shellslash +endif " Tolerate typos like :Wq, :Q, or :Qa and do what I mean, including any " arguments or modifiers; I fat-finger these commands a lot because I type -- cgit v1.2.3 From 3f586a3d48bb04ef9206a202235b54cfcec38859 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Nov 2017 20:35:23 +1300 Subject: Use / correctly in Vim config From ":help ": > In a global plugin should be used and in a filetype plugin > . "mapleader" and "maplocalleader" can be equal. --- vim/config/format.vim | 6 +++--- vim/config/list.vim | 2 +- vim/config/number.vim | 2 +- vim/config/search.vim | 4 ++-- vim/config/spell.vim | 6 +++--- vim/config/whitespace.vim | 2 +- vim/config/wrap.vim | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'vim/config') diff --git a/vim/config/format.vim b/vim/config/format.vim index 35245d0d..b0de7621 100644 --- a/vim/config/format.vim +++ b/vim/config/format.vim @@ -38,8 +38,8 @@ if has('eval') endfunction " Map leader-letters to corresponding format option flags - nnoremap a :call ToggleFormatFlag('a') - nnoremap c :call ToggleFormatFlag('c') - nnoremap t :call ToggleFormatFlag('t') + nnoremap a :call ToggleFormatFlag('a') + nnoremap c :call ToggleFormatFlag('c') + nnoremap t :call ToggleFormatFlag('t') endif diff --git a/vim/config/list.vim b/vim/config/list.vim index faf5e29a..209bb4ec 100644 --- a/vim/config/list.vim +++ b/vim/config/list.vim @@ -1,7 +1,7 @@ " Don't show whitespace characters or end-of-line characters visually by " default, but make \l toggle between them set nolist -nnoremap l :setlocal list! list? +nnoremap l :setlocal list! list? " Clearly show when the start or end of the row does not correspond to the " start and end of the line diff --git a/vim/config/number.vim b/vim/config/number.vim index 35ec7efe..d7d9919c 100644 --- a/vim/config/number.vim +++ b/vim/config/number.vim @@ -1,3 +1,3 @@ " Don't show line numbers by default, but \n toggles them set nonumber -nnoremap n :setlocal number! number? +nnoremap n :setlocal number! number? diff --git a/vim/config/search.vim b/vim/config/search.vim index 66b81ab0..0f10eea5 100644 --- a/vim/config/search.vim +++ b/vim/config/search.vim @@ -3,11 +3,11 @@ if has('extra_search') " Searching as I enter my pattern, \i toggles this set incsearch - nnoremap i :setlocal incsearch! incsearch? + nnoremap i :setlocal incsearch! incsearch? " Highlight search results, \h toggles this set hlsearch - nnoremap h :setlocal hlsearch! hlsearch? + nnoremap h :setlocal hlsearch! hlsearch? " Pressing ^L will clear highlighting until the next search-related " operation; quite good because the highlighting gets distracting after diff --git a/vim/config/spell.vim b/vim/config/spell.vim index 046b50ff..6a0167d0 100644 --- a/vim/config/spell.vim +++ b/vim/config/spell.vim @@ -3,12 +3,12 @@ if has('spell') " Don't check spelling by default, but bind \s to toggle this set nospell - nnoremap s :setlocal spell! spell? + nnoremap s :setlocal spell! spell? " Use New Zealand English for spelling by default (it's almost identical " to British English), but bind \u to switch to US English and \z to " switch back set spelllang=en_nz - nnoremap u :setlocal spelllang=en_us spelllang? - nnoremap z :setlocal spelllang=en_nz spelllang? + nnoremap u :setlocal spelllang=en_us spelllang? + nnoremap z :setlocal spelllang=en_nz spelllang? endif diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim index cc2554bd..bfe2663d 100644 --- a/vim/config/whitespace.vim +++ b/vim/config/whitespace.vim @@ -52,6 +52,6 @@ if has('eval') endfunction " Map \x to the function just defined - nnoremap x :call StripTrailingWhitespace() + nnoremap x :call StripTrailingWhitespace() endif diff --git a/vim/config/wrap.vim b/vim/config/wrap.vim index 0e5866d8..7a442e89 100644 --- a/vim/config/wrap.vim +++ b/vim/config/wrap.vim @@ -1,6 +1,6 @@ " Don't wrap by default, but use \w to toggle it on or off quickly set nowrap -nnoremap w :setlocal wrap! wrap? +nnoremap w :setlocal wrap! wrap? " When wrapping text, if a line is so long that not all of it can be shown on " the screen, show as much as possible anyway; by default Vim fills the left @@ -58,7 +58,7 @@ if has('linebreak') endfunction " Map \b to defined function - nnoremap b :call ToggleBreak() + nnoremap b :call ToggleBreak() endif endif -- cgit v1.2.3 From acec3d790704ab65a0c4229f4355e99fafcbdde5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Nov 2017 00:45:41 +1300 Subject: Use underscore as local map leader This should allow me to mentally separate actions specific to a buffer type from actions that apply to buffers in general. It also removes the overlap of l for 'list' toggling and filetype linting. From ":help maplocalleader": > is just like , except that it uses > "maplocalleader" instead of "mapleader". is to be used > for mappings which are local to a buffer. Example: > > :map A oanother line > > In a global plugin should be used and in a filetype plugin > . "mapleader" and "maplocalleader" can be equal. > Although, if you make them different, there is a smaller chance of > mappings from global plugins to clash with mappings for filetype > plugins. For example, you could keep "mapleader" at the default > backslash, and set "maplocalleader" to an underscore. --- vim/config/leader.vim | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 vim/config/leader.vim (limited to 'vim/config') diff --git a/vim/config/leader.vim b/vim/config/leader.vim new file mode 100644 index 00000000..2d7b98ae --- /dev/null +++ b/vim/config/leader.vim @@ -0,0 +1,3 @@ +" Use different keys for global and local leaders +let mapleader = '\' +let maplocalleader = '_' -- cgit v1.2.3 From 55699ddf44405c16f5ad6fbad6022aaeb4373683 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Nov 2017 00:57:28 +1300 Subject: Specify scope of mapleader variables `vint -s` says: vim/config/leader.vim:2:5: Make the scope explicit like `g:mapleader` (see Anti-pattern of vimrc (Scope of identifier)) vim/config/leader.vim:3:5: Make the scope explicit like `g:maplocalleader` (see Anti-pattern of vimrc (Scope of identifier)) This does still seem to work with the prefixes, despite not being the way the documentation specifies the variables. --- vim/config/leader.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vim/config') diff --git a/vim/config/leader.vim b/vim/config/leader.vim index 2d7b98ae..9ca8f762 100644 --- a/vim/config/leader.vim +++ b/vim/config/leader.vim @@ -1,3 +1,3 @@ " Use different keys for global and local leaders -let mapleader = '\' -let maplocalleader = '_' +let g:mapleader = '\' +let g:maplocalleader = '_' -- cgit v1.2.3