vim

How to comment in vim while respecting the indent ?

I'm trying to make a mapping in vim to insert comments (for example, "# " - box with a space) while respecting the indenting. So, instead of commenting like this: class MyFrame(wx.Frame): def __init__(self, title, pos, size): # wx.Frame.__init__(self, None, -1, title, pos, size) # menuFile = wx.Menu() I'd to...

Sorting from current point to end of file in gvim?

The following in command mode (gvim) :.,G!sort results in E464: Ambiguous use of user defined-command :help E464 Ambiguous use of user-defined command There are two user-defined commands with a common name prefix, and you used Command-line completion to execute one of them. |user-cmd-ambiguous| Example: > :command MyComma...

Using bash command line, how to add "import package.name.*;" to many java files?

I'm thinking of using find or grep to collect the files, and maybe sed to make the change, but what to do with the output? Or would it be better to use "argdo" in vim? Note: this question is asking for command line solutions, not IDE's. Answers and comments suggesting IDE's will be calmly, politely and serenely flagged. :-) ...

Saving results of Regex Search into a file with Vim

I've got a HTML file, and I'd like to grab all the links that are in the file and save it into another file using Vim. I know that the regex would be something like: :g/href="\v([a-z_/]+)"/ but I don't know where to go from here. ...

Cursor disappears in vim when switching windows between vertical and horizontal split

I've been switching some windows in VIM from vertical to horizontal splits and back using: CTRL-W + K CTRL-W + L CTRL-W + J CTRL-W + H After doing this a few times the cursor disappeared. I can still type, and the status bar at the bottom still shows me my location, but there's no blinking cursor. Any ideas regarding: Why does thi...

separate searches in windows in VIM

When I split VIM to show me a few files or a different parts of the same file, is there any way for me to have one search in one window and a different search in another one? For instance, I'd like the upper window to have the search pattern foo and the lower window to have the search pattern bar. The active search pattern affects what...

Vimperator recommended setting

By way of study of Vim, I have begun to use Vimperator add-on for Firefox recently. Therefore please teach it if there is recommended setting. Thanking you in advance. ...

Can you delete a column of text in Vim / Vi / gVim?

Say I have the following style of lines in a text file: "12" "34" "some text " "56" "78" "some more text" . . . etc. I want to be able to remove the quotes surrounding the first two columns. What is the best way to do this with VIM (I'm currently using gVim)? I figured out how to at least delete the beginning quote of each line b...

Using VI, VIM, or GVIM as IDE

I am forced to use VS2008 for the bulk of my projects at work, but whenever the odd text file needs editing I use VIM. Now I know that there are plugins and whatnot that can make VIM work like an IDE, so I am wondering if anyone actually uses it as an IDE? EDIT: For those of you who think you speak for the masses in saying that VIM sh...

How to share one vimrc file among multiple clients?

I am not a very orderly person at times and I often find myself in the situation of loosing my old fully tweaked vimrc file and having to start over all again. Or having different versions of vimrc files on different clients. Since this mess is getting out of hand for me, I would like to know if there is a good way of managing your vimrc...

in vim, how to set "args" to the result of a "grep -l"?

To illustrate, here's how to do it from the command-line: vim `grep "hello" * -Rl` This opens vim with all the files that have "hello" in them (-l gives the filenames alone). I want to do the same thing, but from within vim. Conceptually, something like this (which doesn't work): :args !grep "hello" * -Rl I'm open to completely di...

in vim, how to append/insert text with argdo?

There's the ":a" command, but that's multi-line, and argdo asks you for the text again for each file. The docs mention the global command (g/pat/command) that will use an alternative version of ":a" that is terminated by a newline instead of by "." on a line (you can include newlines by escaping them with "\"). But I couldn't get this ...

Highlight PHP syntax in .html extensions in VIM

I am working on a codebase that uses php within .html files. How do I tell VIM to highlight php correctly in .html files without renaming all of my .html to .php? ...

Is there a equivalent to o-<esc>-p in vim?

When i yank a whole line and press p in creates a new line to put the yanked text. Because of the newline characters. But if I yank part of a line is there a way to put that yanked text in a new line. I currently do o-esc-p. Is this the only way? ...

Vim - Weird Behaviour

I just recently deleted my .vimrc, and since I've added a few things back in and added some plugins I get this weird behaviour. I click 'i' to place me in insert mode. I type a character (any character) Suddenly I get a newline break right where I started typing. Extremely annoying! :) Any ideas on what this might be? ...

vi search copy paste search copy

Hi, I was just wondering if anyone could help out with how to do the following using vi. I have a text file and it might contain something like start of text file: --something1.something2-- --anotherThing1.something2-- end of text file: If I want to take this line and convert it by way of searching for anything matching the first oc...

Vim tabs and buffers

I've started using Vim some time ago. So far - I enjoyed my experience with this editor. Until recently I started using Tabs in Vim. I must admit that I am a bit frustrated about whole buffer/tab/window concept in Vim. For example, suppose I am working on a number of files related to one "project". All files are open in tabs. Suppose I...

Omit 'Pattern not found' error message in Vim script

I added a function in my .vimrc that's just few search and replace commands. However if one of the patterns is not found I get an error message that I need to enter through. How can I suppress this? ...

How to make Vim continue bullet points?

When I use Mediawiki-syntax first-level bullet points, pressing enter key shows a bullet point for the next line as well: * <CR> * But when I have the second-level bullet points, it just starts a new blank line ** <CR> (blank line) What option/expression do I have to change/program to make it put ** in the second line? I have se...

How to find the global function?

I have a function name called setValue, used in many classes. Also, i have a global function by the same name. When i press C-], it goes to arbitrary setValue function. How do i directly jump to the global setValue function? It is really pain to use tnext every time to find if the function global. ...