vim

Force git show to show diff using vimdiff

南笙酒味 提交于 2019-12-23 19:15:19
问题 How do I do this? After doing changes via git config I can diff my staged and committed changes with vimdiff but when I do git show I still see the diff in old plain style. How do I make this work for git show as well? 回答1: With git show you can show objects like commits (see the man page for reference). So you don't show a diff of two files, but changes in (maybe multiple) files. So there are not two files, which can be compared. But that is exactly what vimdiff does, it opens two files side

Is circular scrolling possible in vim?

…衆ロ難τιáo~ 提交于 2019-12-23 19:08:20
问题 Is it possible to configure vim such that a movement command "wraps around" the vertical (or horizontal) buffer? In other words, assume I'm on line 2 in a buffer, in visual mode. I press 3k . My cursor is now positioned on the last line of the buffer. Or more simply, my cursor is on the first line of the file -- I press k . Now my cursor flips to the last line of the file. Apologies if this has been asked before, but I couldn't find any references searching for "circular scrolling" or "wrap

Close location list when selecting file

跟風遠走 提交于 2019-12-23 19:04:03
问题 Is there a way to automatically close the current location list in vim when the user selects an entry from it, i.e. navigates to a listed location? The scenario is: simular to how to open a file in a list of files in vim? I have an external program that creates a list of files/locations that is then loaded using lgetfile . When the list is opened e.g. using lopen 10 the location list window remains open even after a location is selected. Extended/alternative - I accept any solution that

Problem with Vim omnicomplete and system Python

只愿长相守 提交于 2019-12-23 19:01:29
问题 I have Vim set up, with +python ( :version says it's ok). My .vimrc contains filetype plugin on set ofu=syntaxcomplete#Complete autocmd FileType python setlocal omnifunc=pythoncomplete#Complete When some .py file is open, and I type i.e. pri and press Ctrl - X , Ctrl - O , it says no pattern was found? Am I missing something? Can I somehow rebuild Vim's Python keyword database? 回答1: Rather than syntaxcomplete#Complete , use pythoncomplete#Complete : # ~/.vim/ftplugin/python.vim setlocal

Key escape sequences not working for tmux

百般思念 提交于 2019-12-23 18:53:34
问题 I have been using iTerm2 and vim for a while. I have experienced some issues when I needed to use key combinations such as CTRL-F10 and SHIFT-F10 inside a vim session running inside iTerm2 . It is straight forward to define key bindings such as <C-F10> and <S-F10> for the GUI version of MacVim. No problems there. However, it proved to be difficult to get the same key combinations in the terminal version of MacVim . I have solved this by using iTerm2 's Send Escape Sequence functionality. Once

vim update complete popup as I type

旧街凉风 提交于 2019-12-23 18:52:07
问题 I am trying to use complete() in vim so that it reads the value as well. For example, from vim 's complete() example, inoremap <F5> <C-R>=ListMonths()<CR> func! ListMonths() call complete(col('.'), ['January', 'February', 'March', \ 'April', 'May', 'June', 'July', 'August', 'September', \ 'October', 'November', 'December']) return '' endfunc if I type <F5> I will get all the months as a pop up. Now, what I want is, if I type "J", only January, June and July will be shown, "Ju" will give June

MacVim color issues when launching from command line

旧城冷巷雨未停 提交于 2019-12-23 18:32:02
问题 I'm relatively new to Vim and have been using it without issues so far. I'd either launch MacVim from my dock or using mvim from the command line. This worked great so far, but just now I've run into an issue. For no apparent reason, launching MacVim from the command line started to create a MacVim window that had all the colors screwed up. When I'd launch it from the dock, everything is fine. The colorscheme is the same between both editors (solarized), so I'm really puzzled as to what the

Send echo or register contents to pbcopy / mac clipboard on mac os x

纵然是瞬间 提交于 2019-12-23 18:13:52
问题 I have a custom function in vimscript which creates a string and then echo's it to the bottom console. At the moment I copy and paste that output using cmd-c to copy it to the mac os x clipboard. I would like to shorten this workflow by just piping the echo to pbcopy, i tried: :echo "hello" <BAR> !pbcopy But of course that doesn't work. I also tried capturing the output into a register and then outputting it: :@a!pbcopy But it just trys to execute the string stored in @a, which is no a vim

vim creates copies of my files after saving?

你。 提交于 2019-12-23 18:10:08
问题 HI there, Using vim and whenever I make a change and save a file vim seems to create a backup file. I can see that it's the file before I made my change and saved. How can I prevent this or hide these files? I type :wq to save and quit. 回答1: Add set nobackup to your ~/.vimrc file. 回答2: Yeak, preferably you should set sth like : set backupdir=~/backup/vim set dir=~/backup/vim/swap set undodir=~/backup/vim/undos set undofile set bk Note also the savevers plugin. So you'll never have files in

How to set the root of git repository to vi/vim find path?

限于喜欢 提交于 2019-12-23 18:09:01
问题 I want to set vim file search path to include git repository root (which can be found by git rev-parse --show-toplevel ). I can't figure out how to append the output of this git command to " set path=.,,** " in .vimrc. Thanks! 回答1: You can use this command: let &path .= "," . system("git rev-parse --show-toplevel | tr -d '\\n'") That said, I usually start Vim from the top-level directory of the project and never change the working directory so that's one less setting to worry about. See :help