vim

How does one use Tim Pope's cucumber.vim plugin for vim?

I've loaded the cucumber.vim files into ftplugin and the other directories per instructions, but I don't understand the ftplugin syntax enough to figure out how to get the full benefits. From what I can tell, the plugin is supposed to be able to jump between step definitions and feature files, but I can't figure out what's wrong with my...

How to paste in a new line with vim?

I often have to paste some stuff on a new line in vim. What I usually do is: o<Esc>p Which inserts a new line and puts me in insertion mode, than quits insertion mode, and finally pastes. Three keystrokes. Not very efficient. Any better ideas? ...

What are the efficiencies afforded by Emacs or Vim vs Eclipse?

Hey All, I started coding around 5 years ago. I was introduced through Java and Eclipse which both have substantial stigma attached in the programming community. A number of people at the company I currently intern at prefer emacs or vim. I can't see how a basic text editor is faster or easier than an IDE in general although I appreciat...

vi: paste at top of file

One thing that's bothered me with vi is that paste (p) inserts lines after the line I'm on, which makes it impossible for me to insert things at the top of a file. For instance, say I'm going through and adding a UTF-8 declaration to the top of a few files: # -*- coding: utf-8 -*- yy and it's yanked. Good. I switch over to another ...

Vim: sudo errors in writing a selection

How can I circumvent the errors, such as E212 and E13, in the commands? :'a,'bw set_question_tags.php :'a,'bw >> set_question_tags.php In some cases, even with Pavel's command: "create_a_file_and_save.php" E212: Can't open file for writing ...

How to get rid of search highlight in vim

I have :set hlsearch as default value. When I search for something, search terms get highlighted. However many times I want to get rid of the highlight, so I do :set nohlsearch. In this way I get rid of highlights for the time being. However if I do a new search then search terms are not highlighted. I would like to hit ESC and ESC to...

I should get a command prompt rather than a popup when I try to close an unsaved window

I am using git configuration mentioned here If I create a new tab and then if I do commmand W ( I am using mac) to discard that window then I get a popup for which I have to use mouse. I have seen others use vim where in similar cases they get a prompt at the bottom which is something like C for cacel N for No. S far Save(not sure)....

how to sort a numeric/ and literal columns in vim

Using vim 6.0. say I'm editing this file sdfsdg dfgdfg 34 12 2 4 45 1 34 5 and I want to sort the second column Thanks ...

Identifying Identical Blocks of Code

Say I have multiple blocks of the following code in a file (spaces is irrelavent): sdgfsdg dfg dfgdfgf ddfg dfgdfgdfg dfgfdg How do you find/highlight all the occurrences? What I ideally want to do is to visually select the code block and then press search to find all occurrences. ...

How to move from one C/C++ function to the next (both directions)

I just want to jump to from one function to the next in .c/.cpp files. How do I do that? ...

gvim :make command does not work

Hi all, I am under a Unix environment, working in C++. I'm opening gvim from a directory in which a makefile called "Makefile" exists. When I try to use ":make" from within vim, I get: shell returned 2 (1 of 1): make: *** No targets specified and no makefile found. Stop. ...

How do you map Command/Apple option in vim

I am going through this document and this is what I gathered. <Esc> Escape key <C-G> CTRL-G <Up> cursor up key <C-LeftMouse> Control- left mouse click <S-F11> Shifted function key 11 <M-a> Meta- a ('a' with ...

vim, reformat text to initializers

I've a big file with lines that look like 2 No route to specified transit network 3 No route to destination i.e. a number at the start of a line followed by a description. And I'd like to transform that for use as a struct initializer {2,"No route to specified transit network"}, {3,"No route to destination"}, H...

How to keep NERDTree from resizing project window in (g)vim?

I've been forcing myself to use gvim for Windows for much of my text editing needs. I'm gradually growing more comfortable with it, but one problem has been annoying me greatly. I use the project plugin to keep a window up on the left side of my gVim screen, listing my projects. It's handy and keeps me from going into IDE withdraw. H...

Vim copy-paste to system buffer not behaving as expected

I'm having a headache trying to figure out why vim isn't copying to a system buffer. Here's my workflow: vim asd y1y :q vim qwe p On computerA and computerB, this works as I want it to: the line yanked from the file asd is put into the file qwe. On computerC, this doesn't work. All systems are running Ubuntu 8.04. computerA has th...

How to sort on column for rows containing a certain word

I want to sort on a certain column only for rows containing a certain word. I don't want to see rows not containing that word. For example I have this text file: sdf ggfds 7 sdf sgs 5 sdf dfgs 3 foo dffg 2 bar dffg 2 sdf sddfg 4 I want to sort 3rd column for rows containing only "sdf" word (doesnt have to be in...

vim deleting backword tricks

How to delete a word to the left? In other words, to delete the word when cursor stands at the end of it. How to delete characters to the beginning of the line? How to delete to the first whitespace to the left? Other tricks involving word deletion ...

Swap text around equal sign

Is there an easy way to flip code around an equal sign in vi/vim? Eg: I want to turn this: value._1 = return_val.delta_clear_flags; value._2._1 = return_val.delta_inactive_time_ts.tv_sec; value._2._2 = return_val.delta_inactive_time_ts.tv_nsec; value._3 = return_val.delta_inactive_distance_km; (...) into this: return_val.delta_c...

NERD commenter : How to comment out a range

I am using NERD commenter Let's say that I want to comment out lines from 78 to 172. This is what I do. I calculate the difference. That is 94. put my cursor on line 78 and then I do: 94 , c space In this way I comment 94 lines starting from line number 78. I don't like the calculation that I need to do. I was hoping to pass a range...

Autoindenting Haskell in Vim

I started playing with Haskell and I use Vim. I have autoindent on in my vimrc, but it seems to not be aware of haskell somehow. I would like to autoindent work in some cases where it doesn't (for example, after = and newline). How can I customize autoindentation rules in vim? (I googled it, but every site suggested turning autoindent...