Community Digest

Top new questions this week:

vim: (E)dit anyway without prompting

I work with many terminals, and very often hit the case where: a vim instance holds ~/sm/file I open another instance on the same file. My choice is always :(E)dit without prompting ... So I'd ...

asked by 5 votes
answered by Ingo Karkat 10 votes

how to change local directory of terminal buffer whenever its shell change directory

After :term ++curwin zsh, I use that buffer as an alternative of tmux window. But there is one caveat, if I cd in zsh, vim will not know. Which cause problem in below case In terminal normal mode, ...

asked by qeatzy 4 votes
answered by dedowsdi 5 votes

Is it necessary to always add ! to function and command

I can't remember start from when and why, i always add ! to function and command: function! .. ... endfunction command! ... But :h E122 says: When a function by this name already ...

asked by dedowsdi 3 votes
answered by Ingo Karkat 1 vote

VimL/Vimscript: how to access local variable of outer function from its inner function?

I posted this question on stackoverflow already, but realized afterwards that it's probably better to ask here. So I have a function of the following form: function! s:my_function(dict_arg) let ...

vimscript functions variables  
asked by Jethro Cao 3 votes
answered by Luc Hermitte 5 votes

Interaction of object-select with double quotes

I'm trying to understand logic of text-object-selection in the presence of double qoutes. In the following lines * denotes cursor position, // denotes my comments. a"b(c*d)e"f //di) deletes ...

asked by fantom 2 votes
answered by muru 1 vote

Is there a 'toggle' :set option?

In my $VIMRC I have: nnoremap <leader>A :set formatoptions+=a<cr> nnoremap <leader>a :set formatoptions-=a<cr> What I'm wondering is if there's something more like: ...

asked by Harv 2 votes
answered by DJMcMayhem 4 votes

How can substitute() operate on a whole buffer?

In normal usage :%s/A/B/g is a simple way to substitute a pattern across the entire buffer. However the command mode implementation of :substitute is subject to many user configurable variables and as ...

vimscript buffers substitute  
asked by Caleb 2 votes
answered by Luc Hermitte 4 votes

Greatest hits from previous weeks:

How do I reload the current file?

Quite often I am working with files that are version controlled, so it is possible for changes to be made to them outside of Vim. What is a quick way to reload the file without having to close and ...

file-operations load  
asked by Kevin Brown 149 votes
answered by xthrd 178 votes

How do I open a file from another git branch?

I'd like to open a file from another branch in the current git repository. I have seen this SO question, but the suggestions for combining it with Vim are cumbersome (pipe to Vim, open stdin, set ...

asked by muru 35 votes
answered by Peter Rincker 49 votes

Why do I need both a vimrc and a gvimrc?

There seems to be two ways to store preferences specific to gvim: Keep an .vimrc file for vim and a .gvimrc file for gvim specific additions. Keep all settings in .vimrc and wrap gvim specific ...

vimrc gvim  
asked by Caleb 38 votes

What is the difference between `filetype plugin indent on` and `filetype indent on`?

I see one of these two lines in .vimrc files. This one seems to be most common: filetype plugin indent on But how does it differ from this line: filetype indent on I've found documentation for ...

indentation filetype  
asked by Flimm 38 votes
answered by Flimm 46 votes

How to install NERDTree with Vundle?

I'm starting to use Vim and I chose Vundle instead of Pathogen. I would like to know if I can install the NERDTree using Vundle. I'm starting Vim and searching for NERDTree like this: :BundleSearch ...

asked by João Calvin 26 votes
answered by byaruhaf 31 votes

Swap the position of two windows

Say the following is the current structure of my window: +-----+---------------------------- | | | A | | | +-----+ | | | B | The order of A and B is not quite natural. It would be ...

split vim-windows  
asked by Jason Hu 29 votes
answered by modesto 33 votes

How do I use vim as a diff tool?

I use vim as my primary editor. I would also like to use vim to diff files and modify the files while doing the diff to fix easy changes (rather than most diff techniques which are a cycle of ...

asked by Martin York 105 votes
answered by Martin York 124 votes

Can you answer these questions?

Is there a way to paste at multiple locations/lines in vim?

I use :copy a fair bit. So like range :12,15 copy 20 will paste a block of text from 12 to 15 lines at 20th line. But when I want to paste a line at multiple places it doesn't work. For example :24 ...

vimrc cut-copy-paste  
asked by GauravP 1 vote
answered by Matt 0 votes

Issues in changing font size in vim

I using konsole terminal emulator and I am facing some issue with changing the font size in vim. If I add the following snippet into my .vimrc. In the vim application, the font size will snap back to ...

asked by keith ang 2 votes

Move cursor and screen together

I am implementing a smooth scrolling function for <C-u> and <C-d>, which just sleeps for a few milliseconds and then moves the screen up (<C-y>) or down (<C-e>) one line: ...

vimscript cursor-movement scrolling cursor  
asked by stimulate 1 vote
answered by stimulate 0 votes
You're receiving this message because you subscribed to the Vi and Vim community digest.
Unsubscribe from this community digest       Edit email settings       Leave feedback       Privacy
Stack Overflow

Stack Overflow, 110 William Street, 28th floor, New York, NY 10038