![]() ![]() nvim_buf_clear_namespace ( 0, 2, 0, - 1 ) end return M " in init. clearBlameVirtText () - important for clearing out the text when our cursor moves api. You should probably look at how fugitive implements blame for other tips (although I admit tpope's vimscript is inscrutable).- in a local M = ) - set virtual text for namespace 2 with the content from git and assign it to the higlight group 'GitLens' end function M. You'll probably want 'cursorbind' on both windows too. You should also look at functions which make it much easier to wrap up this functionality - especially when creating new windows. Learning to do it yourself is great, but don't be fooled into thinking that vimscript in vimrc is more "native" than vimscript in a plugin.Äiscovered :term git blame %, and this does a decent job, but it splits my window horizontally :h vertical What you're really saying is that you want to learn how to write plugins yourself! Vim plugins are just snippets of. I want to learn as much as possible about how to do these things natively, then explore plugins once I understand the limitations and inner workings better. ""Ĭommand! -nargs=? ArgDiff if empty() | call ArgDiff('HEAD') | else | call ArgDiff() | endif a:commitÄ®xecute "nmap :wincmd o:n:GitDiff ". :Gblame - brings up vertical split of output from git blame :Gmove - for git mv :Gremove - for git rm :Git - run any command. function! ArgDiff(commit)Ä®xec 'read !git diff -name-only '. These work on Windows, so they might need some adjustment if you're going to Linux world. I then built on this command with this sequence that lets me look at the entire set of differences in my tree with diff mode and scroll among them with and. filenameĬommand! -nargs=? GitDiff if empty() | call GitDiff() | else | call GitDiff() | endif I also have this sequence that I use for diffing. command! Blame normal!:let bt=nofile:%!git blame -wM a:b author name, timestamp git show : description git blame -L : git blame -s : .![]() ",+10 %"Īny help is appreciated! If you're interested, current dotfiles. Noremap b :execute "Shell git blame -L ". I also found this mapping somewhere recently, but I couldn't get it to actually run, it throws an error, and I don't actually understand what it is trying to do: It shows the history of commits under the cursor in a popup window. If the output of this could be customized to only include the commit hash, author, and date, and open this in a vertical split we'd be cooking gas. git-messenger.vim is a Vim/Neovim plugin to reveal the hidden message from Git under the cursor quickly. Vim-fugitive allows you to git blame your current buffer without leaving vim. I recently discovered :term git blame %, and this does a decent job, but it splits my window horizontally, is very verbose, and it can't be closed using q. In this article I will present some excellent git-related Vim plugins. So I'm looking for a little help using any native functionality to display the current buffer's blame log in a usable way. This means that my next target for removal is vim-fugitive because the only thing I use this plugin for is blaming the current buffer. The one plugin that I cannot live without is fzf and fzf.vim, which already come with a few handy commands for interfacing with Git. My main reason for doing this is that I want to learn as much as possible about how to do these things natively, then explore plugins once I understand the limitations and inner workings better. I've been on a vanilla kick lately and have been aggressively reducing the number of plugins in favor of a fully custom, vanilla setup. And please those of you who deign to grace us with your vim wisdom - be kind.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |