vim

Unable to replace a space with a new line in Vim

I know the thread. I run :%s/ /s/\n/g I get E488: Trailing characters 2nd example I run :%s/ /\n/g I get text^@text I run the same codes also with the following settings separetaly set fileformat=unix and set fileformat=dos How can you replace with a new line in Vim? ...

VIM Disable Automatic Newline At End Of File

So I work in a PHP shop, and we all use different editors, and we all have to work on windows. I use vim, and everyone in the shop keeps complaining that whenever I edit a file there is a newline at the bottom. I've searched around and found that this is a documented behavior of vi & vim... but I was wondering if there was some way to d...

Unable to create a file from a path in Vim

I have often PATHs for files which do not exist in my codes. I run as my cursor is at a PATH which does not exist CTRL-W f I get E447: Can't find file "~/bin/editors/emacs/python_mode" in path The long way of creating new file is Ctrl-W v :args [copy_paste_the_path_with_mouse] Do you know any short way of creating a new file i...

in vim, how to combine ^] and arge, to follow a tag and also add it to the arg list?

I can get the word under the cursor with or , and I can use that to open a file and add it to the arg list. For example, with the cursor over a java class name, at line 45: :arge +45 mydirhere/<cword>.java But I don't know how to pass into the the tag mechanism, so it will return the file name (and line number), that can be passed ...

Unable to set syntax highlighting automatically in Vim

I have the following in my .vimrc syntax on filetype plugin indent on # Thanks to Jeremy I run vim ~/.vimrc I get the right syntax highlighting. I source many files in my .vimrc. My .vimrc is a like a roadmap for me where I navigate by CTRL-W f The problem occurs when I navigate to a file which I have sourced: no colors. ...

Unable to color a syntax which is not identified by Vim

Please, see Idigas' answer which describes best what I am trying to do. My color-theme is the following I have the following in my .vimrc hi NonText ctermfg=4 hi normal ctermfg=3 hi number ctermfg=1 hi todo ctermbg=3 The problem is at the bottom of the picture: nmap gn :bnext where all are yellow. H...

Get ctags in vim to go to definition, not declaration

I'm having the problem that ctags takes me to a forward declaration allot of times instead of to the actual definition of the function. Any way to get around that? ...

Word / Code Completion in VIM

I know that I can get word completion through CTRL+N & CTRL+P and code completion through omnifunc with CTRL+X CTRL+O. I additionally tried Supertab (very nice), because I'm used to TAB-completion. That all worked all right. I would like to see possible matches while I'm typing, so I also tried autocomplpop.vim, witch does just that. W...

Same _vimrc, two different computers.

I have one folder synced between two computers (using one of online sync tools). I have gVim installed in this folder and I am wondering, is there a way, that I can distinguish those two computers in _vimrc file? I know that testing with if has("win32") ... elseif has("macunix") ... endif I can check different operating syst...

Regular expression explanation for vim

If I want all the lines with the text 'ruby' but not 'myruby' then this is what I would do. :g/\<ruby\>/ My question is what is the meaning of lesser than and greater than symbol here? The only regular expression I have used is while programming in ruby. Similarly if I want to find three consecutive blank lines then this is what I wo...

How to select between brackets (or quotes or ...) in vim ?

I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally). So I'll just ask nice and simple ... what is the easiest way to select between brackets, or quotes, or ... generally a list of matching characters ? write ( *, '(a)' ) 'Computed solution coefficients:' For example, ...

Does Vim have an auto-comment feature based on the file's syntax?

I'm not sure this is possible, but I'm interesting in making this happen. Ideally, I would like to map this feature to shift+control+3. I'm looking for a way to have Vim enter a comment (single line) which corresponds to the syntax of the file I'm editing. If there are multiple single-line comment styles, Vim/I can pick one. If the sing...

Are Python commands suitable in Vim's visual mode?

I have found the following command in AWK useful in Vim :'<,'>!awk '{ print $2 }' Python may also be useful in Vim. However, I have not found an useful command in Python for Vim's visual mode. Which Python commands do you use in Vim? ...

How do I setup REPL on vim?

I have installed vimclojure to make it easier to start learning clojure. But, I haven't been able to setup REPL inside vim. This is essentially because I was not able to write a maplocalleader in vim(?) Based on the documentation in vimclojure/doc/clojure.txt I put the following in my .vimrc to start the REPL - :map <LocalLeader>sr *s...

Why does vi behave differently in Ubuntu than in CentOS?

I've been getting more and more comfortable using vi on a daily basis, but one thing that bothers me is that when I use it on Ubuntu it behaves differently than when I use it on CentOS (and probably other places). I actually prefer the way it works in CentOS. Here are three things that are really bothering me on Ubuntu: In CentOS ins...

Vim comma command keys

I downloaded this vimrc file. It contains entries for mapping comma seperated keys to certain commands. ie: map ,e :e <C-R>=expand("%:p:h") . "/" <CR> What i can't figure out is how to run these commands in Vim. How to i run ",e"? ...

Programming Java with Vim

I have tested many editors out there, but Vim makes me addictive. I really wish to use Vim in all of my programming. I just tried to start learning the Java programming language and I have a huge book that I'm trying to start to read for that purpose, but the sad thing about it is that I don't have either a Java compiler or a .class file...

How to get rid of empty blocks in vim

I used textmate to work with ruby code for over one year. Recently I switched to using mvim. When I open some of the files in mvim I get empty blocks. Look at this picture to get a feel for it. Any idea on how to get rid of them? Thanks ...

vim keystroke for \ type hotkeys?

What do I type in i, n, and v mode to do say the following hotkey? \sd \sf Also I am using this plugin in cygwin? This is the plugin and the hotkeys Warning PDF that I am trying to use. ...

Invoking javac.exe within Vim

Hi everyone. I had previously asked a question about using Vim to develop Java, but I ended up realizing JDK works very well and that Ant is wayyy too much complicated for a starter like me. Things got a little bit clearer, and now I have a question again. When I work with a file such as 'filename.java', I need to be able to use 'javac...