From 8c54c443b2e0c24fe281d70f375ad75aaa6ff18c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 Jun 2018 13:22:50 +1200 Subject: Correct a path in a VimL comment --- vim/config/packages.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/config/packages.vim b/vim/config/packages.vim index f03595eb..f6f38b35 100644 --- a/vim/config/packages.vim +++ b/vim/config/packages.vim @@ -1,5 +1,5 @@ " Add the packaged version of matchit.vim included in the distribution, if -" possible; after/plugin/macros.vim loads this for older Vims +" possible; plugin/macros.vim loads this for older Vims if has('packages') silent! packadd! matchit endif -- cgit v1.2.3 From 6778c97d343049cb72f6b89fa0827755c6890002 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 5 Jun 2018 23:43:37 +1200 Subject: Update markdown/autoformat.vim --- vim/bundle/markdown_autoformat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/markdown_autoformat b/vim/bundle/markdown_autoformat index 7a746123..1b633476 160000 --- a/vim/bundle/markdown_autoformat +++ b/vim/bundle/markdown_autoformat @@ -1 +1 @@ -Subproject commit 7a746123096734a73f096e861af9ce6ef708029c +Subproject commit 1b633476c922a16f77714588fe1edf5045353dcc -- cgit v1.2.3 From 6dbda3419aeada6c31a1083af198de4e38ee31b4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 14:54:23 +1200 Subject: Consolidate .vimrc and .vim/filetype.vim And add .vim/script.vim, to be composed in the next commit --- Makefile | 9 +- vim/config/backspace.vim | 8 - vim/config/backup.vim | 12 - vim/config/buffers.vim | 14 -- vim/config/command.vim | 35 --- vim/config/completion.vim | 28 --- vim/config/digraphs.vim | 6 - vim/config/display.vim | 41 ---- vim/config/dist.vim | 30 --- vim/config/files.vim | 41 ---- vim/config/format.vim | 38 --- vim/config/match.vim | 2 - vim/config/os.vim | 8 - vim/config/packages.vim | 5 - vim/config/registers.vim | 4 - vim/config/scroll.vim | 8 - vim/config/search.vim | 23 -- vim/config/spell.vim | 21 -- vim/config/substitution.vim | 11 - vim/config/swapfile.vim | 15 -- vim/config/syntax.vim | 17 -- vim/config/terminal.vim | 33 --- vim/config/undo.vim | 25 -- vim/config/viminfo.vim | 11 - vim/config/visual.vim | 5 - vim/config/whitespace.vim | 27 --- vim/config/windows.vim | 28 --- vim/config/wrap.vim | 40 ---- vim/filetype.vim | 242 +++++++++++++++++++ vim/ftdetect/awk.vim | 9 - vim/ftdetect/c.vim | 4 - vim/ftdetect/cpp.vim | 4 - vim/ftdetect/css.vim | 4 - vim/ftdetect/csv.vim | 4 - vim/ftdetect/diff.vim | 4 - vim/ftdetect/gitcommit.vim | 4 - vim/ftdetect/gitconfig.vim | 4 - vim/ftdetect/gpg.vim | 4 - vim/ftdetect/html.vim | 4 - vim/ftdetect/java.vim | 4 - vim/ftdetect/javascript.vim | 4 - vim/ftdetect/json.vim | 4 - vim/ftdetect/lex.vim | 4 - vim/ftdetect/lua.vim | 4 - vim/ftdetect/m4.vim | 4 - vim/ftdetect/mail.vim | 4 - vim/ftdetect/make.vim | 4 - vim/ftdetect/markdown.vim | 4 - vim/ftdetect/muttrc.vim | 4 - vim/ftdetect/perl.vim | 9 - vim/ftdetect/perl6.vim | 9 - vim/ftdetect/php.vim | 12 - vim/ftdetect/pod.vim | 4 - vim/ftdetect/pod6.vim | 4 - vim/ftdetect/python.vim | 9 - vim/ftdetect/readline.vim | 4 - vim/ftdetect/remind.vim | 4 - vim/ftdetect/sh.vim | 55 ----- vim/ftdetect/tmux.vim | 4 - vim/ftdetect/troff.vim | 4 - vim/ftdetect/tsv.vim | 4 - vim/ftdetect/vim.vim | 4 - vim/ftdetect/viminfo.vim | 4 - vim/ftdetect/xdefaults.vim | 4 - vim/ftdetect/xhtml.vim | 4 - vim/ftdetect/xml.vim | 4 - vim/ftdetect/yacc.vim | 4 - vim/ftdetect/yaml.vim | 4 - vim/ftdetect/zsh.vim | 9 - vim/vimrc | 566 +++++++++++++++++++++++++++++++++++++++++++- 70 files changed, 810 insertions(+), 787 deletions(-) delete mode 100644 vim/config/backspace.vim delete mode 100644 vim/config/backup.vim delete mode 100644 vim/config/buffers.vim delete mode 100644 vim/config/command.vim delete mode 100644 vim/config/completion.vim delete mode 100644 vim/config/digraphs.vim delete mode 100644 vim/config/display.vim delete mode 100644 vim/config/dist.vim delete mode 100644 vim/config/files.vim delete mode 100644 vim/config/format.vim delete mode 100644 vim/config/match.vim delete mode 100644 vim/config/os.vim delete mode 100644 vim/config/packages.vim delete mode 100644 vim/config/registers.vim delete mode 100644 vim/config/scroll.vim delete mode 100644 vim/config/search.vim delete mode 100644 vim/config/spell.vim delete mode 100644 vim/config/substitution.vim delete mode 100644 vim/config/swapfile.vim delete mode 100644 vim/config/syntax.vim delete mode 100644 vim/config/terminal.vim delete mode 100644 vim/config/undo.vim delete mode 100644 vim/config/viminfo.vim delete mode 100644 vim/config/visual.vim delete mode 100644 vim/config/whitespace.vim delete mode 100644 vim/config/windows.vim delete mode 100644 vim/config/wrap.vim delete mode 100644 vim/ftdetect/awk.vim delete mode 100644 vim/ftdetect/c.vim delete mode 100644 vim/ftdetect/cpp.vim delete mode 100644 vim/ftdetect/css.vim delete mode 100644 vim/ftdetect/csv.vim delete mode 100644 vim/ftdetect/diff.vim delete mode 100644 vim/ftdetect/gitcommit.vim delete mode 100644 vim/ftdetect/gitconfig.vim delete mode 100644 vim/ftdetect/gpg.vim delete mode 100644 vim/ftdetect/html.vim delete mode 100644 vim/ftdetect/java.vim delete mode 100644 vim/ftdetect/javascript.vim delete mode 100644 vim/ftdetect/json.vim delete mode 100644 vim/ftdetect/lex.vim delete mode 100644 vim/ftdetect/lua.vim delete mode 100644 vim/ftdetect/m4.vim delete mode 100644 vim/ftdetect/mail.vim delete mode 100644 vim/ftdetect/make.vim delete mode 100644 vim/ftdetect/markdown.vim delete mode 100644 vim/ftdetect/muttrc.vim delete mode 100644 vim/ftdetect/perl.vim delete mode 100644 vim/ftdetect/perl6.vim delete mode 100644 vim/ftdetect/php.vim delete mode 100644 vim/ftdetect/pod.vim delete mode 100644 vim/ftdetect/pod6.vim delete mode 100644 vim/ftdetect/python.vim delete mode 100644 vim/ftdetect/readline.vim delete mode 100644 vim/ftdetect/remind.vim delete mode 100644 vim/ftdetect/sh.vim delete mode 100644 vim/ftdetect/tmux.vim delete mode 100644 vim/ftdetect/troff.vim delete mode 100644 vim/ftdetect/tsv.vim delete mode 100644 vim/ftdetect/vim.vim delete mode 100644 vim/ftdetect/viminfo.vim delete mode 100644 vim/ftdetect/xdefaults.vim delete mode 100644 vim/ftdetect/xhtml.vim delete mode 100644 vim/ftdetect/xml.vim delete mode 100644 vim/ftdetect/yacc.vim delete mode 100644 vim/ftdetect/yaml.vim delete mode 100644 vim/ftdetect/zsh.vim diff --git a/Makefile b/Makefile index 20b3c1f1..bb54b280 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ install-vim-bundle \ install-vim-compiler \ install-vim-config \ - install-vim-ftdetect \ + install-vim-filetype \ install-vim-ftplugin \ install-vim-gui \ install-vim-gui-config \ @@ -494,7 +494,6 @@ install-vim: install-vim-after \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ - install-vim-ftdetect \ install-vim-ftplugin \ install-vim-indent @@ -538,12 +537,10 @@ install-vim-compiler: install-vim-config: mkdir -p -- $(VIMDIR)/config cp -p -- vim/vimrc $(VIMRC) - cp -p -- vim/config/*.vim $(VIMDIR)/config -install-vim-ftdetect: - mkdir -p -- $(VIMDIR)/ftdetect +install-vim-filetype: cp -p -- vim/filetype.vim $(VIMDIR) - cp -p -- vim/ftdetect/*.vim $(VIMDIR)/ftdetect + cp -p -- vim/script.vim $(VIMDIR) install-vim-ftplugin: mkdir -p -- $(VIMDIR)/ftplugin diff --git a/vim/config/backspace.vim b/vim/config/backspace.vim deleted file mode 100644 index db842e12..00000000 --- a/vim/config/backspace.vim +++ /dev/null @@ -1,8 +0,0 @@ -" Let me backspace over pretty much anything -set backspace= -" Allow backspacing over autoindent -set backspace+=indent -" Allow backspacing over line breaks -set backspace+=eol -" Allow backspacing over the start of the insert operation -set backspace+=start diff --git a/vim/config/backup.vim b/vim/config/backup.vim deleted file mode 100644 index cf2d63ba..00000000 --- a/vim/config/backup.vim +++ /dev/null @@ -1,12 +0,0 @@ -" Default to no backup files at all, in a way that even ancient/tiny Vims will -" understand; the auto_cache_dirs.vim plugin will take care of re-enabling -" this with a 'backupdir' setting -set nobackup -set nowritebackup - -" If backups are enabled, use a more explicit and familiar backup suffix -set backupext=.bak - -" Don't back up files in anything named */shm/; they might be password -" files -set backupskip+=*/shm/* diff --git a/vim/config/buffers.vim b/vim/config/buffers.vim deleted file mode 100644 index b5a0151b..00000000 --- a/vim/config/buffers.vim +++ /dev/null @@ -1,14 +0,0 @@ -" Allow jumping between windows and tabs to find an open instance of a given -" buffer with :sbuffer. -set switchbuf=useopen -if v:version >= 701 - set switchbuf+=usetab -endif - -" Cycle back and forth through buffers. -nnoremap - \ [b - \ :bprevious -nnoremap - \ ]b - \ :bnext diff --git a/vim/config/command.vim b/vim/config/command.vim deleted file mode 100644 index b96987cd..00000000 --- a/vim/config/command.vim +++ /dev/null @@ -1,35 +0,0 @@ -" Keep plenty of command and search history, because disk space is cheap -set history=2000 - -" Always tell me the number of lines changed by a command -set report=0 - -" Command-line based features -if has('cmdline_info') - - " Show my current position in the status bar - set ruler - - " Show the keystrokes being entered in the screen - set showcmd - - " Show the mode we're using if not normal mode (e.g. --INSERT--) - set showmode - -endif - -" \d inserts the current local date from date(1) -nnoremap - \ d - \ :read !date -" \D inserts the current UTC date from date(1) -nnoremap - \ D - \ :read !date -u - -" \m in visual/select mode starts a mail message with the selected lines -vmap m MailMuttSelected -" \m in normal mode starts a mail message with the current line -nmap m MailMuttLine -" \M in normal mode starts a mail message with the whole buffer -nmap M MailMuttBuffer diff --git a/vim/config/completion.vim b/vim/config/completion.vim deleted file mode 100644 index 566a3a7c..00000000 --- a/vim/config/completion.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Don't try to complete strings from included files, just use the strings in -" the open buffers; I'll open the file if I want to complete from it -set complete-=i - -" Configuration for the command completion feature; rather than merely cycling -" through possible completions with Tab, show them above the command line -if has('wildmenu') - - " Use the wild menu, both completing and showing all possible completions - " with a single Tab press, just as I've configured Bash to do - set wildmenu - set wildmode=list:longest - - " Don't complete certain files that I'm not likely to want to manipulate - " from within Vim: - if has('wildignore') - set wildignore+=*.a,*.o - set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png - set wildignore+=.DS_Store,.git,.hg,.svn - set wildignore+=*~,*.swp,*.tmp - endif - - " Complete files without case sensitivity, if the option is available - if exists('+wildignorecase') - set wildignorecase - endif - -endif diff --git a/vim/config/digraphs.vim b/vim/config/digraphs.vim deleted file mode 100644 index 0982d94f..00000000 --- a/vim/config/digraphs.vim +++ /dev/null @@ -1,6 +0,0 @@ -" A few very important custom digraphs -if has('digraphs') - digraph ./ 8230 " Ellipsis (HORIZONTAL ELLIPSIS U+2026) - digraph %% 8984 " Mac command key (PLACE OF INTEREST SIGN U+2318) - digraph 8: 9731 " Snowman (SNOWMAN U+2603) -endif diff --git a/vim/config/display.vim b/vim/config/display.vim deleted file mode 100644 index 8b3bcf24..00000000 --- a/vim/config/display.vim +++ /dev/null @@ -1,41 +0,0 @@ -" Set up short message settings -set shortmess= -" (file 3 of 5) -> (3 of 5) -set shortmess+=f -" [Incomplete last line] -> [eol] -set shortmess+=i -" I donated to Uganda, thanks Bram -set shortmess+=I -" 999 lines, 888 characters -> 999L, 888C -set shortmess+=l -" [Modified] -> [+] -set shortmess+=m -" [New File] -> [New] -set shortmess+=n -" Don't stack file writing messages -set shortmess+=o -" Don't stack file reading messages -set shortmess+=O -" [readonly] -> [RO] -set shortmess+=r -" Truncate file message at start if too long -set shortmess+=t -" Truncate other message in midle if too long -set shortmess+=T -" written -> [w], appended -> [a] -set shortmess+=w -" [dos format] -> [dos] -set shortmess+=x - -" Don't show whitespace characters or end-of-line characters visually by -" default, but make \l toggle between them -set nolist -nnoremap - \ l - \ :set list! list? - -" Don't show line numbers by default, but \n toggles them -set nonumber -nnoremap - \ n - \ :set number! number? diff --git a/vim/config/dist.vim b/vim/config/dist.vim deleted file mode 100644 index 0a20be48..00000000 --- a/vim/config/dist.vim +++ /dev/null @@ -1,30 +0,0 @@ -" Disable most core plugin stuff that I don't use; after/plugin/dist.vim -" clears these variables later -if has('eval') - - " 2html.vim is often useful, so keep that - " matchparen.vim I use constantly - - " I handle versioning plugins manually, and have never used .vba - let g:loaded_getscriptPlugin = 1 - let g:loaded_vimballPlugin = 1 - - " This is what grep, sed, Awk, and Perl are for - let g:loaded_logiPat = 1 - - " ^Z, my dudes - let g:loaded_netrwPlugin = 1 - - " Vim servers? What is this, Emacs? - let g:loaded_rrhelper = 1 - - " System dictionaries plus custom per-machine spell files are fine - let g:loaded_spellfile_plugin = 1 - - " If I want to read a file or a file archived within it I'll decompress or - " unarchive it myself; a text editor should not do this - let g:loaded_gzip = 1 - let g:loaded_tarPlugin = 1 - let g:loaded_zipPlugin = 1 - -endif diff --git a/vim/config/files.vim b/vim/config/files.vim deleted file mode 100644 index 61c3b6cb..00000000 --- a/vim/config/files.vim +++ /dev/null @@ -1,41 +0,0 @@ -" Load plugins for file types -if has('autocmd') - filetype plugin indent on -endif - -" Bind \p to show filetype -nnoremap - \ p - \ :set filetype? - -" Use UTF-8 by default wherever possible -if has('multi_byte') - set encoding=utf-8 -endif - -" Use all ancestors of current directory for :find -if has('file_in_path') - set path=** -endif - -" If the Vim buffer for a file doesn't have any changes and Vim detects the -" file has been altered, quietly update it -set autoread - -" Save a file automatically if I change buffers or perform operations with the -" argument list; this is particularly helpful for me as I don't use 'hidden' -set autowrite - -" Don't use modelines at all, they're apparently potential security problems -" and I've never used them anyway -set nomodeline - -" I really like ZZ and ZQ, so I wrote a couple more mappings; ZW forces a -" write of the current buffer, but doesn't quit, and ZA forces a write of all -" buffers but doesn't quit -nnoremap - \ ZW - \ :write! -nnoremap - \ ZA - \ :wall! diff --git a/vim/config/format.vim b/vim/config/format.vim deleted file mode 100644 index 86557a8c..00000000 --- a/vim/config/format.vim +++ /dev/null @@ -1,38 +0,0 @@ -" Don't assume a number with a leading zero is octal; it's far more likely a -" zero-padded decimal, so increment and decrement with ^A and ^X on that basis -set nrformats-=octal - -" Try to set the 'j' flag for 'formatoptions', to automatically delete comment -" leaders when joining lines -silent! set formatoptions+=j - -" Show the current formatoptions at a glance -nnoremap - \ f - \ :setlocal formatoptions? - -" Use toggle_option_flag.vim plugin to bind quick toggle actions for some -" 'formatoptions' flags -if has('user_commands') - - " a: Reformat paragraphs to 'textwidth' on all insert or delete operations - nnoremap - \ a - \ :ToggleOptionFlagLocal formatoptions a - - " c: Reformat comments to 'textwidth' - nnoremap - \ c - \ :ToggleOptionFlagLocal formatoptions c - - " j: Delete comment leaders when joining lines - nnoremap - \ j - \ :ToggleOptionFlagLocal formatoptions j - - " t: Reformat non-comment text to 'textwidth' - nnoremap - \ t - \ :ToggleOptionFlagLocal formatoptions t - -endif diff --git a/vim/config/match.vim b/vim/config/match.vim deleted file mode 100644 index 58bcce78..00000000 --- a/vim/config/match.vim +++ /dev/null @@ -1,2 +0,0 @@ -" Match all forms of brackets in pairs (including angle brackets) -set matchpairs+=<:> diff --git a/vim/config/os.vim b/vim/config/os.vim deleted file mode 100644 index ff6cadfc..00000000 --- a/vim/config/os.vim +++ /dev/null @@ -1,8 +0,0 @@ -" Fedora's default environment adds a few auto commands that I don't like, -" including the 'return to previous position in buffer' one; fortunately -" they're nice enough to group the commands, so I can just clear them -if has('autocmd') - augroup fedora - autocmd! - augroup END -endif diff --git a/vim/config/packages.vim b/vim/config/packages.vim deleted file mode 100644 index f6f38b35..00000000 --- a/vim/config/packages.vim +++ /dev/null @@ -1,5 +0,0 @@ -" Add the packaged version of matchit.vim included in the distribution, if -" possible; plugin/macros.vim loads this for older Vims -if has('packages') - silent! packadd! matchit -endif diff --git a/vim/config/registers.vim b/vim/config/registers.vim deleted file mode 100644 index 01879aa8..00000000 --- a/vim/config/registers.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Change and delete with C and D both cut off the remainder of the line from -" the cursor, but Y yanks the whole line, which is inconsistent (and can be -" done with yy anyway); this fixes it so it only yanks the rest of the line -nnoremap Y y$ diff --git a/vim/config/scroll.vim b/vim/config/scroll.vim deleted file mode 100644 index 73c3dcec..00000000 --- a/vim/config/scroll.vim +++ /dev/null @@ -1,8 +0,0 @@ -" Allow the cursor to get to the top or bottom of the screen before scrolling -" vertically, but set a reasonably wide gutter for scrolling horizontally; no -" particular reason, just suits me better -set scrolloff=0 -set sidescrolloff=16 - -" Rebind in normal mode as a lazy scroll -nnoremap diff --git a/vim/config/search.vim b/vim/config/search.vim deleted file mode 100644 index fc861801..00000000 --- a/vim/config/search.vim +++ /dev/null @@ -1,23 +0,0 @@ -" Some special settings for searching, if available -if has('extra_search') - - " Searching as I enter my pattern, \i toggles this - set incsearch - nnoremap - \ i - \ :set incsearch! incsearch? - - " Highlight search results, \h toggles this - set hlsearch - nnoremap - \ h - \ :set hlsearch! hlsearch? - - " Pressing ^L will clear highlighting until the next search-related - " operation; quite good because the highlighting gets distracting after - " you've found what you wanted - nnoremap - \ - \ :nohlsearch - -endif diff --git a/vim/config/spell.vim b/vim/config/spell.vim deleted file mode 100644 index cbbe17f1..00000000 --- a/vim/config/spell.vim +++ /dev/null @@ -1,21 +0,0 @@ -" Configure spell checking features, if available -if has('spell') - - " Don't check spelling by default, but bind \s to toggle this - set nospell - 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? - -endif diff --git a/vim/config/substitution.vim b/vim/config/substitution.vim deleted file mode 100644 index 982d25f3..00000000 --- a/vim/config/substitution.vim +++ /dev/null @@ -1,11 +0,0 @@ -" Preserve the flags for a pattern when repeating a substitution with &; I -" don't really understand why this isn't a default, but there it is -nnoremap - \ & - \ :&& - -" Same again for visual mode; we use vnoremap rather than xnoremap to stay -" compatible with old Vims without doing :execute dances -vnoremap - \ & - \ :&& diff --git a/vim/config/swapfile.vim b/vim/config/swapfile.vim deleted file mode 100644 index de0598c2..00000000 --- a/vim/config/swapfile.vim +++ /dev/null @@ -1,15 +0,0 @@ -" Default to no swap files at all, in a way that even ancient/tiny Vims will -" understand; the auto_cache_dirs.vim plugin will take care of re-enabling -" this with a 'directory' setting -set noswapfile - -" Don't keep swap files from temporary directories or shared memory in case -" they're secrets -if has('autocmd') - augroup dotfiles_swap_skip - autocmd! - autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noswapfile - augroup END -endif diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim deleted file mode 100644 index a2186b1f..00000000 --- a/vim/config/syntax.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Options dependent on the syntax feature -if has('syntax') && !has('g:syntax_on') - - " Use syntax highlighting with 100 lines of context - silent! syntax enable - silent! syntax sync minlines=100 - - " Opinionated; if the author is using color at all, it will probably be with - " a dark background - set background=dark - - " The 'sahara' colorscheme only works in the GUI or with 256 colors - if has('gui_running') || &t_Co >= 256 - silent! colorscheme sahara - endif - -endif diff --git a/vim/config/terminal.vim b/vim/config/terminal.vim deleted file mode 100644 index 04ec5653..00000000 --- a/vim/config/terminal.vim +++ /dev/null @@ -1,33 +0,0 @@ -" Start paste mode with F10 to prevent console Vim from confusing a swathe of -" pre-formatted pasted text with actual keyboard input, and thereby attempting -" to indent it inappropriately. If unimpaired.vim is available, it's generally -" nicer to use yo or yO. -set nopaste -set pastetoggle= - -" Don't bother about checking whether Escape is being used as a means to enter -" a Meta-key combination, just register Escape immediately -if exists('+esckeys') - set noesckeys -endif - -" Don't bother drawing the screen while executing macros or other automated or -" scripted processes, just draw the screen as it is when the operation -" completes -set lazyredraw - -" Improve redrawing smoothness by assuming that my terminal is reasonably -" fast -set ttyfast - -" Never use any kind of bell, visual or not -set visualbell t_vb= - -" Require less than one second between keys for mappings to work correctly -set timeout -set timeoutlen=1000 - -" Require less than a twentieth of a second between keys for key codes to work -" correctly; I don't use Escape as a meta key anyway -set ttimeout -set ttimeoutlen=50 diff --git a/vim/config/undo.vim b/vim/config/undo.vim deleted file mode 100644 index b9186d6f..00000000 --- a/vim/config/undo.vim +++ /dev/null @@ -1,25 +0,0 @@ -" Rebind Ctrl-C in insert mode to undo the current insert operation -inoremap u - -" Keep screeds of undo history -set undolevels=2000 - -" 'undodir' and 'undofile' settings will be taken care of by the -" auto_cache_dirs.vim plugin if applicable/possible -if has('persistent_undo') - - " Turn off the option by default - set noundofile - - " Don't keep undo files from temporary directories or shared memory in case - " they're secrets - if has('autocmd') - augroup dotfiles_undo_skip - autocmd! - autocmd BufWritePre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noundofile - augroup END - endif - -endif diff --git a/vim/config/viminfo.vim b/vim/config/viminfo.vim deleted file mode 100644 index 9b01adc3..00000000 --- a/vim/config/viminfo.vim +++ /dev/null @@ -1,11 +0,0 @@ -" Don't keep .viminfo information for files in temporary directories or shared -" memory filesystems; this is because they're used as scratch spaces for tools -" like sudoedit(8) and pass(1) and hence could present a security problem -if has('viminfo') && has('autocmd') - augroup dotfiles_viminfo_skip - autocmd! - autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal viminfo= - augroup END -endif diff --git a/vim/config/visual.vim b/vim/config/visual.vim deleted file mode 100644 index 8bac2cf1..00000000 --- a/vim/config/visual.vim +++ /dev/null @@ -1,5 +0,0 @@ -" When in visual block mode, let me move the cursor anywhere in the buffer; -" don't restrict me only to regions with text -if has('virtualedit') - set virtualedit+=block -endif diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim deleted file mode 100644 index fd20e7e5..00000000 --- a/vim/config/whitespace.vim +++ /dev/null @@ -1,27 +0,0 @@ -" Adopt the indent of the last line on new lines -set autoindent - -" Use spaces instead of tabs -set expandtab - -" Indent with four spaces when an indent operation is used -set shiftwidth=4 - -" Insert four spaces when Tab is pressed -set softtabstop=4 - -" When indenting lines with < or >, round the indent to a multiple of -" 'shiftwidth', so even if the line is indented by one space it will indent -" up to 4 and down to 0, for example -set shiftround - -" Don't join lines with two spaces at the end of sentences; I don't two-space, -" despite the noble Steve Losh's exhortations -set nojoinspaces - -" \x strips trailing whitespace via a custom plugin -nmap x StripTrailingWhitespace - -" Insert blank lines above and below via a custom plugin -nmap [ PutBlankLinesAbove -nmap ] PutBlankLinesBelow diff --git a/vim/config/windows.vim b/vim/config/windows.vim deleted file mode 100644 index 88b38f8c..00000000 --- a/vim/config/windows.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Configuration for window features -if has('windows') - - " Show the status in a distinct bar above the command line only if there's - " more than one window on the screen or in the current tab - set laststatus=1 - - " Don't resize windows we're not splitting (Tmux-like; think Mondrian) - set noequalalways - - " New split windows appear below or to the right of the existing window, - " not above or to the left per the default - set splitbelow - if has('vertsplit') - set splitright - endif - - " Only show the tab bar if there's more than one tab - if exists('+showtabline') - set showtabline=1 - endif - - " Get rid of visually noisy folding characters - if has('folding') - let &fillchars = 'diff: ,fold: ,vert: ' - endif - -endif diff --git a/vim/config/wrap.vim b/vim/config/wrap.vim deleted file mode 100644 index a2d442fa..00000000 --- a/vim/config/wrap.vim +++ /dev/null @@ -1,40 +0,0 @@ -" Don't wrap by default, but use \w to toggle it on or off quickly -set nowrap -nnoremap - \ w - \ :set 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 -" column with @ symbols instead, which I don't find very helpful -set display=lastline - -" Clearly show when the start or end of the row does not correspond to the -" start and end of the line -set listchars+=precedes:<,extends:> - -" When wrapping, j and k should move by screen row, and not to the same -" column number in the previous logical line, which feels very clumsy and is -" seldom particularly helpful; you can use n| to jump to the nth column in a -" line anyway if you need to -nnoremap j gj -nnoremap k gk - -" Line break settings and mappings -if has('linebreak') - - " Break lines at word boundaries if possible - set linebreak - - " Precede continued lines with '...' - set showbreak=... - - " If we have the option, indent wrapped lines as much as the first line - if exists('+breakindent') - set breakindent - endif - - " \b toggles copy-pasteable linebreak settings - nmap b CopyLinebreakToggle - -endif diff --git a/vim/filetype.vim b/vim/filetype.vim index 2abe7831..3e244610 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -7,5 +7,247 @@ let g:did_load_filetypes = 1 " Use only the rules in ftdetect augroup filetypedetect autocmd! + + " AWK files + autocmd BufNewFile,BufRead + \ *.awk + \ setfiletype awk + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.*\<[gm]\?awk\>' + \ | setfiletype awk + \ | endif + " C files + autocmd BufNewFile,BufRead + \ *.c,*.h + \ setfiletype c + " C++ files + autocmd BufNewFile,BufRead + \ *.c++,*.cpp,*.cxx,*.hh + \ setfiletype cpp + " CSS files + autocmd BufNewFile,BufRead + \ *.css + \ setfiletype css + " CSV files + autocmd BufNewFile,BufRead + \ *.csv + \ setfiletype csv + " Diff and patch files + autocmd BufNewFile,BufRead + \ *.diff,*.patch,*.rej + \ setfiletype diff + " Git commit messages + autocmd BufNewFile,BufRead + \ COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG + \ setfiletype gitcommit + " Git config files + autocmd BufNewFile,BufRead + \ *.git*/config,.gitconfig,.gitmodules + \ setfiletype gitconfig + " GnuPG configuration files + autocmd BufNewFile,BufRead + \ *gnupg/options,*gnupg/gpg.conf + \ setfiletype gpg + " HTML files + autocmd BufNewFile,BufRead + \ *.html,*.htm + \ setfiletype html + " Java files + autocmd BufNewFile,BufRead + \ *.java,*.jav + \ setfiletype java + " JSON files + autocmd BufNewFile,BufRead + \ *.js + \ setfiletype javascript + " JSON files + autocmd BufNewFile,BufRead + \ *.json + \ setfiletype json + " Lex files + autocmd BufNewFile,BufRead + \ *.l,*.lex + \ setfiletype lex + " Lua files + autocmd BufNewFile,BufRead + \ *.lua + \ setfiletype lua + " m4 files + autocmd BufNewFile,BufRead + \ *.m4 + \ setfiletype m4 + " Mail messages + autocmd BufNewFile,BufRead + \ *.msg,mutt-*-*-* + \ setfiletype mail + " Makefiles + autocmd BufNewFile,BufRead + \ Makefile,makefile + \ setfiletype make + " Markdown files + autocmd BufNewFile,BufRead + \ *.markdown,*.md + \ setfiletype markdown + " Add automatic commands to detect .muttrc files + autocmd BufNewFile,BufRead + \ Muttrc,.muttrc,*muttrc.d/*.rc + \ setfiletype muttrc + " Perl 5 files + autocmd BufNewFile,BufRead + \ *.pl,*.pm,*.t,Makefile.PL + \ setfiletype perl + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.*\' + \ | setfiletype perl + \ | endif + " Perl 6 files + autocmd BufNewFile,BufRead + \ *.p6,*.pl6,*.pm6 + \ setfiletype perl6 + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.\' + \ | setfiletype perl6 + \ | endif + " PHP files + autocmd BufNewFile,BufRead + \ *.php + \ setfiletype php + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.\' + \ | setfiletype php + \ | endif + \ | if getline(1) =~? '\m^' + \ | setfiletype php + \ | endif + " Perl 5 POD files + autocmd BufNewFile,BufRead + \ *.pod + \ setfiletype pod + " Perl 6 POD files + autocmd BufNewFile,BufRead + \ *.pod6 + \ setfiletype pod6 + " Python files + autocmd BufNewFile,BufRead + \ *.py + \ setfiletype python + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '\m^#!.*\' + \ | setfiletype python + \ | endif + " Readline configuration file + autocmd BufNewFile,BufRead + \ .inputrc,inputrc + \ setfiletype readline + " Remind files + autocmd BufNewFile,BufRead + \ *.rem,*.remind,.reminders + \ setfiletype remind + " Bash filename patterns + autocmd BufNewFile,BufRead + \ *.bash, + \.bash_aliases, + \.bash_logout, + \.bash_profile, + \.bashrc, + \bash-fc-*, + \bash_profile, + \bashrc + \ let b:is_bash = 1 + \ | setfiletype sh + " Korn shell filename patterns + autocmd BufNewFile,BufRead + \ *.ksh, + \.kshrc, + \kshrc + \ let b:is_kornshell = 1 + \ | setfiletype sh + " POSIX/Bourne shell filename patterns + autocmd BufNewFile,BufRead + \ *.sh, + \.profile, + \.shinit, + \.shrc, + \.xinitrc, + \/etc/default/*, + \configure, + \profile, + \shinit, + \shrc, + \xinitrc + \ let b:is_posix = 1 + \ | setfiletype sh + " If this file has a shebang, and we haven't already decided it's Bash or + " Korn shell, use the shebang to decide + autocmd BufNewFile,BufRead + \ * + \ if !exists('b:is_bash') && !exists('b:is_kornshell') + \ | if getline(1) =~# '\m^#!.*\' + \ | let b:is_bash = 1 + \ | setfiletype sh + \ | elseif getline(1) =~# '\m^#!.*\' + \ | let b:is_ksh = 1 + \ | setfiletype sh + \ | elseif getline(1) =~# '\m^#!.*\' + \ | let b:is_posix = 1 + \ | setfiletype sh + \ | endif + \ | endif + " tmux configuration files + autocmd BufNewFile,BufRead + \ .tmux.conf,tmux.conf + \ setfiletype tmux + " roff files + autocmd BufNewFile,BufRead + \ *.[1-9],*.[1-9]df + \ setfiletype nroff + " Tab-separated (TSV) files + autocmd BufNewFile,BufRead + \ *.tsv + \ setfiletype tsv + " VimL files + autocmd BufNewFile,BufRead + \ *.vim,vimrc,*[._]vimrc,exrc,*[._]exrc + \ setfiletype vim + " .viminfo files + autocmd BufNewFile,BufRead + \ .viminfo + \ setfiletype viminfo + " Add automatic commands to find Xresources subfiles + autocmd BufNewFile,BufRead + \ .Xresources,*/.Xresources.d/* + \ setfiletype xdefaults + " XHTML files + autocmd BufNewFile,BufRead + \ *.xhtml,*.xht + \ setfiletype xhtml + " XML files + autocmd BufNewFile,BufRead + \ *.xml + \ setfiletype xml + " Yacc files + autocmd BufNewFile,BufRead + \ *.y,*.yy + \ setfiletype yacc + " YAML files + autocmd BufNewFile,BufRead + \ *.yaml + \ setfiletype yaml + " Z shell files + autocmd BufNewFile,BufRead + \ *.zsh,.zprofile,zprofile,.zshrc,zshrc + \ setfiletype zsh + autocmd BufNewFile,BufRead + \ * + \ if getline(1) =~# '^#!.*\' + \ | setfiletype zsh + \ | endif + runtime! ftdetect/*.vim augroup END + diff --git a/vim/ftdetect/awk.vim b/vim/ftdetect/awk.vim deleted file mode 100644 index 9965235e..00000000 --- a/vim/ftdetect/awk.vim +++ /dev/null @@ -1,9 +0,0 @@ -" AWK files -autocmd BufNewFile,BufRead - \ *.awk - \ setfiletype awk -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\<[gm]\?awk\>' - \ | setfiletype awk - \ | endif diff --git a/vim/ftdetect/c.vim b/vim/ftdetect/c.vim deleted file mode 100644 index 77a73cb6..00000000 --- a/vim/ftdetect/c.vim +++ /dev/null @@ -1,4 +0,0 @@ -" C files -autocmd BufNewFile,BufRead - \ *.c,*.h - \ setfiletype c diff --git a/vim/ftdetect/cpp.vim b/vim/ftdetect/cpp.vim deleted file mode 100644 index 71dc59e5..00000000 --- a/vim/ftdetect/cpp.vim +++ /dev/null @@ -1,4 +0,0 @@ -" C++ files -autocmd BufNewFile,BufRead - \ *.c++,*.cpp,*.cxx,*.hh - \ setfiletype cpp diff --git a/vim/ftdetect/css.vim b/vim/ftdetect/css.vim deleted file mode 100644 index bd98aa8e..00000000 --- a/vim/ftdetect/css.vim +++ /dev/null @@ -1,4 +0,0 @@ -" CSS files -autocmd BufNewFile,BufRead - \ *.css - \ setfiletype css diff --git a/vim/ftdetect/csv.vim b/vim/ftdetect/csv.vim deleted file mode 100644 index 33468496..00000000 --- a/vim/ftdetect/csv.vim +++ /dev/null @@ -1,4 +0,0 @@ -" CSV files -autocmd BufNewFile,BufRead - \ *.csv - \ setfiletype csv diff --git a/vim/ftdetect/diff.vim b/vim/ftdetect/diff.vim deleted file mode 100644 index d19fc450..00000000 --- a/vim/ftdetect/diff.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Diff and patch files -autocmd BufNewFile,BufRead - \ *.diff,*.patch,*.rej - \ setfiletype diff diff --git a/vim/ftdetect/gitcommit.vim b/vim/ftdetect/gitcommit.vim deleted file mode 100644 index 1c21544a..00000000 --- a/vim/ftdetect/gitcommit.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Git commit messages -autocmd BufNewFile,BufRead - \ COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG - \ setfiletype gitcommit diff --git a/vim/ftdetect/gitconfig.vim b/vim/ftdetect/gitconfig.vim deleted file mode 100644 index 780e89b0..00000000 --- a/vim/ftdetect/gitconfig.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Git config files -autocmd BufNewFile,BufRead - \ *.git*/config,.gitconfig,.gitmodules - \ setfiletype gitconfig diff --git a/vim/ftdetect/gpg.vim b/vim/ftdetect/gpg.vim deleted file mode 100644 index ea6ec2f6..00000000 --- a/vim/ftdetect/gpg.vim +++ /dev/null @@ -1,4 +0,0 @@ -" GnuPG configuration files -autocmd BufNewFile,BufRead - \ *gnupg/options,*gnupg/gpg.conf - \ setfiletype gpg diff --git a/vim/ftdetect/html.vim b/vim/ftdetect/html.vim deleted file mode 100644 index f8ab7ac5..00000000 --- a/vim/ftdetect/html.vim +++ /dev/null @@ -1,4 +0,0 @@ -" HTML files -autocmd BufNewFile,BufRead - \ *.html,*.htm - \ setfiletype html diff --git a/vim/ftdetect/java.vim b/vim/ftdetect/java.vim deleted file mode 100644 index 101816ea..00000000 --- a/vim/ftdetect/java.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Java files -autocmd BufNewFile,BufRead - \ *.java,*.jav - \ setfiletype java diff --git a/vim/ftdetect/javascript.vim b/vim/ftdetect/javascript.vim deleted file mode 100644 index 6f129960..00000000 --- a/vim/ftdetect/javascript.vim +++ /dev/null @@ -1,4 +0,0 @@ -" JSON files -autocmd BufNewFile,BufRead - \ *.js - \ setfiletype javascript diff --git a/vim/ftdetect/json.vim b/vim/ftdetect/json.vim deleted file mode 100644 index fd27c845..00000000 --- a/vim/ftdetect/json.vim +++ /dev/null @@ -1,4 +0,0 @@ -" JSON files -autocmd BufNewFile,BufRead - \ *.json - \ setfiletype json diff --git a/vim/ftdetect/lex.vim b/vim/ftdetect/lex.vim deleted file mode 100644 index 23118468..00000000 --- a/vim/ftdetect/lex.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Lex files -autocmd BufNewFile,BufRead - \ *.l,*.lex - \ setfiletype lex diff --git a/vim/ftdetect/lua.vim b/vim/ftdetect/lua.vim deleted file mode 100644 index d6c635a0..00000000 --- a/vim/ftdetect/lua.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Lua files -autocmd BufNewFile,BufRead - \ *.lua - \ setfiletype lua diff --git a/vim/ftdetect/m4.vim b/vim/ftdetect/m4.vim deleted file mode 100644 index c7d97e80..00000000 --- a/vim/ftdetect/m4.vim +++ /dev/null @@ -1,4 +0,0 @@ -" m4 files -autocmd BufNewFile,BufRead - \ *.m4 - \ setfiletype m4 diff --git a/vim/ftdetect/mail.vim b/vim/ftdetect/mail.vim deleted file mode 100644 index 62113230..00000000 --- a/vim/ftdetect/mail.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Mail messages -autocmd BufNewFile,BufRead - \ *.msg,mutt-*-*-* - \ setfiletype mail diff --git a/vim/ftdetect/make.vim b/vim/ftdetect/make.vim deleted file mode 100644 index 0ce0514b..00000000 --- a/vim/ftdetect/make.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Makefiles -autocmd BufNewFile,BufRead - \ Makefile,makefile - \ setfiletype make diff --git a/vim/ftdetect/markdown.vim b/vim/ftdetect/markdown.vim deleted file mode 100644 index 21ff2dcb..00000000 --- a/vim/ftdetect/markdown.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Markdown files -autocmd BufNewFile,BufRead - \ *.markdown,*.md - \ setfiletype markdown diff --git a/vim/ftdetect/muttrc.vim b/vim/ftdetect/muttrc.vim deleted file mode 100644 index 48468b30..00000000 --- a/vim/ftdetect/muttrc.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Add automatic commands to detect .muttrc files -autocmd BufNewFile,BufRead - \ Muttrc,.muttrc,*muttrc.d/*.rc - \ setfiletype muttrc diff --git a/vim/ftdetect/perl.vim b/vim/ftdetect/perl.vim deleted file mode 100644 index 571e4f58..00000000 --- a/vim/ftdetect/perl.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Perl 5 files -autocmd BufNewFile,BufRead - \ *.pl,*.pm,*.t,Makefile.PL - \ setfiletype perl -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\' - \ | setfiletype perl - \ | endif diff --git a/vim/ftdetect/perl6.vim b/vim/ftdetect/perl6.vim deleted file mode 100644 index 67e62c7c..00000000 --- a/vim/ftdetect/perl6.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Perl 6 files -autocmd BufNewFile,BufRead - \ *.p6,*.pl6,*.pm6 - \ setfiletype perl6 -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.\' - \ | setfiletype perl6 - \ | endif diff --git a/vim/ftdetect/php.vim b/vim/ftdetect/php.vim deleted file mode 100644 index f57ba0e6..00000000 --- a/vim/ftdetect/php.vim +++ /dev/null @@ -1,12 +0,0 @@ -" PHP files -autocmd BufNewFile,BufRead - \ *.php - \ setfiletype php -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.\' - \ | setfiletype php - \ | endif - \ | if getline(1) =~? '\m^' - \ | setfiletype php - \ | endif diff --git a/vim/ftdetect/pod.vim b/vim/ftdetect/pod.vim deleted file mode 100644 index 6817b3b4..00000000 --- a/vim/ftdetect/pod.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Perl 5 POD files -autocmd BufNewFile,BufRead - \ *.pod - \ setfiletype pod diff --git a/vim/ftdetect/pod6.vim b/vim/ftdetect/pod6.vim deleted file mode 100644 index 4ae980a1..00000000 --- a/vim/ftdetect/pod6.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Perl 6 POD files -autocmd BufNewFile,BufRead - \ *.pod6 - \ setfiletype pod6 diff --git a/vim/ftdetect/python.vim b/vim/ftdetect/python.vim deleted file mode 100644 index 5c4a4a6f..00000000 --- a/vim/ftdetect/python.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Python files -autocmd BufNewFile,BufRead - \ *.py - \ setfiletype python -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\' - \ | setfiletype python - \ | endif diff --git a/vim/ftdetect/readline.vim b/vim/ftdetect/readline.vim deleted file mode 100644 index be2565c3..00000000 --- a/vim/ftdetect/readline.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Readline configuration file -autocmd BufNewFile,BufRead - \ .inputrc,inputrc - \ setfiletype readline diff --git a/vim/ftdetect/remind.vim b/vim/ftdetect/remind.vim deleted file mode 100644 index f153ad25..00000000 --- a/vim/ftdetect/remind.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Remind files -autocmd BufNewFile,BufRead - \ *.rem,*.remind,.reminders - \ setfiletype remind diff --git a/vim/ftdetect/sh.vim b/vim/ftdetect/sh.vim deleted file mode 100644 index 1427bc03..00000000 --- a/vim/ftdetect/sh.vim +++ /dev/null @@ -1,55 +0,0 @@ -" Shell script files; these are hard to detect accurately - -" Bash filename patterns -autocmd BufNewFile,BufRead - \ *.bash, - \.bash_aliases, - \.bash_logout, - \.bash_profile, - \.bashrc, - \bash-fc-*, - \bash_profile, - \bashrc - \ let b:is_bash = 1 - \ | setfiletype sh - -" Korn shell filename patterns -autocmd BufNewFile,BufRead - \ *.ksh, - \.kshrc, - \kshrc - \ let b:is_kornshell = 1 - \ | setfiletype sh - -" POSIX/Bourne shell filename patterns -autocmd BufNewFile,BufRead - \ *.sh, - \.profile, - \.shinit, - \.shrc, - \.xinitrc, - \/etc/default/*, - \configure, - \profile, - \shinit, - \shrc, - \xinitrc - \ let b:is_posix = 1 - \ | setfiletype sh - -" If this file has a shebang, and we haven't already decided it's Bash or -" Korn shell, use the shebang to decide -autocmd BufNewFile,BufRead - \ * - \ if !exists('b:is_bash') && !exists('b:is_kornshell') - \ | if getline(1) =~# '\m^#!.*\' - \ | let b:is_bash = 1 - \ | setfiletype sh - \ | elseif getline(1) =~# '\m^#!.*\' - \ | let b:is_ksh = 1 - \ | setfiletype sh - \ | elseif getline(1) =~# '\m^#!.*\' - \ | let b:is_posix = 1 - \ | setfiletype sh - \ | endif - \ | endif diff --git a/vim/ftdetect/tmux.vim b/vim/ftdetect/tmux.vim deleted file mode 100644 index 4a245586..00000000 --- a/vim/ftdetect/tmux.vim +++ /dev/null @@ -1,4 +0,0 @@ -" tmux configuration files -autocmd BufNewFile,BufRead - \ .tmux.conf,tmux.conf - \ setfiletype tmux diff --git a/vim/ftdetect/troff.vim b/vim/ftdetect/troff.vim deleted file mode 100644 index 4bd27f6a..00000000 --- a/vim/ftdetect/troff.vim +++ /dev/null @@ -1,4 +0,0 @@ -" roff files -autocmd BufNewFile,BufRead - \ *.[1-9],*.[1-9]df - \ setfiletype nroff diff --git a/vim/ftdetect/tsv.vim b/vim/ftdetect/tsv.vim deleted file mode 100644 index d6a0a71d..00000000 --- a/vim/ftdetect/tsv.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Tab-separated (TSV) files -autocmd BufNewFile,BufRead - \ *.tsv - \ setfiletype tsv diff --git a/vim/ftdetect/vim.vim b/vim/ftdetect/vim.vim deleted file mode 100644 index ca1c26c4..00000000 --- a/vim/ftdetect/vim.vim +++ /dev/null @@ -1,4 +0,0 @@ -" VimL files -autocmd BufNewFile,BufRead - \ *.vim,vimrc,*[._]vimrc,exrc,*[._]exrc - \ setfiletype vim diff --git a/vim/ftdetect/viminfo.vim b/vim/ftdetect/viminfo.vim deleted file mode 100644 index 31a8c704..00000000 --- a/vim/ftdetect/viminfo.vim +++ /dev/null @@ -1,4 +0,0 @@ -" .viminfo files -autocmd BufNewFile,BufRead - \ .viminfo - \ setfiletype viminfo diff --git a/vim/ftdetect/xdefaults.vim b/vim/ftdetect/xdefaults.vim deleted file mode 100644 index 896b2e32..00000000 --- a/vim/ftdetect/xdefaults.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Add automatic commands to find Xresources subfiles -autocmd BufNewFile,BufRead - \ .Xresources,*/.Xresources.d/* - \ setfiletype xdefaults diff --git a/vim/ftdetect/xhtml.vim b/vim/ftdetect/xhtml.vim deleted file mode 100644 index adfb1cb5..00000000 --- a/vim/ftdetect/xhtml.vim +++ /dev/null @@ -1,4 +0,0 @@ -" XHTML files -autocmd BufNewFile,BufRead - \ *.xhtml,*.xht - \ setfiletype xhtml diff --git a/vim/ftdetect/xml.vim b/vim/ftdetect/xml.vim deleted file mode 100644 index 7228e0f3..00000000 --- a/vim/ftdetect/xml.vim +++ /dev/null @@ -1,4 +0,0 @@ -" XML files -autocmd BufNewFile,BufRead - \ *.xml - \ setfiletype xml diff --git a/vim/ftdetect/yacc.vim b/vim/ftdetect/yacc.vim deleted file mode 100644 index e3cb5ee8..00000000 --- a/vim/ftdetect/yacc.vim +++ /dev/null @@ -1,4 +0,0 @@ -" Yacc files -autocmd BufNewFile,BufRead - \ *.y,*.yy - \ setfiletype yacc diff --git a/vim/ftdetect/yaml.vim b/vim/ftdetect/yaml.vim deleted file mode 100644 index 3bf32b53..00000000 --- a/vim/ftdetect/yaml.vim +++ /dev/null @@ -1,4 +0,0 @@ -" YAML files -autocmd BufNewFile,BufRead - \ *.yaml - \ setfiletype yaml diff --git a/vim/ftdetect/zsh.vim b/vim/ftdetect/zsh.vim deleted file mode 100644 index 08556361..00000000 --- a/vim/ftdetect/zsh.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Z shell files -autocmd BufNewFile,BufRead - \ *.zsh,.zprofile,zprofile,.zshrc,zshrc - \ setfiletype zsh -autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '^#!.*\' - \ | setfiletype zsh - \ | endif diff --git a/vim/vimrc b/vim/vimrc index 87f863a6..c4965d09 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -12,7 +12,571 @@ if has('eval') let g:maplocalleader = '_' endif -" Source all .vim files from ~/.vim/config +" Let me backspace over pretty much anything +set backspace= +" Allow backspacing over autoindent +set backspace+=indent +" Allow backspacing over line breaks +set backspace+=eol +" Allow backspacing over the start of the insert operation +set backspace+=start + +" Default to no backup files at all, in a way that even ancient/tiny Vims will +" understand; the auto_cache_dirs.vim plugin will take care of re-enabling +" this with a 'backupdir' setting +set nobackup +set nowritebackup + +" If backups are enabled, use a more explicit and familiar backup suffix +set backupext=.bak + +" Don't back up files in anything named */shm/; they might be password +" files +set backupskip+=*/shm/* + +" Allow jumping between windows and tabs to find an open instance of a given +" buffer with :sbuffer. +set switchbuf=useopen +if v:version >= 701 + set switchbuf+=usetab +endif + +" Cycle back and forth through buffers. +nnoremap + \ [b + \ :bprevious +nnoremap + \ ]b + \ :bnext + +" Keep plenty of command and search history, because disk space is cheap +set history=2000 + +" Always tell me the number of lines changed by a command +set report=0 + +" Command-line based features +if has('cmdline_info') + + " Show my current position in the status bar + set ruler + + " Show the keystrokes being entered in the screen + set showcmd + + " Show the mode we're using if not normal mode (e.g. --INSERT--) + set showmode + +endif + +" \d inserts the current local date from date(1) +nnoremap + \ d + \ :read !date +" \D inserts the current UTC date from date(1) +nnoremap + \ D + \ :read !date -u + +" \m in visual/select mode starts a mail message with the selected lines +vmap m MailMuttSelected +" \m in normal mode starts a mail message with the current line +nmap m MailMuttLine +" \M in normal mode starts a mail message with the whole buffer +nmap M MailMuttBuffer + +" Don't try to complete strings from included files, just use the strings in +" the open buffers; I'll open the file if I want to complete from it +set complete-=i + +" Configuration for the command completion feature; rather than merely cycling +" through possible completions with Tab, show them above the command line +if has('wildmenu') + + " Use the wild menu, both completing and showing all possible completions + " with a single Tab press, just as I've configured Bash to do + set wildmenu + set wildmode=list:longest + + " Don't complete certain files that I'm not likely to want to manipulate + " from within Vim: + if has('wildignore') + set wildignore+=*.a,*.o + set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png + set wildignore+=.DS_Store,.git,.hg,.svn + set wildignore+=*~,*.swp,*.tmp + endif + + " Complete files without case sensitivity, if the option is available + if exists('+wildignorecase') + set wildignorecase + endif + +endif + +" A few very important custom digraphs +if has('digraphs') + digraph ./ 8230 " Ellipsis (HORIZONTAL ELLIPSIS U+2026) + digraph %% 8984 " Mac command key (PLACE OF INTEREST SIGN U+2318) + digraph 8: 9731 " Snowman (SNOWMAN U+2603) +endif + +" Set up short message settings +set shortmess= +" (file 3 of 5) -> (3 of 5) +set shortmess+=f +" [Incomplete last line] -> [eol] +set shortmess+=i +" I donated to Uganda, thanks Bram +set shortmess+=I +" 999 lines, 888 characters -> 999L, 888C +set shortmess+=l +" [Modified] -> [+] +set shortmess+=m +" [New File] -> [New] +set shortmess+=n +" Don't stack file writing messages +set shortmess+=o +" Don't stack file reading messages +set shortmess+=O +" [readonly] -> [RO] +set shortmess+=r +" Truncate file message at start if too long +set shortmess+=t +" Truncate other message in midle if too long +set shortmess+=T +" written -> [w], appended -> [a] +set shortmess+=w +" [dos format] -> [dos] +set shortmess+=x + +" Don't show whitespace characters or end-of-line characters visually by +" default, but make \l toggle between them +set nolist +nnoremap + \ l + \ :set list! list? + +" Don't show line numbers by default, but \n toggles them +set nonumber +nnoremap + \ n + \ :set number! number? + +" Disable most core plugin stuff that I don't use; after/plugin/dist.vim +" clears these variables later +if has('eval') + + " 2html.vim is often useful, so keep that + " matchparen.vim I use constantly + + " I handle versioning plugins manually, and have never used .vba + let g:loaded_getscriptPlugin = 1 + let g:loaded_vimballPlugin = 1 + + " This is what grep, sed, Awk, and Perl are for + let g:loaded_logiPat = 1 + + " ^Z, my dudes + let g:loaded_netrwPlugin = 1 + + " Vim servers? What is this, Emacs? + let g:loaded_rrhelper = 1 + + " System dictionaries plus custom per-machine spell files are fine + let g:loaded_spellfile_plugin = 1 + + " If I want to read a file or a file archived within it I'll decompress or + " unarchive it myself; a text editor should not do this + let g:loaded_gzip = 1 + let g:loaded_tarPlugin = 1 + let g:loaded_zipPlugin = 1 + +endif + +" Load plugins for file types +if has('autocmd') + filetype plugin indent on +endif + +" Bind \p to show filetype +nnoremap + \ p + \ :set filetype? + +" Use UTF-8 by default wherever possible +if has('multi_byte') + set encoding=utf-8 +endif + +" Use all ancestors of current directory for :find +if has('file_in_path') + set path=** +endif + +" If the Vim buffer for a file doesn't have any changes and Vim detects the +" file has been altered, quietly update it +set autoread + +" Save a file automatically if I change buffers or perform operations with the +" argument list; this is particularly helpful for me as I don't use 'hidden' +set autowrite + +" Don't use modelines at all, they're apparently potential security problems +" and I've never used them anyway +set nomodeline + +" I really like ZZ and ZQ, so I wrote a couple more mappings; ZW forces a +" write of the current buffer, but doesn't quit, and ZA forces a write of all +" buffers but doesn't quit +nnoremap + \ ZW + \ :write! +nnoremap + \ ZA + \ :wall! + +" Don't assume a number with a leading zero is octal; it's far more likely a +" zero-padded decimal, so increment and decrement with ^A and ^X on that basis +set nrformats-=octal + +" Try to set the 'j' flag for 'formatoptions', to automatically delete comment +" leaders when joining lines +silent! set formatoptions+=j + +" Show the current formatoptions at a glance +nnoremap + \ f + \ :setlocal formatoptions? + +" Use toggle_option_flag.vim plugin to bind quick toggle actions for some +" 'formatoptions' flags +if has('user_commands') + + " a: Reformat paragraphs to 'textwidth' on all insert or delete operations + nnoremap + \ a + \ :ToggleOptionFlagLocal formatoptions a + + " c: Reformat comments to 'textwidth' + nnoremap + \ c + \ :ToggleOptionFlagLocal formatoptions c + + " j: Delete comment leaders when joining lines + nnoremap + \ j + \ :ToggleOptionFlagLocal formatoptions j + + " t: Reformat non-comment text to 'textwidth' + nnoremap + \ t + \ :ToggleOptionFlagLocal formatoptions t + +endif + +" Match all forms of brackets in pairs (including angle brackets) +set matchpairs+=<:> + +" Fedora's default environment adds a few auto commands that I don't like, +" including the 'return to previous position in buffer' one; fortunately +" they're nice enough to group the commands, so I can just clear them +if has('autocmd') + augroup fedora + autocmd! + augroup END +endif + +" Add the packaged version of matchit.vim included in the distribution, if +" possible; plugin/macros.vim loads this for older Vims +if has('packages') + silent! packadd! matchit +endif + +" Change and delete with C and D both cut off the remainder of the line from +" the cursor, but Y yanks the whole line, which is inconsistent (and can be +" done with yy anyway); this fixes it so it only yanks the rest of the line +nnoremap Y y$ + +" Allow the cursor to get to the top or bottom of the screen before scrolling +" vertically, but set a reasonably wide gutter for scrolling horizontally; no +" particular reason, just suits me better +set scrolloff=0 +set sidescrolloff=16 + +" Rebind in normal mode as a lazy scroll +nnoremap + +" Some special settings for searching, if available +if has('extra_search') + + " Searching as I enter my pattern, \i toggles this + set incsearch + nnoremap + \ i + \ :set incsearch! incsearch? + + " Highlight search results, \h toggles this + set hlsearch + nnoremap + \ h + \ :set hlsearch! hlsearch? + + " Pressing ^L will clear highlighting until the next search-related + " operation; quite good because the highlighting gets distracting after + " you've found what you wanted + nnoremap + \ + \ :nohlsearch + +endif + +" Configure spell checking features, if available +if has('spell') + + " Don't check spelling by default, but bind \s to toggle this + set nospell + 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? + +endif + +" Preserve the flags for a pattern when repeating a substitution with &; I +" don't really understand why this isn't a default, but there it is +nnoremap + \ & + \ :&& + +" Same again for visual mode; we use vnoremap rather than xnoremap to stay +" compatible with old Vims without doing :execute dances +vnoremap + \ & + \ :&& + +" Default to no swap files at all, in a way that even ancient/tiny Vims will +" understand; the auto_cache_dirs.vim plugin will take care of re-enabling +" this with a 'directory' setting +set noswapfile + +" Don't keep swap files from temporary directories or shared memory in case +" they're secrets +if has('autocmd') + augroup dotfiles_swap_skip + autocmd! + autocmd BufNewFile,BufReadPre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal noswapfile + augroup END +endif + +" Options dependent on the syntax feature +if has('syntax') && !has('g:syntax_on') + + " Use syntax highlighting with 100 lines of context + silent! syntax enable + silent! syntax sync minlines=100 + + " Opinionated; if the author is using color at all, it will probably be with + " a dark background + set background=dark + + " The 'sahara' colorscheme only works in the GUI or with 256 colors + if has('gui_running') || &t_Co >= 256 + silent! colorscheme sahara + endif + +endif + +" Start paste mode with F10 to prevent console Vim from confusing a swathe of +" pre-formatted pasted text with actual keyboard input, and thereby attempting +" to indent it inappropriately. If unimpaired.vim is available, it's generally +" nicer to use yo or yO. +set nopaste +set pastetoggle= + +" Don't bother about checking whether Escape is being used as a means to enter +" a Meta-key combination, just register Escape immediately +if exists('+esckeys') + set noesckeys +endif + +" Don't bother drawing the screen while executing macros or other automated or +" scripted processes, just draw the screen as it is when the operation +" completes +set lazyredraw + +" Improve redrawing smoothness by assuming that my terminal is reasonably +" fast +set ttyfast + +" Never use any kind of bell, visual or not +set visualbell t_vb= + +" Require less than one second between keys for mappings to work correctly +set timeout +set timeoutlen=1000 + +" Require less than a twentieth of a second between keys for key codes to work +" correctly; I don't use Escape as a meta key anyway +set ttimeout +set ttimeoutlen=50 + +" Rebind Ctrl-C in insert mode to undo the current insert operation +inoremap u + +" Keep screeds of undo history +set undolevels=2000 + +" 'undodir' and 'undofile' settings will be taken care of by the +" auto_cache_dirs.vim plugin if applicable/possible +if has('persistent_undo') + + " Turn off the option by default + set noundofile + + " Don't keep undo files from temporary directories or shared memory in case + " they're secrets + if has('autocmd') + augroup dotfiles_undo_skip + autocmd! + autocmd BufWritePre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal noundofile + augroup END + endif + +endif + +" Don't keep .viminfo information for files in temporary directories or shared +" memory filesystems; this is because they're used as scratch spaces for tools +" like sudoedit(8) and pass(1) and hence could present a security problem +if has('viminfo') && has('autocmd') + augroup dotfiles_viminfo_skip + autocmd! + autocmd BufNewFile,BufReadPre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal viminfo= + augroup END +endif + +" When in visual block mode, let me move the cursor anywhere in the buffer; +" don't restrict me only to regions with text +if has('virtualedit') + set virtualedit+=block +endif + +" Adopt the indent of the last line on new lines +set autoindent + +" Use spaces instead of tabs +set expandtab + +" Indent with four spaces when an indent operation is used +set shiftwidth=4 + +" Insert four spaces when Tab is pressed +set softtabstop=4 + +" When indenting lines with < or >, round the indent to a multiple of +" 'shiftwidth', so even if the line is indented by one space it will indent +" up to 4 and down to 0, for example +set shiftround + +" Don't join lines with two spaces at the end of sentences; I don't two-space, +" despite the noble Steve Losh's exhortations +set nojoinspaces + +" \x strips trailing whitespace via a custom plugin +nmap x StripTrailingWhitespace + +" Insert blank lines above and below via a custom plugin +nmap [ PutBlankLinesAbove +nmap ] PutBlankLinesBelow + +" Configuration for window features +if has('windows') + + " Show the status in a distinct bar above the command line only if there's + " more than one window on the screen or in the current tab + set laststatus=1 + + " Don't resize windows we're not splitting (Tmux-like; think Mondrian) + set noequalalways + + " New split windows appear below or to the right of the existing window, + " not above or to the left per the default + set splitbelow + if has('vertsplit') + set splitright + endif + + " Only show the tab bar if there's more than one tab + if exists('+showtabline') + set showtabline=1 + endif + + " Get rid of visually noisy folding characters + if has('folding') + let &fillchars = 'diff: ,fold: ,vert: ' + endif + +endif + +" Don't wrap by default, but use \w to toggle it on or off quickly +set nowrap +nnoremap + \ w + \ :set 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 +" column with @ symbols instead, which I don't find very helpful +set display=lastline + +" Clearly show when the start or end of the row does not correspond to the +" start and end of the line +set listchars+=precedes:<,extends:> + +" When wrapping, j and k should move by screen row, and not to the same +" column number in the previous logical line, which feels very clumsy and is +" seldom particularly helpful; you can use n| to jump to the nth column in a +" line anyway if you need to +nnoremap j gj +nnoremap k gk + +" Line break settings and mappings +if has('linebreak') + + " Break lines at word boundaries if possible + set linebreak + + " Precede continued lines with '...' + set showbreak=... + + " If we have the option, indent wrapped lines as much as the first line + if exists('+breakindent') + set breakindent + endif + + " \b toggles copy-pasteable linebreak settings + nmap b CopyLinebreakToggle + +endif + +" Source all .vim files from ~/.vim/config, which may override any of the +" above runtime! config/*.vim " If we're in compatible mode, put 'cpoptions' back the way we found it at the -- cgit v1.2.3 From d5b19040fc69f0784f375a7573b3a81decbb2cf5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 15:33:15 +1200 Subject: Refactor vim/vimrc Rearranging order where logical, adjust comments, remove line continuation guard and just join all relevant lines. --- vim/vimrc | 299 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 127 insertions(+), 172 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index c4965d09..db6e7f47 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,9 +1,19 @@ +" Tom Ryder (tejr)'s vimrc: +" +" This file is not truly self-contained; it should run without errors on its +" own without the accompanying plugins to which it refers near the end of this +" file, but you'll get errors for some of the leader maps, for example. + " If we're in compatible mode, ensure that the 'C' option that disallows line -" continuations is stripped out, as they're heavily used in this -" configuration for readability; we'll put it back later -if &compatible - let s:cpoptions_save = &cpoptions - set cpoptions-=C +" continuations is stripped out, as they're heavily used in this configuration +" for readability; we'll put it back later. Yes, this is necessary, for +" example if this file is :sourced while &compatible, or if Vim is invoked +" under its other name--we are out there, we ex(1)ist! + +" Use UTF-8 by default wherever possible +if has('multi_byte') + set encoding=utf-8 + scriptencoding utf-8 endif " Use different keys for global and local leaders @@ -12,6 +22,11 @@ if has('eval') let g:maplocalleader = '_' endif +" Load filetype settings, including filetype plugins and indent settings +if has('autocmd') + filetype plugin indent on +endif + " Let me backspace over pretty much anything set backspace= " Allow backspacing over autoindent @@ -42,12 +57,8 @@ if v:version >= 701 endif " Cycle back and forth through buffers. -nnoremap - \ [b - \ :bprevious -nnoremap - \ ]b - \ :bnext +nnoremap [b :bprevious +nnoremap ]b :bnext " Keep plenty of command and search history, because disk space is cheap set history=2000 @@ -70,20 +81,10 @@ if has('cmdline_info') endif " \d inserts the current local date from date(1) -nnoremap - \ d - \ :read !date -" \D inserts the current UTC date from date(1) -nnoremap - \ D - \ :read !date -u +nnoremap d :read !date -" \m in visual/select mode starts a mail message with the selected lines -vmap m MailMuttSelected -" \m in normal mode starts a mail message with the current line -nmap m MailMuttLine -" \M in normal mode starts a mail message with the whole buffer -nmap M MailMuttBuffer +" \D inserts the current UTC date from date(1) +nnoremap D :read !date -u " Don't try to complete strings from included files, just use the strings in " the open buffers; I'll open the file if I want to complete from it @@ -153,56 +154,14 @@ set shortmess+=x " Don't show whitespace characters or end-of-line characters visually by " default, but make \l toggle between them set nolist -nnoremap - \ l - \ :set list! list? +nnoremap l :set list! list? " Don't show line numbers by default, but \n toggles them set nonumber -nnoremap - \ n - \ :set number! number? - -" Disable most core plugin stuff that I don't use; after/plugin/dist.vim -" clears these variables later -if has('eval') - - " 2html.vim is often useful, so keep that - " matchparen.vim I use constantly - - " I handle versioning plugins manually, and have never used .vba - let g:loaded_getscriptPlugin = 1 - let g:loaded_vimballPlugin = 1 - - " This is what grep, sed, Awk, and Perl are for - let g:loaded_logiPat = 1 - - " ^Z, my dudes - let g:loaded_netrwPlugin = 1 - - " Vim servers? What is this, Emacs? - let g:loaded_rrhelper = 1 - - " System dictionaries plus custom per-machine spell files are fine - let g:loaded_spellfile_plugin = 1 - - " If I want to read a file or a file archived within it I'll decompress or - " unarchive it myself; a text editor should not do this - let g:loaded_gzip = 1 - let g:loaded_tarPlugin = 1 - let g:loaded_zipPlugin = 1 - -endif - -" Load plugins for file types -if has('autocmd') - filetype plugin indent on -endif +nnoremap n :set number! number? " Bind \p to show filetype -nnoremap - \ p - \ :set filetype? +nnoremap p :set filetype? " Use UTF-8 by default wherever possible if has('multi_byte') @@ -229,12 +188,8 @@ set nomodeline " I really like ZZ and ZQ, so I wrote a couple more mappings; ZW forces a " write of the current buffer, but doesn't quit, and ZA forces a write of all " buffers but doesn't quit -nnoremap - \ ZW - \ :write! -nnoremap - \ ZA - \ :wall! +nnoremap ZW :write! +nnoremap ZA :wall! " Don't assume a number with a leading zero is octal; it's far more likely a " zero-padded decimal, so increment and decrement with ^A and ^X on that basis @@ -244,55 +199,12 @@ set nrformats-=octal " leaders when joining lines silent! set formatoptions+=j -" Show the current formatoptions at a glance -nnoremap - \ f - \ :setlocal formatoptions? - -" Use toggle_option_flag.vim plugin to bind quick toggle actions for some -" 'formatoptions' flags -if has('user_commands') - - " a: Reformat paragraphs to 'textwidth' on all insert or delete operations - nnoremap - \ a - \ :ToggleOptionFlagLocal formatoptions a - - " c: Reformat comments to 'textwidth' - nnoremap - \ c - \ :ToggleOptionFlagLocal formatoptions c - - " j: Delete comment leaders when joining lines - nnoremap - \ j - \ :ToggleOptionFlagLocal formatoptions j - - " t: Reformat non-comment text to 'textwidth' - nnoremap - \ t - \ :ToggleOptionFlagLocal formatoptions t - -endif +" \f shows the current formatoptions at a glance +nnoremap f :setlocal formatoptions? " Match all forms of brackets in pairs (including angle brackets) set matchpairs+=<:> -" Fedora's default environment adds a few auto commands that I don't like, -" including the 'return to previous position in buffer' one; fortunately -" they're nice enough to group the commands, so I can just clear them -if has('autocmd') - augroup fedora - autocmd! - augroup END -endif - -" Add the packaged version of matchit.vim included in the distribution, if -" possible; plugin/macros.vim loads this for older Vims -if has('packages') - silent! packadd! matchit -endif - " Change and delete with C and D both cut off the remainder of the line from " the cursor, but Y yanks the whole line, which is inconsistent (and can be " done with yy anyway); this fixes it so it only yanks the rest of the line @@ -312,22 +224,16 @@ if has('extra_search') " Searching as I enter my pattern, \i toggles this set incsearch - nnoremap - \ i - \ :set incsearch! incsearch? + nnoremap i :set incsearch! incsearch? " Highlight search results, \h toggles this set hlsearch - nnoremap - \ h - \ :set hlsearch! hlsearch? + nnoremap h :set hlsearch! hlsearch? " Pressing ^L will clear highlighting until the next search-related " operation; quite good because the highlighting gets distracting after " you've found what you wanted - nnoremap - \ - \ :nohlsearch + nnoremap :nohlsearch endif @@ -336,34 +242,24 @@ 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 " Preserve the flags for a pattern when repeating a substitution with &; I " don't really understand why this isn't a default, but there it is -nnoremap - \ & - \ :&& +nnoremap & :&& " Same again for visual mode; we use vnoremap rather than xnoremap to stay " compatible with old Vims without doing :execute dances -vnoremap - \ & - \ :&& +vnoremap & :&& " Default to no swap files at all, in a way that even ancient/tiny Vims will " understand; the auto_cache_dirs.vim plugin will take care of re-enabling @@ -375,9 +271,11 @@ set noswapfile if has('autocmd') augroup dotfiles_swap_skip autocmd! - autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noswapfile + autocmd BufNewFile,BufReadPre /tmp/* setlocal noswapfile + autocmd BufNewFile,BufReadPre $TMPDIR/* setlocal noswapfile + autocmd BufNewFile,BufReadPre $TMP/* setlocal noswapfile + autocmd BufNewFile,BufReadPre $TEMP/* setlocal noswapfile + autocmd BufNewFile,BufReadPre */shm/* setlocal noswapfile augroup END endif @@ -451,9 +349,11 @@ if has('persistent_undo') if has('autocmd') augroup dotfiles_undo_skip autocmd! - autocmd BufWritePre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noundofile + autocmd BufWritePre /tmp/* setlocal noundofile + autocmd BufWritePre $TMPDIR/* setlocal noundofile + autocmd BufWritePre $TMP/* setlocal noundofile + autocmd BufWritePre $TEMP/* setlocal noundofile + autocmd BufWritePre */shm/* setlocal noundofile augroup END endif @@ -465,9 +365,11 @@ endif if has('viminfo') && has('autocmd') augroup dotfiles_viminfo_skip autocmd! - autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal viminfo= + autocmd BufNewFile,BufReadPre /tmp/* setlocal viminfo= + autocmd BufNewFile,BufReadPre $TMPDIR/* setlocal viminfo= + autocmd BufNewFile,BufReadPre $TMP/* setlocal viminfo= + autocmd BufNewFile,BufReadPre $TEMP/* setlocal viminfo= + autocmd BufNewFile,BufReadPre */shm/* setlocal viminfo= augroup END endif @@ -498,13 +400,6 @@ set shiftround " despite the noble Steve Losh's exhortations set nojoinspaces -" \x strips trailing whitespace via a custom plugin -nmap x StripTrailingWhitespace - -" Insert blank lines above and below via a custom plugin -nmap [ PutBlankLinesAbove -nmap ] PutBlankLinesBelow - " Configuration for window features if has('windows') @@ -536,9 +431,7 @@ endif " Don't wrap by default, but use \w to toggle it on or off quickly set nowrap -nnoremap - \ w - \ :set wrap! wrap? +nnoremap w :set 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 @@ -570,18 +463,80 @@ if has('linebreak') set breakindent endif - " \b toggles copy-pasteable linebreak settings - nmap b CopyLinebreakToggle +endif + +" Disable most core plugin stuff that I don't use; after/plugin/dist.vim +" clears these variables later +if has('eval') + + " 2html.vim is often useful, so keep that + " matchparen.vim I use constantly + + " I handle versioning plugins manually, and have never used .vba + let g:loaded_getscriptPlugin = 1 + let g:loaded_vimballPlugin = 1 + + " This is what grep, sed, Awk, and Perl are for + let g:loaded_logiPat = 1 + + " ^Z, my dudes + let g:loaded_netrwPlugin = 1 + + " Vim servers? What is this, Emacs? + let g:loaded_rrhelper = 1 + + " System dictionaries plus custom per-machine spell files are fine + let g:loaded_spellfile_plugin = 1 + + " If I want to read a file or a file archived within it I'll decompress or + " unarchive it myself; a text editor should not do this + let g:loaded_gzip = 1 + let g:loaded_tarPlugin = 1 + let g:loaded_zipPlugin = 1 + +endif + +" Insert blank lines above and below via my custom unimpaired.vim rip +nmap [ PutBlankLinesAbove +nmap ] PutBlankLinesBelow + +" \b toggles copy-pasteable linebreak settings +nmap b CopyLinebreakToggle + +" \m in visual/select mode starts a mail message with the selected lines +vmap m MailMuttSelected +" \m in normal mode starts a mail message with the current line +nmap m MailMuttLine +" \M in normal mode starts a mail message with the whole buffer +nmap M MailMuttBuffer + +" \x strips trailing whitespace via a custom plugin +nmap x StripTrailingWhitespace + +" Use toggle_option_flag.vim plugin to bind quick toggle actions for some +" 'formatoptions' flags +if has('user_commands') + + " \a: Reformat paragraphs to 'textwidth' on all insert or delete operations + nnoremap a :ToggleOptionFlagLocal formatoptions a + + " \c: Reformat comments to 'textwidth' + nnoremap c :ToggleOptionFlagLocal formatoptions c + + " \j: Delete comment leaders when joining lines + nnoremap j :ToggleOptionFlagLocal formatoptions j + + " \t: Reformat non-comment text to 'textwidth' + nnoremap t :ToggleOptionFlagLocal formatoptions t endif +" Add the packaged version of matchit.vim included in the distribution, if +" possible; plugin/macros.vim loads this for older Vims +if has('packages') + silent! packadd! matchit +endif + " Source all .vim files from ~/.vim/config, which may override any of the " above runtime! config/*.vim - -" If we're in compatible mode, put 'cpoptions' back the way we found it at the -" start of this configuration, even though it's the current year -if exists('s:cpoptions_save') - let &cpoptions = s:cpoptions_save - unlet s:cpoptions_save -endif -- cgit v1.2.3 From b111f871d104bc36b9a46bfef06025b6c051769d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 15:38:27 +1200 Subject: Abbreviate and invert j/gj,k/gk mappings --- vim/vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index db6e7f47..01614231 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -442,12 +442,12 @@ set display=lastline " start and end of the line set listchars+=precedes:<,extends:> -" When wrapping, j and k should move by screen row, and not to the same -" column number in the previous logical line, which feels very clumsy and is -" seldom particularly helpful; you can use n| to jump to the nth column in a -" line anyway if you need to +" Swap the j/gj and k/gk command pairs so that we move by screen row, not +" buffer line, with j/k nnoremap j gj nnoremap k gk +nnoremap gj j +nnoremap gk k " Line break settings and mappings if has('linebreak') -- cgit v1.2.3 From 51be0dc9cc93686bdc45561dea4d9d050dea4137 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 15:39:07 +1200 Subject: Spacing adjustments --- vim/vimrc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 01614231..d6cdc7f3 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -82,7 +82,6 @@ endif " \d inserts the current local date from date(1) nnoremap d :read !date - " \D inserts the current UTC date from date(1) nnoremap D :read !date -u @@ -519,13 +518,10 @@ if has('user_commands') " \a: Reformat paragraphs to 'textwidth' on all insert or delete operations nnoremap a :ToggleOptionFlagLocal formatoptions a - " \c: Reformat comments to 'textwidth' nnoremap c :ToggleOptionFlagLocal formatoptions c - " \j: Delete comment leaders when joining lines nnoremap j :ToggleOptionFlagLocal formatoptions j - " \t: Reformat non-comment text to 'textwidth' nnoremap t :ToggleOptionFlagLocal formatoptions t -- cgit v1.2.3 From 5611cdf4c76981205f6a39c5179041c3ab45dbd2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 16:53:59 +1200 Subject: Factor out password redaction into new plugin --- .gitmodules | 3 +++ vim/bundle/redact_pass | 1 + vim/vimrc | 43 ------------------------------------------- 3 files changed, 4 insertions(+), 43 deletions(-) create mode 160000 vim/bundle/redact_pass diff --git a/.gitmodules b/.gitmodules index 212a4e52..82c358ff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,6 +23,9 @@ [submodule "vim/bundle/put_blank_lines"] path = vim/bundle/put_blank_lines url = https://sanctum.geek.nz/code/vim-put-blank-lines.git +[submodule "vim/bundle/redact_pass"] + path = vim/bundle/redact_pass + url = https://sanctum.geek.nz/code/vim-redact-pass.git [submodule "vim/bundle/strip_trailing_whitespace"] path = vim/bundle/strip_trailing_whitespace url = https://sanctum.geek.nz/code/vim-strip-trailing-whitespace.git diff --git a/vim/bundle/redact_pass b/vim/bundle/redact_pass new file mode 160000 index 00000000..97e019db --- /dev/null +++ b/vim/bundle/redact_pass @@ -0,0 +1 @@ +Subproject commit 97e019dbe8459d34108212e905b63142ac194108 diff --git a/vim/vimrc b/vim/vimrc index d6cdc7f3..70f72ed6 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -265,19 +265,6 @@ vnoremap & :&& " this with a 'directory' setting set noswapfile -" Don't keep swap files from temporary directories or shared memory in case -" they're secrets -if has('autocmd') - augroup dotfiles_swap_skip - autocmd! - autocmd BufNewFile,BufReadPre /tmp/* setlocal noswapfile - autocmd BufNewFile,BufReadPre $TMPDIR/* setlocal noswapfile - autocmd BufNewFile,BufReadPre $TMP/* setlocal noswapfile - autocmd BufNewFile,BufReadPre $TEMP/* setlocal noswapfile - autocmd BufNewFile,BufReadPre */shm/* setlocal noswapfile - augroup END -endif - " Options dependent on the syntax feature if has('syntax') && !has('g:syntax_on') @@ -339,37 +326,7 @@ set undolevels=2000 " 'undodir' and 'undofile' settings will be taken care of by the " auto_cache_dirs.vim plugin if applicable/possible if has('persistent_undo') - - " Turn off the option by default set noundofile - - " Don't keep undo files from temporary directories or shared memory in case - " they're secrets - if has('autocmd') - augroup dotfiles_undo_skip - autocmd! - autocmd BufWritePre /tmp/* setlocal noundofile - autocmd BufWritePre $TMPDIR/* setlocal noundofile - autocmd BufWritePre $TMP/* setlocal noundofile - autocmd BufWritePre $TEMP/* setlocal noundofile - autocmd BufWritePre */shm/* setlocal noundofile - augroup END - endif - -endif - -" Don't keep .viminfo information for files in temporary directories or shared -" memory filesystems; this is because they're used as scratch spaces for tools -" like sudoedit(8) and pass(1) and hence could present a security problem -if has('viminfo') && has('autocmd') - augroup dotfiles_viminfo_skip - autocmd! - autocmd BufNewFile,BufReadPre /tmp/* setlocal viminfo= - autocmd BufNewFile,BufReadPre $TMPDIR/* setlocal viminfo= - autocmd BufNewFile,BufReadPre $TMP/* setlocal viminfo= - autocmd BufNewFile,BufReadPre $TEMP/* setlocal viminfo= - autocmd BufNewFile,BufReadPre */shm/* setlocal viminfo= - augroup END endif " When in visual block mode, let me move the cursor anywhere in the buffer; -- cgit v1.2.3 From ce4527cca3d1aacde321fc3826decb2047df65cc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 17:24:37 +1200 Subject: Add custom scripts.vim Including adding sed support --- Makefile | 3 ++- vim/filetype.vim | 69 ++++++++++++++------------------------------------------ vim/scripts.vim | 52 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 53 deletions(-) create mode 100644 vim/scripts.vim diff --git a/Makefile b/Makefile index bb54b280..e5652913 100644 --- a/Makefile +++ b/Makefile @@ -494,6 +494,7 @@ install-vim: install-vim-after \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ + install-vim-filetype \ install-vim-ftplugin \ install-vim-indent @@ -540,7 +541,7 @@ install-vim-config: install-vim-filetype: cp -p -- vim/filetype.vim $(VIMDIR) - cp -p -- vim/script.vim $(VIMDIR) + cp -p -- vim/scripts.vim $(VIMDIR) install-vim-ftplugin: mkdir -p -- $(VIMDIR)/ftplugin diff --git a/vim/filetype.vim b/vim/filetype.vim index 3e244610..a76321a2 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -4,7 +4,7 @@ if exists('g:did_load_filetypes') endif let g:did_load_filetypes = 1 -" Use only the rules in ftdetect +" Use our own filetype detection rules augroup filetypedetect autocmd! @@ -12,11 +12,6 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ *.awk \ setfiletype awk - autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\<[gm]\?awk\>' - \ | setfiletype awk - \ | endif " C files autocmd BufNewFile,BufRead \ *.c,*.h @@ -97,32 +92,14 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ *.pl,*.pm,*.t,Makefile.PL \ setfiletype perl - autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\' - \ | setfiletype perl - \ | endif " Perl 6 files autocmd BufNewFile,BufRead \ *.p6,*.pl6,*.pm6 \ setfiletype perl6 - autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.\' - \ | setfiletype perl6 - \ | endif " PHP files autocmd BufNewFile,BufRead \ *.php \ setfiletype php - autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.\' - \ | setfiletype php - \ | endif - \ | if getline(1) =~? '\m^' - \ | setfiletype php - \ | endif " Perl 5 POD files autocmd BufNewFile,BufRead \ *.pod @@ -135,11 +112,6 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ *.py \ setfiletype python - autocmd BufNewFile,BufRead - \ * - \ if getline(1) =~# '\m^#!.*\' - \ | setfiletype python - \ | endif " Readline configuration file autocmd BufNewFile,BufRead \ .inputrc,inputrc @@ -148,7 +120,7 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ *.rem,*.remind,.reminders \ setfiletype remind - " Bash filename patterns + " Bash shell autocmd BufNewFile,BufRead \ *.bash, \.bash_aliases, @@ -160,14 +132,14 @@ augroup filetypedetect \bashrc \ let b:is_bash = 1 \ | setfiletype sh - " Korn shell filename patterns + " Korn shell autocmd BufNewFile,BufRead \ *.ksh, \.kshrc, \kshrc \ let b:is_kornshell = 1 \ | setfiletype sh - " POSIX/Bourne shell filename patterns + " POSIX/Bourne shell autocmd BufNewFile,BufRead \ *.sh, \.profile, @@ -182,22 +154,10 @@ augroup filetypedetect \xinitrc \ let b:is_posix = 1 \ | setfiletype sh - " If this file has a shebang, and we haven't already decided it's Bash or - " Korn shell, use the shebang to decide + " sed files autocmd BufNewFile,BufRead - \ * - \ if !exists('b:is_bash') && !exists('b:is_kornshell') - \ | if getline(1) =~# '\m^#!.*\' - \ | let b:is_bash = 1 - \ | setfiletype sh - \ | elseif getline(1) =~# '\m^#!.*\' - \ | let b:is_ksh = 1 - \ | setfiletype sh - \ | elseif getline(1) =~# '\m^#!.*\' - \ | let b:is_posix = 1 - \ | setfiletype sh - \ | endif - \ | endif + \ *.sed + \ setfiletype sed " tmux configuration files autocmd BufNewFile,BufRead \ .tmux.conf,tmux.conf @@ -242,12 +202,17 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ *.zsh,.zprofile,zprofile,.zshrc,zshrc \ setfiletype zsh - autocmd BufNewFile,BufRead + + " Load any extra rules in ftdetect directories + runtime! ftdetect/*.vim + + " If we still don't have a filetype, run the scripts.vim file that will + " examine actual file contents--but only the first one; don't load the + " system one at all + autocmd BufNewFile,BufRead,StdinReadPost \ * - \ if getline(1) =~# '^#!.*\' - \ | setfiletype zsh + \ if !did_filetype() + \ | runtime scripts.vim \ | endif - runtime! ftdetect/*.vim augroup END - diff --git a/vim/scripts.vim b/vim/scripts.vim new file mode 100644 index 00000000..1d4e1eb1 --- /dev/null +++ b/vim/scripts.vim @@ -0,0 +1,52 @@ +" Try to determine filetype by examining actual file contents; read as little +" as possible, and try to keep things simple and specific to what I typically +" work on, and will expect to be syntax-highlighted. + +" Read first line +let s:line = getline(1) + +" If it's not a shebang, we're done +if s:line !~# '\m^#!' + finish +endif + +" AWK +if s:line =~# '\m\<[gm]\?awk\>' + setfiletype awk + +" Perl 5 +elseif s:line =~# '\m\' + setfiletype perl + +" Perl 6 +elseif s:line =~# '\m\' + setfiletype perl6 + +" PHP +elseif s:line =~# '\m\' + setfiletype php + +" Python +elseif s:line =~# '\m\' + setfiletype python + +" sed +elseif s:line =~# '\m\' + setfiletype sed + +" Bash +elseif s:line =~# '\m\' + let b:is_bash = 1 + setfiletype sh + +" Korn shell +elseif s:line =~# '\m\<\(m\|pd\)ksh\(93\)\?\>' + let b:is_kornshell = 1 + setfiletype sh + +" POSIX/Bourne shell +elseif s:line =~# '\m\' + let b:is_posix = 1 + setfiletype sh + +endif -- cgit v1.2.3 From dbf4d6c87a5e0674908d97ad51fee4347d2a814f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 17:42:48 +1200 Subject: Update README.md's Vim section --- README.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5a67c28c..b0ebb8e8 100644 --- a/README.md +++ b/README.md @@ -336,13 +336,17 @@ combination to detach. The majority of the Vim configuration is just setting options, with a few mappings. I try not to deviate too much from the Vim defaults behavior in terms -of interactive behavior and keybindings. +of interactive behavior and keybindings. It's extensively commented, mostly +because I was reading through it one day and realized I'd forgotten what half +of it did. System-specific configuration files go in `~/.vim/config`. -The configuration is broken into smaller files in `~/.vim/config/*.vim`, -included by `~/.vimrc` using -[`:runtime`](http://vimdoc.sourceforge.net/htmldoc/repeat.html#:runtime). It's -extensively commented, mostly because I was reading through it one day and -realized I'd forgotten what half of it did. +#### Filetypes + +I define my own `filetype.vim` and `scripts.vim`, so that filetype detection +works in a way I like, and loads quickly. They are very unlikely to suit you as +they are, but you might be able to extend them with your favourite filetypes. +If you delete both of them from `~/.vim`, you'll get the stock filetype +detection back. #### Plugins @@ -359,12 +363,20 @@ In the current version, there are no local plugins; everything's got its own repository. All plugins and colorschemes are available as submodules in `~/.vim/bundle`. They are installed into `~/.vim`. +I still use two third-party plugins: Tim Pope's +[repeat.vim](https://www.vim.org/scripts/script.php?script_id=2136) and +[surround.vim](https://www.vim.org/scripts/script.php?script_id=1697). In my +opinion, these plugins are so fundamental and useful that they should have been +implemented in or bundled with Vim itself many years ago. + +#### Filetype plugins + I also define a few rules specific to file types I often edit in `~/.vim/after/ftplugin`, including some local mappings for checking, linting, and tidying, and a few more in `~/.vim/after/indent`. There are also a few tweaks to core syntax files in `~/.vim/after/syntax`, especially for shell -script (`sh.vim`). Some/all of these filetype plugins are also due to be -separately distributed and installed via submodules instead. +script (`sh.vim`). Some of these filetype plugins are also due to be separately +distributed and installed via submodules instead. #### Neovim -- cgit v1.2.3 From f0c63f6ae45795a955459074eb961ce40fe96f1d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 18:04:02 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 4dc0b353..af53a290 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v0.47.3 -Tue Jun 5 01:59:28 UTC 2018 +tejr dotfiles v0.48.0 +Wed Jun 6 06:03:56 UTC 2018 -- cgit v1.2.3 From fca745eb90e767871c274f1dd2abf4e479874d98 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 6 Jun 2018 18:04:24 +1200 Subject: Rebuild dotfiles(7) manual page --- man/man7/dotfiles.7df | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index c215ae80..6960e3c5 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -477,12 +477,17 @@ The majority of the Vim configuration is just setting options, with a few mappings. I try not to deviate too much from the Vim defaults behavior in terms of interactive behavior and keybindings. -.PP -The configuration is broken into smaller files in -\f[C]~/.vim/config/*.vim\f[], included by \f[C]~/.vimrc\f[] using -\f[C]:runtime\f[] (http://vimdoc.sourceforge.net/htmldoc/repeat.html#:runtime). It's extensively commented, mostly because I was reading through it one day and realized I'd forgotten what half of it did. +System\-specific configuration files go in \f[C]~/.vim/config\f[]. +.SS Filetypes +.PP +I define my own \f[C]filetype.vim\f[] and \f[C]scripts.vim\f[], so that +filetype detection works in a way I like, and loads quickly. +They are very unlikely to suit you as they are, but you might be able to +extend them with your favourite filetypes. +If you delete both of them from \f[C]~/.vim\f[], you'll get the stock +filetype detection back. .SS Plugins .PP If the logic for doing something involves more than a few lines or any @@ -501,6 +506,14 @@ All plugins and colorschemes are available as submodules in \f[C]~/.vim/bundle\f[]. They are installed into \f[C]~/.vim\f[]. .PP +I still use two third\-party plugins: Tim Pope's +repeat.vim (https://www.vim.org/scripts/script.php?script_id=2136) and +surround.vim (https://www.vim.org/scripts/script.php?script_id=1697). +In my opinion, these plugins are so fundamental and useful that they +should have been implemented in or bundled with Vim itself many years +ago. +.SS Filetype plugins +.PP I also define a few rules specific to file types I often edit in \f[C]~/.vim/after/ftplugin\f[], including some local mappings for checking, linting, and tidying, and a few more in @@ -508,8 +521,8 @@ checking, linting, and tidying, and a few more in There are also a few tweaks to core syntax files in \f[C]~/.vim/after/syntax\f[], especially for shell script (\f[C]sh.vim\f[]). -Some/all of these filetype plugins are also due to be separately -distributed and installed via submodules instead. +Some of these filetype plugins are also due to be separately distributed +and installed via submodules instead. .SS Neovim .PP I test my configuration every now and then with the Neovim -- cgit v1.2.3