vim

how to run few vim commands in a raw

Hello. This is really noob question. There is set of vim commands : command1 : command2 etc., which I would neet to type in in a raw quite often. How to I make it automatic? It is simple regexp replace command set, however I cannot script those in sed, since it involves non-latin locales and for some reason vim handles non-latin r...

Start gvim multiple tabs, cursor at specified line in each one

Howdy, I can start Gvim and be positioned at a line gvim file1 +10 or I can start Gvim and have 2 files in tabs gvim -p file1 file2 is there an invocation which does gvim file1 +10 file2 +20 the above opens with file1 at line 20, file2 at line 1 I want file1 at 10, file2 at 20. Thanks, Kent ...

Is there a way to click a link in Firefox and open a file in an existing VIM session?

Hi there, I know it's possible to open links in an html page (let's say, if you're using Firefox) with TextMate if the link has this format: <a href="txmt://open?url=file:///home/.../index.html.haml">View</a> But is it possible to do a similar thing with VIM? Perhaps like so: <a href="vim://open?url=file:///home/.../index.html.haml"...

Vim, how to scroll to bottom of a named buffer

I have a vim-script which splits output to a new window, using the following command: below split +view foo I've been trying to find a way from an arbitrary buffer to scroll to the bottom of foo, or a setting to keep it defaulted to showing the bottom lines of the buffer. I'm doing most of this inside of a python block of vim script....

How to convert hexadecimal to decimal in a substitution statement?

I have a line like this: pad (2) = 0x0041 I wanna change the hex into decimal and the expected result is pad (2) = 65 I just tried :%s/\(.*\) = \(.*\)/\1 = \=printf("%d", submatch(2)), but it failed. Would you help to solve this? ...

Vim doesn't expand <cfile>

Hi, I'm having a problem when trying to make vim expand the file name under cursor. For example: include("../path/file.php"); When the cursor is on file name and I type gf the file.php is opened just fine. However, when I remap the gf command in vimrc this way: map gf :tabnew <cfile><CR>, then instead of opening the file in a new tab...

Vim hanging after parsing .vimrc (even a blank one) file on Solaris 10

Hello all, I am having a problem with vim 7.2 hanging (for about 10 seconds) after it parses the .vimrc file. I had a similar issue in the past with tcsh on linux, but it was resolved by setting TERM to xterm-color. The same does not resolve the issue here. Any idea what may be causing this? $ env USER=redacted LOGNAME=redacted HOME=...

Vim: different key mapping for different window

My .vimrc file has filetype mappings for different filetypes such as : autocmd FileType sh map gf ... autocmd FileType ruby map gf ... While rewriting a program from one language to another, I have 2 splits, one with a shell script and one with ruby. I would assume that "gf" would take on its mapping based on filetype. However, it can ...

Specifying the Python interpreter for vim's :python command

(Mac)Vim seems to be picking up /usr/bin/python instead of the one that's at the front of my path (/Library/Frameworks/Python.framework/Versions/2.6/bin/python) when I use the :python command. Is this entirely a compile-time thing or can I somehow override it? ...

How to make a file with .pt extension, with xml syntax highlighting and vim's plugin snipmate load pt.snippets?

I have the following in my .vimrc: au BufNewFile,BufRead *.pt set filetype=xml This is needed because although I'm editing a file with *.pt extension, it's indeed a valid xml file: setting the filetype like this I can have syntax highlighting. I'm using vim's snipmate plugin, and tried to create pt.snippets to specific needs since th...

Vim: Smart indent when entering insert mode on blank line?

When I open a new line (via 'o') my cursor jumps to a correctly indented position on the next line. On the other hand, entering insert mode while my cursor is on a blank line doesn't move my cursor to the correctly indented location. How do I make vim correctly indent my cursor when entering insert mode (via i) on a blank line? ...

Vim - Activiting html snippets on php files

Hello i am using vim and snipMate i very times i need to name the html files to php, just because 1 or 2 lines of code. I every time i create an php file no introduce html and i have to activate the html snippets manually with the command set ft=php.html I intend to activate it automatically in this this line on my vimrc autocmd Buf...

Make a Vim plugin that calls a bash script.

Sometimes I edit a file that represents a server restart. I would like to "bind" this restart to my vim session, so, after saving a file, it would call a bash script that would restart for me. For example, calling :wapache automatically calls restart_apache.sh somewhere in my machine. Is this possible? Is there a plugin that would orga...

vim trick to align blocks/end keywords in Ruby?

Is there a way to simply have my blocks and their closing end keyword align properly with vim? If I have a function which is nested with several conditions, things can start to get ugly fast. Can vim save the day? ...

Avoiding jagged text when pasting into vi?

Hello Although I have no problem using SecureCRT (5.1.2 build 274) to work from Windows and connect to PC's running Linux, I have a problem when connecting to an embedded Asterisk appliance that provides"vi" through BusyBox 1.4.1 (2008-03-10). The issue I'm having, is that when I paste code into vi, the text appears jagged like this: ...

regex unicode charater in vim

I'm being an idiot. Someone cut and pasted some text from microsoft word into my lovely html files. I now have these unicode characters instead of regular quote symbols, (i.e. quotes appear as <92> in the text) I want to do a regex replace but I'm having trouble selecting them. :%s/\u92/'/g :%s/\u5C/'/g :%s/\x92/'/g :%s/\x5C/'/g .....

Has anyone got the vim taglist plugin working with Scala?

I'm having trouble getting the taglist plugin working properly with Scala. I've installed the plugin and ctags and verified that it works properly with Java and C++. I then followed the instructions on this page (minus the Lift specific instructuions), but was nothing shows up in the taglist window when I open it while editing a Scala ...

Smooth scrolling and syntax highlighting in MacVim

Is there any way to get MacVim to scroll more smoothly TextMate style? While I'm here, is there a syntax file I can edit to add syntax highlighting to files? I have Velocity .vhtml files which are largely regular HTML with a bit of VTL thrown in. If I could just add .vhtml as an extension to the HTML syntax highlighter that would alread...

Mapping a default key binding in vim

I want to remap Ctrl-] which is used for jumping to the tags to another key binding. These mappings work: :map <F2> <C-]> :map <A-1> <C-]> But this mapping doesn't work: :map <C-1> <C-]> What might be the reason for this? ...

Run a macro in all buffers in vim

I know about the :bufdo command, and was trying to combine it with a macro I had recorded (@a) to add a #include in the proper spot of each of the header files I'd loaded. However, I couldn't find an easy way to run the macro on each buffer. Is there a way to execute a macro through ex mode, which is what :bufdo requires? Or is there ...