Added ,ocf for opening changed files (stolen from @garybernhardt)
This commit is contained in:
parent
e927e86d32
commit
10d947d5af
@ -364,6 +364,7 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
|
|||||||
* `,vr` - (Vim Reload) source current file as a vim file
|
* `,vr` - (Vim Reload) source current file as a vim file
|
||||||
* `,yw` - yank a word from anywhere within the word (so you don't have to go to the beginning of it)
|
* `,yw` - yank a word from anywhere within the word (so you don't have to go to the beginning of it)
|
||||||
* `,ow` - overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it
|
* `,ow` - overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it
|
||||||
|
* `,ocf` - open changed files (stolen from @garybernhardt). open all files with git changes in splits
|
||||||
* `,w` - strip trailing whitespaces
|
* `,w` - strip trailing whitespaces
|
||||||
* `sj` - split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down)
|
* `sj` - split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down)
|
||||||
* `sk` - unsplit a link (k = up)
|
* `sk` - unsplit a link (k = up)
|
||||||
|
20
vim/plugin/settings/open-changed-files.vim
Normal file
20
vim/plugin/settings/open-changed-files.vim
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" OpenChangedFiles COMMAND
|
||||||
|
" Open a split for each dirty file in git
|
||||||
|
"
|
||||||
|
" Shamelessly stolen from Gary Bernhardt: https://github.com/garybernhardt/dotfiles
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
function! OpenChangedFiles()
|
||||||
|
only " Close all windows, unless they're modified
|
||||||
|
let status = system('git status -s | grep "^ \?\(M\|A\)" | cut -d " " -f 3')
|
||||||
|
let filenames = split(status, "\n")
|
||||||
|
if len(filenames) > 0
|
||||||
|
exec "edit " . filenames[0]
|
||||||
|
for filename in filenames[1:]
|
||||||
|
exec "sp " . filename
|
||||||
|
endfor
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
command! OpenChangedFiles :call OpenChangedFiles()
|
||||||
|
|
||||||
|
nnoremap ,ocf :OpenChangedFiles<CR>
|
Loading…
Reference in New Issue
Block a user