vim

Prevent cursor from moving back one character on insert mode exit

...how would you do it? task for extra credit: figure out a way to force vim to refresh the cursor position immediately after exiting insert mode ...

Renaming or copying files and folder using NERDTree on Vim. Is it possible?

I checked the documentation and I couldn't find a way o renaming or copying files and folder using NERDTree. Is it possible? ...

VIM Search & Replace Question

I have a block of codes with timestamp in front of each line like this: 12/02/2010 12:20:12 function myFun() 12/02/2010 12:20:13 {.... The first column is a date time value. I would like to command them out by using VIM /*12/02/2010 12:20:12*/ function myFun() /*12/02/2010 12:20:13*/ {.... I tried to search for date first: /\d\d\/...

Running a shell script in .vimrc (and processing the output)

I am trying to run a shell script from within a .vimrc file (three problems marked in the script): function! CheckMe(file) let shellcmd = 'checkme '.a:file " Start the command and return 0 on success. " XXX: How do you evaluate the return code? execute '!'.shellcmd if !result return 0 endif " Ending...

How can I make vim check automatically if the file has changed externally?

I usually open many files in tabs with vim -p. Is it possible to check if any of the files was changed outside of Vim since editing started? ...

Vim C C++ syntax highlighting

In the latest Vim: Is there a way to define a '{' such that it's ignored by the C/C++ compiler (g++) but treated like a '{' in Vim synatx highlighting? I've tried //{ but it's ignored by Vim too. ...

Vim, iconv+nr2char and iconv+"\x.."

echo strtrans(iconv( "\x80", "utf-8", "utf-32")) Outputs «??» and echo strtrans(iconv(nr2char(0x80), "utf-8", "utf-32")) outputs «<80>». Why? (zyx:~) % LANG=C vim --version VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 12 2010 07:37:05) Included patches: 1-303 Modified by Gentoo-7.2...

How to have a different buffer list for each tabs in Vim?

Is it possible to kind of "attach" a list of buffers to particular tabs within Vim? I am currently using MiniBufferExplorer, which shows all buffers in nice tabs. It can be combined using standard vim tabs but the plugin's buffer list contains all the buffers and using tabs become a bit useless. Here's an example of what I'd like: Tab A...

How can I substitute Unicode characters with ASCII in Perl?

I can do it in vim like so: :%s/\%u2013/-/g How do I do the equivalent in Perl? I thought this would do it but it doesn't seem to be working: perl -i -pe 's/\x{2013}/-/g' my.dat ...

rails vim syntax highlighting

Please excuse my naivety, I come from a world of Textmate but have decided to give vim rails a shot. I cannot get my syntax highlighting to work, I'm sure this is probably my setup but I am not vim savvy in knowing how to fix this. Commands like :Rfind etc. are working. Anyone care to give me some pointers? ...

Vim: Showing an error message from a Vim Script

I am trying to show an error message in a Vim script: function! Foo() " ... endfunction au BufWritePost *.py silent call Foo() The "throw" keyword works, but is probably not the right way to do this. I found references to "echomsg", but this doesn't have any effect: echohl ErrorMsg echomsg 'Hello World' echohl NONE I also trie...

Vim - yank into search register

Is there any easy/quick way to "yank" into vim's "last search" register ("/)? From the vim documentation, it appears that the answer is no, but that it can be assigned via a "let" command: It is writable with ":let", you can change it to have 'hlsearch' highlight other matches without actually searching. You can't yank or delete into ...

Trying to go to the definition of class/function in vim

Hi, i have installed vim 7.2 and ctags 5.8 and created the tags file with "ctags -R /foopath". I have many methods that are called with the same name in several classes, so if i put the cursor in a function calling and i execute ":tag" it shows the first of the tags listed. If the i execute ":tn" several times i finally find the method...

tips and tricks for using vim with ruby/ruby on rails

I'm one of those developers who isn't using TextMate with any of his Ruby/Ruby on Rails work. My particular loyalty in this arena lies with vim. What are your favorite tips/tricks for using vim with Ruby and/or Ruby on Rails to make you as efficient as possible when working? ...

In Vim, how do I match on "=" but not on "=="?

I've tried a number of different search patterns: [^=]=[^=] works but only if = is not at the beginning/end and it also matches the sandwiching characters =\@!==\@! seems like it should work because \@! matches nothing but requires a match, but it doesn't (see :help pattern-overview) [^=]\@==[^=]\@= also doesn't but seems like it shoul...

What could be causing Vim to switch keymaps randomly?

I've noticed a problem with Vim, where the keyboard mapping would unexpectantly change (to French I think, but I'm not sure). For example, the character 'É' appears when the key '?' is pressed. My keyboard is set to English, and I don't have any other languages on my computer. Restarting Vim fixes this problem temporarily, but the prob...

Check files in from VIM?

Directly from vim, is there a way to check files into cvs or subversion? I know I can just use a different console window to check in any changes, but it is so much more convenient to be able to do everything from the same window, if possible. ...

VIM: how to add search/replace command to vimrc and map to a shortcut

I have two search/replace commands that I find myself running in vim fairly often to clean up html code so I can copy/paste it online. The commands are: :%s!<!\&lt;!g :%s!>!\&gt;!g I wanted a way I could map both of these commands to be run together ... I did some searching for how to use the :map commands in vimrc, however, I can't ...

Managing line width in ColdFusion

If you work with ColdFusion, you've probably gotten used to either line-wrapping or horizontal scrolling. Infrequently, this isn't so bad, but when three out of four lines in an existing code base are wrapped, sometimes twice, it becomes a huge readability hindrance. A line such as... <cffunction name="v_multiple_item" access="public"...

vim plugin comment blocks

I looked around, but didn't find what I wanted. I need a vim plugin to insert blocks of code and prompt me for values in the comment. // ********************** BeWee ************************ // *** Creation Date: // *** Last Modification Date: // *** File name: BeWee.cpp // *********************************...