aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--VERSION4
-rw-r--r--vim/autoload/select_old_files.vim7
-rw-r--r--vim/plugin/select_old_files.vim6
-rw-r--r--vim/vimrc50
5 files changed, 50 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index f6a2ae02..4be00a3a 100644
--- a/Makefile
+++ b/Makefile
@@ -563,7 +563,7 @@ install-vim-after-indent:
mkdir -p $(VIMDIR)/after/indent
cp -p -- vim/after/indent/*.vim $(VIMDIR)/after/indent
-install-vim-after-plugin:
+install-vim-after-plugin: install-vim-autoload
mkdir -p $(VIMDIR)/after/plugin
cp -p -- vim/after/plugin/*.vim $(VIMDIR)/after/plugin
@@ -603,7 +603,7 @@ install-vim-config: install-vim-cache
install-vim-filetype:
cp -p -- vim/filetype.vim vim/scripts.vim $(VIMDIR)
-install-vim-ftplugin:
+install-vim-ftplugin: install-vim-autoload
mkdir -p -- $(VIMDIR)/ftplugin
cp -p -- vim/ftplugin/*.vim $(VIMDIR)/ftplugin
@@ -619,7 +619,7 @@ install-vim-indent:
mkdir -p -- $(VIMDIR)/indent
cp -p -- vim/indent/*.vim $(VIMDIR)/indent
-install-vim-plugin:
+install-vim-plugin: install-vim-autoload
mkdir -p -- $(VIMDIR)/plugin
cp -p -- vim/plugin/*.vim $(VIMDIR)/plugin
diff --git a/VERSION b/VERSION
index 7478c675..093c9915 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v6.14.0
-Sun, 16 Jun 2019 02:26:48 +0000
+tejr dotfiles v6.15.0
+Sun, 16 Jun 2019 05:16:16 +0000
diff --git a/vim/autoload/select_old_files.vim b/vim/autoload/select_old_files.vim
new file mode 100644
index 00000000..518b98d4
--- /dev/null
+++ b/vim/autoload/select_old_files.vim
@@ -0,0 +1,7 @@
+function! select_old_files#() abort
+ let oldfiles = v:oldfiles
+ let limit = get(g:, 'select_old_files_limit', &lines - 1)
+ let v:oldfiles = v:oldfiles[:limit-2]
+ browse oldfiles
+ let v:oldfiles = oldfiles
+endfunction
diff --git a/vim/plugin/select_old_files.vim b/vim/plugin/select_old_files.vim
new file mode 100644
index 00000000..dbfbd64c
--- /dev/null
+++ b/vim/plugin/select_old_files.vim
@@ -0,0 +1,6 @@
+if exists('loaded_select_old_files')
+ finish
+endif
+let loaded_select_old_files = 1
+command! -bar SelectOldFiles
+ \ call select_old_files#()
diff --git a/vim/vimrc b/vim/vimrc
index 699f2e45..9eaa699b 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -195,9 +195,9 @@ command! -bar ReloadFileType
" a defensive measure to avoid infinite recursion. It may not actually be
" necessary.
"
-" We emit a faked display of the command, as well, just to make it clear that
-" something has happened. The :redraw just before that message seems to be
-" necessary for this message to display correctly. I'm not sure why.
+" We emit a message afterwards, just to make it clear that something has
+" happened. The :redraw just before that message seems to be necessary for
+" this message to display correctly. I'm not sure why.
"
function! s:ReloadVimrc() abort
ReloadFileType
@@ -216,9 +216,9 @@ augroup vimrc
augroup END
" Reload the stub vimrc, and thereby this main one, each time either of them
-" is saved. This often makes errors in the file immediately apparent, and
-" saves restarting Vim or running the :source command manually, which
-" I almost always want to do after changing my vimrc file anyway.
+" is written. This often makes errors in the file immediately apparent, and
+" saves restarting Vim or running the :source command manually, which I almost
+" always want to do after changing my vimrc file anyway.
"
autocmd vimrc BufWritePost $MYVIMRC,$MYVIM/vimrc
\ ReloadVimrc
@@ -682,22 +682,22 @@ if has('gui_running')
set guioptions+=M
endif
-" By default, Vim doesn't allow a file buffer to have unsaved changes if it's
-" not displayed in a window. Setting this option removes that restriction so
-" that buffers can remain in a modified state while not actually displayed
-" anywhere.
+" By default, Vim doesn't allow a file buffer to have unwritten changes if
+" it's not displayed in a window. Setting this option removes that
+" restriction so that buffers can remain in a modified state while not
+" actually displayed anywhere.
"
" This option is set in almost every vimrc I read; it's so pervasive that
" I sometimes see comments expressing astonishment or annoyance that it isn't
" set by default. However, I didn't actually need this option for several
" years of Vim usage, because I instinctively close windows onto buffers only
-" after the buffers within them were saved anyway.
+" after the buffers within them have been written anyway.
"
" However, the option really is required for batch operations performed with
-" commands like :argdo or :bufdo, because Vim won't otherwise tolerate unsaved
-" changes to a litany of buffers that are not displayed in any window. After
-" I started using such command maps a bit more often, I realized I finally had
-" a reason to turn this on permanently.
+" commands like :argdo or :bufdo, because Vim won't otherwise tolerate
+" unwritten changes to a litany of buffers that are not displayed in any
+" window. After I started using such command maps a bit more often,
+" I realized I finally had a reason to turn this on permanently.
"
set hidden
@@ -1045,6 +1045,12 @@ endif
" many of these.
"
+" Use backspace as an even quicker way to switch to the current buffer's
+" alternate buffer. User nickspoons of #vim was incredulous that I had never
+" used CTRL-^ and indeed did not know about it. I have since repented.
+"
+nnoremap <Backspace> <C-^>
+
" I find the space bar's default behavior in normal mode of moving right one
" character to be useless. Instead, I remap it to be a lazy way of paging
" through the argument list buffers, scrolling a page until the last line of
@@ -1438,7 +1444,16 @@ nnoremap <Leader>E
nnoremap <Leader>j
\ :<C-U>buffers<CR>:buffer<Space>
-" This ground defines mappings for filtering and batch operations to clean up
+" Leader,o hacks up the list of old files from viminfo just long enough to
+" ensure that :browse :oldfiles fits in a screen, avoiding an Enter or 'q'
+" keypress before entering the number. This one is handy followed by
+" <Leader>,\ to jump back to the last remembered position in that file, since
+" by definition viminfo remembers that mark, too.
+"
+nnoremap <Leader>o
+ \ :<C-U>SelectOldFiles<CR>
+
+" This group defines mappings for filtering and batch operations to clean up
" buffer text. All of these mappings use commands from my custom plugins:
"
" :KeepPosition
@@ -1534,8 +1549,7 @@ xmap <Leader>* <Plug>(RegexEscape)
" command wrapper defined much earlier in the file, so that filetypes also get
" reloaded afterwards, meaning I don't need to follow <Leader>R with
" a <Leader>F to fix up broken global settings.
-
-"" Leader,R reloads ~/.vimrc
+"
nnoremap <Leader>R
\ :<C-U>ReloadVimrc<CR>