vim

How to configure vim for TAB/ident like this?

I would use vim like this: Pressing TAB indent by 4 spaces (spaces not a TAB) Existing TAB should treated as 8 space wide Could you help me? ...

Adding a command to Vim

I finally decided to try out Vim, as I am getting increasingly frustrated by GUI editors. So far, I'm loving it, but I can't find any help for a issue I'm having... I am trying to map the command :Pyrun to :!python % in Vim using cmap. The mapping shows up fine if I type :cmap. However, on typing :Pyrun, I get this error message: No...

Vim: Maintain the history of a file after it has been changed and reloaded

If I'm editing a file in Vim, then some external program changes the file, Vim tells me: W11: Warning: File "test.erl" has changed since editing started See ":help W11" for more info. [O]K, (L)oad File: If I Load the file, though, all the undo history is lost. Is there any way to avoid that? ...

Switching to a particular tab in VIM

I was trying to switch from a tab to another tab (which may not be adjacent to the previous tab) in VIM. Is there any shortcut for that, like we have Ctrl-p/Ctrl-n for switching to adjacent tabs? Also, I was trying to write a key mapping which will give a variable as input to a function and do the operation. For instance, let's say I p...

VIM Python Indentation not working?

So I have VIM7 (enhanced) on CentOS5 and it comes with all the usual VIM plugins/scripts ready to go. $ find /usr/share/vim/vim70/ -name \*python\* /usr/share/vim/vim70/syntax/python.vim /usr/share/vim/vim70/ftplugin/python.vim /usr/share/vim/vim70/indent/python.vim /usr/share/vim/vim70/autoload/pythoncomplete.vim I would think that w...

Join all lines with tabs inserted (vim)

I have a tab delimited file (one line). I can easily enough replace the tabs with new lines so that I can see what fields are in what position :%s/\t/\r/g How can I do the inverse, after I've edited the fields? I could record a macro: Js<tab>Esc And then repeat it all the way down - but is there an easier way? ...

Load different colorscheme when using vimdiff

How do i load a different colorscheme when i do a vimdiff. I want this because the my current colorscheme does not show some diffs properly in vimdiff like the same fg/bg color for the text. This makes it impossible to understand the diff. So everytime i do a vimdiff i have to do :colorscheme some_other_scheme Can this be done in .vim...

How to refresh taglist in vim?

When I make a change to a file, for example, add a function, how can I make the taglist automatically update the "tag list" in its windows after I save the change? ...

Vim yanking range of lines

Hello Everyone! This is my first post on stack, so please bear with me. I'm a C# developer who has just recently decided to expand my knowledge of the tools available to me. The first tool I've decided to learn is Vi/Vim. Everything has been going well so far, but there are a couple of questions I can't seem to find the answer to: 1...

How can I open several files at once in Vim?

Is there a way to open all the files in a directory from within Vim? So a :command that would say in effect "Open all the files under /some/path into buffers". Ideally, it would be great to open all the files under a dir recursively. ...

Saving vim macros

Does anyone know how to properly save/reuse macros recorded inside of a vim editor? ...

Sub-match syntax highlighting in Vim

First, I'll show the specific problem I'm having, but I think the problem can be generalized. I'm working with a language that has explicit parenthesis syntax (like Lisp), but has keywords that are only reserved against the left paren. Example: (key key) the former is a reserved word, but the latter is a reference to the variable nam...

Vim's surround plugin usage

I just downloaded vim today. The surround plugin documentation says: Press cs"' inside "Hello world!" to change it to 'Hello world!'. But where am I supposed to press cs"' and in which mode? ...

How to install a Vimball plugin (with .vba extension)?

How to install a Vimball plugin (with .vba extension)? The documentation just says: install details Edit the vba file and type: :so % the vimball documentation says: All a user needs to do with a vimball is: vim someplugin.vba :so % :q Do I have to write that in normal mode (inside Vim) or in the _vimrc file? Do I have to write t...

Does settings in Vim's configuration file '_vimrc ' follow an order according to the document's flow (top to bottom)?

Its a bit weird, I wanted to deactivate automatic backups in gVIM when saving, so I placed set nobackup in the top of the file _vimrc and it didn't work. Then I placed that line below the following lines: set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin and it worked. basically set nobac...

Specifying the destination for the pdf output when using pdflatex, from gVim

I am generating a pdf output with pdflatex with the following command in gVim: :!pdflatex % This command in turns executes the following in the Command Prompt: cmd.exe /c pdflatex /testvim.tex Now, the problem I'm having with this is that the pdf is outputted to the system32 folder: C:\windows\system32\testvim.pdf How can I in...

How to open files in web browsers (e.g Firefox) within editors like vim or emacs?

How to open files in browsers (e.g Firefox) within editors like vim or emacs? Notepad++ open files in browsers by pressing Ctrl+Shift+Alt+X (Firefox). Is there a way to do this in gVim or Emacs? ...

Pressing "Home" in Vim on an Indented Line

I have a bad habit of using the 'home' key to go back to the beginning of a line. As I recently started using vim (and loving it!) I noticed that when I press the home key on a lined that is indented, it returns me to the very beginning of the line. In Notepad++ (the editor I used to use) it would return me to the beginning of the code o...

How do you auto indent a block in vim

I'm having a hard time figuring this out. I'm typing the following with the help of the AutoClose.vim plugin: function trim() {|} | is the position of my cursor. What I want to achieve is as soon as I hit enter the code should look like: function trim() { | } Instead, what happens now is: function trim() { |} ...

How do I open http://localhost in my web browser from Vim?

Basically, I want to tell Vim: Open my web browser (for instance, Firefox) Open this file (say index.php) in thought this address : http://localhost In other words: http://localhost/index.php PS: Unfortunately I use Windows XP ...