These should be unified, but for now, --patch is just stealing the
spotlight from inline diffs, so I won't shed any tears over dropping its
help tag.
Closes https://github.com/tpope/vim-fugitive/issues/1203
This commit tweaks the existing autocommand for files matching
`index{,.lock}` to:
- Fire BufReadPre and BufReadPost on either side of the read
operation for files not in a `.git/` and already extant.
- Fire BufNewFile for new files not in a `.git`.
- Add `keepalt` to the `read`, thus allowing alternative file
operations such as Ctrl-^ to work correctly.
Has been tested against:
- BufReadPost,BufNewFile autocommands
- A basic test case for alternate files where one is named `index`
Closes https://github.com/tpope/vim-fugitive/issues/834
Closes https://github.com/tpope/vim-fugitive/issues/959
The easiest way for users to define their own maps in Gstatus buffers is
using a ftplugin/fugitive.vim file with a `b:fugitive_type != 'index'`
guard. Setting the filetype after defining the maps allows users to
maniuplate "dangerous" maps and otherwise customize mappings.
For example, in ~/.vim/after/ftplugin/fugitive.vim:
if !exists('g:loaded_fugitive') || b:fugitive_type != 'index'
finish
endif
" Use s to stage *and* unstage changes: shadows -.
nmap <buffer> <silent> s -
xmap <buffer> <silent> s -
" I hit this by accident.
nunmap <buffer> X
Most usages in commit da3b2f32 (Support tab local working directories)
were updated to use this pattern, but Gblame missed the boat. Without
this, Gblame will change the root git tree but won't change back to the
previous location.
This was trying to block `au QuickFixCmdPost * copen` as it interfered
with restoring the working directory, but that was mainly a concern for
the other half of the conditional, so restore it to enable the status
buffer to reload.
We need modifiable off for the maps to kick in, but we need to turn it
back off before the doautocmd or else it will throw an error if the
modeline modifies the buffer with an option like fileencoding, which you
should never do, stop doing it.