vim

Vim paste behaviour

Hi, I am a bit of a beginner when it comes to Vim and it is currently irritating me in many ways. One of which is the following: Say i have the following text in a file one two three four dog frog log mog and I have used visual mode to select the number words (4 lines) if I then use P to paste at the 'd' in dog i ge...

How to copy (or duplicate) an entire folder in Vim using NERDTree?

I know how to create a folder in NERDTree: m + a then newfolder/ ...

What's the best way to rearrange columns in a tab delimited text file in vim?

I already know how to do it with :%s/\(\S\+\)^I\(\S\+\)/\2^I\1/ but I feel like I'm typing way to much stuff. Is there a cleaner, quicker way to do it? ...

vim search by syntax-highlighting type

I'm adding i18n to an existing project (web application). This involves replacing every bit of static text with calls to an i18n library. It would be convenient to be able to search for this text rather than rely on syntax highlighting to identify it visually. In vim, is it possible to search within a file for occurrences of a certain...

auto-fold Oracle inline views in Vim using .vimrc

I've seen magical Vim commands before that you could add to your .vimrc to have folds created upon opening a particular type of file. I remember having such code that would create the folds, upon opening the file, at every Ruby method and class. Then, with one command, I could collapse all those method folds. Does anyone know how to d...

Getting text that is on a different line, with ex in Vim

Let's say I have the following text in Vim: file1.txt file2.txt file3.txt renamed1.txt renamed2.txt renamed3.txt I want a transformation as follows: file1.txt renamed1.txt file2.txt renamed2.txt file3.txt renamed3.txt What I have in mind is something like the following: :1,3 s/$/ <the text that is 4 lines below this line> I'm...

What’s in your .viper?

Similar to this question, but for Viper users specifically. How do you customize Viper? ...

How do I source a list of files from vimrc?

I basically want to add something like source ~/.vim/source.d/*.vim to vimrc. Is it possible to loop over a set of globbed files? ...

How to get a list of files that match some pattern?

How to get a list of files that match some pattern if filenames may contain \n character? Update: I want solution in pure vimscript, so that it will depend on nothing but vim. Update2: Expected output of glob function Consider the following script: :!touch /test ; mkdir /test$'\n' ; touch /test$'\n'/test :echo glob('/**/test') /test...

vim mapping normal keys like shift

I want to map a key in Vim such that i would hold down a key, say a, and then press some other key, say b. And then the holding down of the a would change what the pressing of b does. Like the way we use shift, just with all the normal characters of the keyboard. Is that possible? And if so, how? ...

Bash vi mode - bind "C-c" to escape from insert mode

Hi, I just discover the magic of using vi style in bash. Immediately, I'm trying to use C-c to escape from insert mode (into what's called movement mode) as I'm used to C-c to escape to command mode in vim. I searched around and found the command to rebind key in bash: "bind -m vi-insert C-c:vi-movement-mode" Then, I used "bind -P"...

Vim - how do I capitalize the first letter of a word?

For a long time, I know in vim we can use "~" to toggle the case of a character. Though, is there a way to map a key to capitalize a word and go back to the previous position? For example: I like to drink Coca co[l] If my cursor is at "l" and I realize I need to make the "c" capitalize as well, currently, I need to do: "<C-c> b ~ ll...

How can I move some lines to left or right in a simple way? (not n<< or n>>)

I have some lines in a sass file: .menu ul xx: xx li xx: xx a xx: xx .others xx: xx If I want to move the entire .menu part to right for a width of tab, I should use 7>>. It's so boring that I have to count there are how many lines in the .menu. Is there any simple way to do this? I mean, to move a node and its c...

vim how to create a debug message fast

I am using ruby on rails but that does not matter much for this question. Let's say that i have a statement like this error = 'this is an error message' I have noticed that I end up doing this a lot error = 'this is an error message' puts "error = #{error.inspect}" I am sure a macro can be written which would take the work on the l...

How do I make Align.vim \adec work correctly when java generics are involved?

The Align plugin is all nice and dandy, but I encounter problems with it when dealing with generics generics such that: HashMap<String, Object> session = new HashMap(); ArrayList<String> names = new ArrayList(); String banana = "Yo banana boy"; int count = 0; After \adec it becomes: HashMap<String, Object> session = new HashMap(); Ar...

Remapping :help in Vim to open in a new tab

The default behaviour of :help in Vim opens the help in a horizontal split. I need to remap :help to instead execute :tab help as to always open the help in a new tab. How can I remap this command? ...

Vim change configuration in folder viewing mode

When I enter a folder in vim by pressing gf while over a path, I enter some kind of folder viewing mode. I don't have for instance, line numbers set in it automatically. How do i change the configuration for the folder viewing mode in Vim? ...

vim - howto close all buffers in the current tab?

Hello, I know that using a command like: :%bdelete Using this command I can close all buffers, in all tabs, what I'd like to do is to close all buffers open in the current tab, is that possible? Usage: What I'd like to do, is to open ViM and load :VSTreeExplorer and then open related files in the same window switching between them ...

regex in vimscript

let test = 'a href="http://www.google.com"&gt;www.google.com&lt;/a;' in vimscript, how can i get http://www.google.com out of this using a regexp, and store it in another variable? i can't seem to find any documentation about this. thanks in advance! ...

Easy way to use vim for an svn conflict?

I just ran into a conflict while working in SVN, and I find myself missing a bit of functionality from Mercurial. In Mercurial, I have vim -d set up as my diff tool. I'm wondering if there is a way to get SVN to work in a similar way? Something along the lines of: $ svn resolve whatever.py Which would bring up vim (in diff mode), ...