From 0820ce7bc363cb2cc55379e1b4e161a1673136ca Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 6 Aug 2018 16:22:39 +1200 Subject: Add ASM to Vim filetypes --- vim/filetype.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/filetype.vim b/vim/filetype.vim index 0ff4cf76..192a7283 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -72,6 +72,10 @@ augroup filetypedetect \ .htaccess \,*/apache*/?*.conf \ setfiletype apache + " Assembly language files + autocmd BufNewFile,BufRead + \ ?*.s + \ setfiletype asm " AWK files autocmd BufNewFile,BufRead \ ?*.awk -- cgit v1.2.3 From 4a514fbb81e9ca1fb2a2c251b7775bc1f8d1af2c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 09:57:08 +1200 Subject: Revert "Use ^= instead of += for arbitrary tex..." This (partly) reverts commit 9c05d0aaa8b3d95d6defd05aa1c352e28be43c01. --- vim/vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index e9fbaf3f..5b1423b1 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -113,11 +113,11 @@ set lazyredraw set linebreak " Define extra 'list' display characters -set listchars^=extends:> " Unwrapped text to screen right -set listchars^=precedes:< " Unwrapped text to screen left -set listchars^=tab:>- " Tab characters, preserve width -set listchars^=trail:_ " Trailing spaces -silent! set listchars^=nbsp:+ " Non-breaking spaces +set listchars+=extends:> " Unwrapped text to screen right +set listchars+=precedes:< " Unwrapped text to screen left +set listchars+=tab:>- " Tab characters, preserve width +set listchars+=trail:_ " Trailing spaces +silent! set listchars+=nbsp:+ " Non-breaking spaces " Don't allow setting options via buffer content set nomodeline @@ -127,7 +127,7 @@ set nrformats-=octal " Options for file search with gf/:find set path-=/usr/include " Let the C/C++ filetypes set that -set path^=** " Search current directory's whole tree +set path+=** " Search current directory's whole tree " Don't show startup splash screen (I donated) set shortmess+=I -- cgit v1.2.3 From 981021f18aa9ada153070b08b4fc075059999190 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:23:06 +1200 Subject: Bind K in Vim help to jump to tag --- vim/after/ftplugin/help.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim index e21a5259..db621315 100644 --- a/vim/after/ftplugin/help.vim +++ b/vim/after/ftplugin/help.vim @@ -9,3 +9,14 @@ if has('conceal') && &modifiable && !&readonly setlocal conceallevel=0 let b:undo_ftplugin .= '|setlocal conceallevel<' endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_help_maps') + finish +endif + +" Make K jump to the help topic; NeoVim does this, and it's a damned good idea +if !has('nvim') + nnoremap K + let b:undo_ftplugin .= '|nunmap K' +endif -- cgit v1.2.3 From 1c70ad8c4a026601b47ede160a7fe6d3547fa0cd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:28:50 +1200 Subject: Improve a comment on HTML URL links --- vim/after/ftplugin/html.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 2faea4f5..dc429221 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -23,7 +23,7 @@ if exists('g:no_plugin_maps') || exists('g:no_html_maps') finish endif -" Set mappings +" Transform URLs to HTML anchors nnoremap r \ :call html#UrlLink() let b:undo_ftplugin .= '|nunmap r' -- cgit v1.2.3 From 593558497df441300342a7cb55cd7de5fbbd7485 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:29:19 +1200 Subject: Bind ,K in Vim buffers as a :helpgrep shortcut --- vim/after/ftplugin/vim.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index ca6b01b0..bfac623a 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -13,6 +13,11 @@ if exists('g:no_plugin_maps') || exists('g:no_vim_maps') finish endif +" ,K runs :helpgrep on the word under the cursor +nnoremap K + \ :helpgrep +let b:undo_ftplugin .= '|nunmap K' + " Get rid of the core ftplugin's square-bracket maps on unload let b:undo_ftplugin .= '|nunmap [[' \ . '|vunmap [[' -- cgit v1.2.3 From 473fb28e9113b374eb7b964b57cffa495a5e0fbc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:51:15 +1200 Subject: Add e() and v() wrappers --- README.md | 3 +++ sh/shrc.d/e.sh | 4 ++++ sh/shrc.d/v.sh | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 sh/shrc.d/e.sh create mode 100644 sh/shrc.d/v.sh diff --git a/README.md b/README.md index 6c88ad44..eb8ccb94 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,9 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include: * `ud()` changes into an indexed ancestor of a directory. * `vr()` tries to change to the root directory of a source control repository. +* Two editor wrapper functions: + * `e()` invokes `$EDITOR`, or `ed(1)` if not set. + * `v()` invokes `$VISUAL`, or `vi(1)` if not set. * `bc()` silences startup messages from GNU `bc(1)`. * `ed()` tries to get verbose error messages, a prompt, and a Readline environment for `ed(1)`. diff --git a/sh/shrc.d/e.sh b/sh/shrc.d/e.sh new file mode 100644 index 00000000..776b242c --- /dev/null +++ b/sh/shrc.d/e.sh @@ -0,0 +1,4 @@ +# Invoke $EDITOR +e() { + "${EDITOR:-ed}" "$@" +} diff --git a/sh/shrc.d/v.sh b/sh/shrc.d/v.sh new file mode 100644 index 00000000..a5fa147c --- /dev/null +++ b/sh/shrc.d/v.sh @@ -0,0 +1,4 @@ +# Invoke $VISUAL +v() { + "${VISUAL:-vi}" "$@" +} -- cgit v1.2.3 From 69209e46e1c75480b43c0a41a974bebb8a520e81 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:58:47 +1200 Subject: Check for 'cursorline' existence --- vim/vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 5b1423b1..be9c63ab 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -62,8 +62,10 @@ set comments= set confirm " Only turn on 'cursorline' if my colorscheme loaded -if exists('g:colors_name') && g:colors_name ==# 'sahara' - set cursorline +if exists('+cursorline') + if exists('g:colors_name') && g:colors_name ==# 'sahara' + set cursorline + endif endif " Try to keep swapfiles in one system-appropriate dir -- cgit v1.2.3 From 27e245d9c91b584311e39728c84f2c57aa08c360 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 15:01:24 +1200 Subject: Check surround.vim actually loaded before unmap --- vim/after/plugin/surround.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vim/after/plugin/surround.vim b/vim/after/plugin/surround.vim index b1face5f..800bc38d 100644 --- a/vim/after/plugin/surround.vim +++ b/vim/after/plugin/surround.vim @@ -1,4 +1,7 @@ " Remove surround.vim's insert mode maps +if !exists('g:loaded_surround') + finish +endif iunmap ISurround iunmap Isurround iunmap S -- cgit v1.2.3