vim

Need help troubleshooting vi + cygwin issue

Hello. I've just added vim to my current Cygwin installation, and it doesn't work properly. The problem is: when I type vim <Enter> it opens Vim with the help splash screen (in color) - OK. I then try to exit with :q , and it sleeps a couple of seconds, then it exits but when I type a character at the command line it pre-pends a spuri...

Can you write unescaped search terms in the Vim command line?

When I do a search and replace on a yanked line that has characters that require escaping it's really annoying to have to go back through the command line string and escape all the special characters. Is there a way to use a literal (raw) string modifer like in python: str = r'\unescaped\'? ...

VIM: How to preserve case for search and replace

Is it possible to do a search and replace in vim that preserves the case of the search term? This was a useful feature in intelliJ that I miss. For instance, something like: :s/[uU]ser/[pP]erson/ (obviously, this doesn't work) Such that: user->person User->Person Another example with multiple characters to preserve: :s/[mM]y[uU]s...

VIM: How to select entire function definition in php

In php, if I have a function such as: function test($b) { var $a = 0; while ($a < b) { $a += 3; } return $a; } If the cursor is on the $a += 3 line, is it possible to quickly select the entire function? "v2aB" would select everything including the function braces but not the declaration "function test($b) " ...

how to show vertical line to wrap the line in vim?

hi, I'm finding a way to show a vertical line at 80 column in vim(not gvim). I've been used "set wrap", but I just want to show the line to wrap the long line by myself. thanks. ...

Copy from search mode to ex mode

While in the "/" mode to search, what should I do if need to copy it to the ex mode. E.g. I searched for /ab.*xy, now I need it as %s/ab.*xy/.../g. My intention is to test my search and then use that for a search replace ...

When in vim insert mode is there a way to add path autocompletion?

So I do a lot of shell scripts and I am constantly having to enter in paths and I was wondering if anyone knew of a way to get vim to autocomplete paths and files while in insert mode. Just like when you are in your favorite shell you tab to complete the directory or file. Extra credit if you can get CTRL-D functionality of the shell i...

VIM Relace all <a ...> and </a>?

Sorry this might be a simple question, but I could not figure it out. What I need is to filter out all the <a href...> and </a> strings out from a html text. Not sure what regular expression I should use? I tried the following search without any luck: /<\shref^(>)> what I mean here is to search for any string starting with "< href" an...

vim automated replacement

Hello, I have an automatic replacement done by my vim setup, which systematically replaces all occurences of "sql" in command line by "SQL". So when I type: :e myfile.sql it is translated in :e myfile.SQL and when I search /sql it is tranlasted in /SQL There's probably some parameters in the .vimrc, or some file sourc...

fixing the size of a window in vim

Is there a way to fix the size of a window in vim? In a way that when I do a Ctrl-W _, it would maximize the current window but the one I fixed the size would stay same. ...

vim search-replace question

Hi, I have a few trace lines in my file of the form M_TRACE(EV_TRACE_LEVEL_DEBUG, "some trace"); I want to convert those into M_TRACE(EV_TRACE_LEVEL_DEBUG, "%s: some trace", __FUNCTION__); However I have already a few traces which display the function name also. To make the conversion i am using the following command :%g/M_TRACE/...

VIM Autocomplete - Use $ as the word separator

Let's say I have following typed in my source file. var myFunction = function() { }; var anotherFunction = function() { }; var test-m I can now press Ctrl + P and it will show 'myFunction' in the autocomplete list. It's great and very helpful. But what I want to do is make VIM treat '$' in the same way it treats '-'. So when I typ...

Running AWK in Vim's search

How can you run AWK in Vim's selection of the search? My pseudo-code %s/!awk '{ print $2 }'//d I am trying to delete the given column in the file. ...

Interpreting the decimal point in arhithmetic calculations in Vim.

It seems to me that all of a sudden Vim doesn't recognize the decimal point anymore. For example, if I do a : echo 22.0/3.0 then I receive a 2200 This is probably because Vim sees the dot as a string concatenator and so calculates 22 . (0/3) . 0 which is 22 . 0 . 0 which then is 2200. I can confirm this suspicion by doing...

How to reenter Vim after :! bash?

I'm slowing getting to know Vim and Bash shell scripting and am running into this issue: When I'm running MacVim, I sometimes want to use the command line to compile whatever it is I'm working on (in this case a small Java program). So I type :! bash and compile whatever it is that I need and test it. Then when I want to go back to the ...

Associating one file extension with another in Vim

I'm working on a PHP project where all files are given the extension '.shtml'. Unfortunately Vim doesn't know to highlight PHP in these files. Is there as way to force Vim to highlight these files as PHP instead of shtml? ...

Using vimdiff with a different .vimrc?

I've been using VIM now for most of my editing for the last week or so and I'm loving the experience. However I have an issue. I've setup my .vimrc file with NERD_tree and a few other goodies. This works well for when I'm coding. However on occasion I use vimdiff via git and this causes some problems. I don't need NERD_Tree open whe...

How to run a java program using eclim?

I can't seem to run a simple Hello World program using eclim. I followed the install guide at http://eclim.org/guides/install.html#guides-install and the tutorial at http://eclim.org/gettingstarted.html#gettingstarted, but when I try to run the program (using :Java) I get java.lang.RuntimeException: Required setting 'org.eclim.java.run...

Vim: how to delete every second row?

How to do it in Vim: BEFORE: aaa bbb ccc ddd eee fff AFTER: aaa ccc eee ...

Vim: Calling a custom function from set statusline in vimrc

I'm trying to implement the vim script from the book Learning vi and vim on page 202. The following function works, but when I try to use statusline to call it I get the following error: $ vim $ Error detected while processing /Users/me/.vimrc: E518: Unknown option: \ %{SetTimeOfDayColors()} Here's the vim script (it's currently in my...