vim

vim indenting in ex

Is there a command in ex equivalent to gg=G ? ...

Mapping <C-Tab> in my vimrc fails in Ubuntu

I want to map ctrl-tab to :tabn, and ctrl-shift-tab to :tabp. I had it working for gVim in Windows XP, but moved it to my .vimrc in Ubuntu 9.10 and it doesn't work (vim 7.2). Here's the relevant section of my .vimrc: nmap <C-Tab> :tabn<CR> nmap <C-S-Tab> :tabp<CR> nmap <C-t> :tabnew<CR> <C-t> works fine, so mapping the ctrl key does...

Problem with recognizing "\t" for vim in python output.

I have a python code something like this file_out.write(str(i).strip()+"\t"+str(dict1[i]).strip()+"\n") But when i try to recognize this with vim by saying on the file that was written. :%s/\t/|/g But it does not recognize the \t ...

Clear all currently defined vim macros

Hi everyone I have a vim macro that I keep mistyping, usually when I'm trying to save something so I do it quickly and I can't work out what keys I pressed. It is annoying as it pastes some irrelevant bash code into my file so I have to undo the erroneous pasting which also undos the last thing I typed that I do want. I was looking fo...

VIM: globally match line, delete this and 2 following lines

The following is what I have in mind: % g/All Claims\t 0/3d This doesn't work, though (it seems to be invalid syntax to multiply an action in this mode). I did end up with the following sequence: qq /All Claims\t 0 3dd q 10000@q That macro combination worked out just fine. I'm simply curious if there's something that would have bee...

Vim: change formatting of variables in a script

I am using vim to edit a shell script (did not use the right coding standard). I need to change all of my variables from camel-hum-notation startTime to caps-and-underscore-notation START_TIME. I do not want to change the way method names are represented. I was thinking one way to do this would be to write a function and map it to...

Can you access registers from python functions in vim

It seems vims python sripting is designed to edit buffer and files rather than work nicely with vims registers. You can use some of the vim packages commands to get access to the registers but its not pretty. My solution for creating a vim function using python that uses a register is something like this. function printUnnamedRegister(...

Adding custom highlighting for project's API function names in Vim

Hi How can I add new function names for .c and .h files to be highlighted, similar to this http://stackoverflow.com/questions/2464593/custumizing-syntax-highlighting-in-vim but much easier? (as I don't need to color words in different colors, only in the default color for keywords as defined by my the...

how you usually quiting/closing vimdiff mode?

Hello, I am using vim with fugitive extension http://www.vim.org/scripts/script.php?script_id=2975 It has :Gdiff command which brings you into vimdiff mode, but what is the right/quick way to close/quit vimdiff mode? i.e. let's say I am editing file FooBar.txt under git repository, then firing up :Gdiff, review my changes in vimdiff an...

How can I split the Vim window vertically, and make the bottom panel some height?

With the [N]sp option, I can split a Window and make the Top panel of size N. Is there any way to make the bottom panel of some size? ...

vi script problem on autocmd

I want to create a template for all my python scripts using this autocmd bufnewfile *.py so ~/.vim/templates/python_skeleton.txt the content of python_sekleton.txt is as simple as this: #!/usr/bin/python # -*- coding: utf-8 -*- print 'Hello World' but vi give error message when i start to edit a new python script: line 2: E488...

Vim replacing tabs with double spaces

So I've written some code of an assignment and i forgot the universities polocy of indent with 2spaces. Normally I'ld have put a: vim: ts=2:tw=2: et: at the top of my files, but this time i forgot. How should I go about replacing all tabs with 2 space? would s// work? (repalcing and with the respectiove characters. ...

Setting the vim color theme for highlighted braces

Hello: How do you change the vim color scheme for highlighted braces? I'm looking to actually edit the .vim theme file to make the change permanent. Regards, Craig ...

Configuring vim to open new windows on Windows 7

On my old Windows XP laptop, which I set up about 2 years ago, I have vim71 installed. I renamed vim.exe to vi.exe. And when I invoke vi with a file name from a Windows Command Prompt, vi opens up the file in a new window. (By "new window", I mean a window in the Microsoft Windows sense, not in the vi sense.) The Command Prompt is th...

Vim, LaTeX, word-wrapping, and version control

I'm writing a LaTeX document in vim, and I have it hard wrapping at 80 characters to make reading easier. However, this causes problems with tracking changes with in version control. For example, inserting "Lorem ipsum" at the beginning of this text: 1 Dolor sit amet, consectetur adipiscing elit. Phasellus bibendum lobortis lectus 2 ...

How to unload all the plugins from vim and change VIMRUNTIME ?

Hello my problem is this: I have an account at my hosting providers server and I can't install my own copy of vim. So the only personalization I can make is editing .vimrc in my account, but it won't suffice What I'd Like to do is: on startup I'd like to unload all the plugins and loaded stuff, and tell vim to use other folder as its' r...

How to syntax-highlight XML in CDATA elements in Vim?

Vim's syntax highlighting for XML/XSL is great, except it turns off all syntax highlighting in CDATA regions. Is there a way to turn on syntax highlighting on in CDATA regions? At work, we have a lot of XSL code embedded within other XML documents. It would be great if I could get all of the goodness of XML editing for the embedded XSL ...

vim autopopulate file

Is it possible to have VIM auto populate a file based on the extension? For example, when I open a new .sh file, I would like VIM to automatically type #!/bin/bash as the first line. (This example simplified down to the essentials) ...

How do I get Ctrl-Backspace to delete a word in vim within gnome-terminal?

I'd like Ctrl-Backspace to delete the current word in vim insert mode. From within xterm I can pull this off via :inoremap <C-H> <C-W> but in gnome-terminal I cannot figure out a way to make it happen. When in vim insert mode, if I type control-v and then press backspace, I get ^H in xterm, and ^? in gnome-terminal. Unfortunately, ...

Syntax Highlighter for a Domain Specific Language

Hello Friends I have a DSL for which I intend to create a syntax highlighter for editors like vim, gedit and netbeans. Has anyone tried this before? Many thanks for any directions. Ketan ...