gvim

Autocommand not working in Vim, how to set makeprg based upon the filetype?

Hi I use Vim editor for programming and here's the problem that I am facing. I am using multiple tabs to edit C++ and Python files simultaneously and I have added the following in my .vimrc file filetype plugin indent on au filetype python set mp=python3\ % au filetype cpp set mp=g++\ -Werror\ -Wextra\ -Wall\ -ansi\ -pedantic-errors...

Vim step-by-step: How do you line up arbitrary text by arbitrary delimiter?

Background: There are a lot of great tutorials and "tricks" pages for Vim, but one thing that is very difficult is to find specific instructions on how to do some arbitrary thing that one can easily do in one's own familiar text editor IDE. Therefore I am asking for step by step instructions on how you I would do something in Vim that I...

Error using the :GDiff command of fugitive.vim using gvim for windows and msys git 1.7.0.2

I've been using git along with fugitive.vim to manage code when I'm on windows. However, I've run into a problem. According to the documentation, the :GDiff command should a diff window and allow me to stage only parts of a file. However, when I issue the command in a file with changes, I get the following error message: Is this a prob...

how to detect lines of code with regex in VIM

Hi, I have so many println("") in my codes .. I know it is messy ... I want to put comment for each of the println(""); how to do that in VIM ? I mean I want to do that on multiple files. Also if possible, can it detect whether the lines has // already or not ... if the lines has been commented .. I don't want to add new // ...

Changing Case in Vim

Is there a command in Vim that changes the case of the selected text? ...

Is there a way to use a substring function on variables in .vimrc?

I have gVim and portable python stored in a DropBox folder on several machines. The location of the DropBox folder is different on each computer. However, I'd like to be able to setup the .vimrc so that it automatically references the correct python folder no matter what computer it's on. For example, I have gVim in C:\DropBox\gVimPor...

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"...

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...

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? ...

What does the :compiler command do in Vim?

I recently found that there is a command in Vim called compiler. You can call it with any common compiler (for example, :compiler gcc, :compiler php, etc.), but it doesn't seem to have any immediate effect. I searched on the manpages but didn't find anything useful about what it actually does, nor does the Vim Wiki. Does anyone know wha...

XSD traversal in VIM

I use VIM as my text editor and I edit a lot of XML and WSDL files. WSDL files have an XSD section. Is there some VIM plugin I can use to traverse the XSD types? i.e., if I have the following line and the caret is where the '|' sign is: <xsd:element minOccurs="0" name="FooName" type="Magic|FooType"/> and I press Ctrl+Alt+Foo (or some...

How to Alphabetize a CSS file in Vim

I get a CSS file: div#header h1 { z-index: 101; color: #000; position: relative; line-height: 24px; margin-right: 48px; border-bottom: 1px solid #dedede; font-size: 18px; } div#header h2 { z-index: 101; color: #000; position: relative; line-height: 24px; margin-right: 48px; border-bot...

How to change all selected chars to _ in Vim

I try to draw a class diagram using Vim. I fill the editor window with white-spaces. Type :match SpellBad /\s/ to highlight all the white-spaces. Ctrl+Q to select vertical white-spaces. Shift+I to insert Bar(|) and then Esc ........................... v+l +... + l to select horizontal white-spaces But I don't know how to change all s...

Using RVM with GVim (Cream): rvm command not found.

I am trying to move to GVim(cream) as my primary editor on Ubuntu. I am using the wonderful rails.vim, however I also am using RVM. Rvm works fine when doing things in a shell, and the ruby version I would like to use in rails.vim is the version set as default (but not the system version). When I try to run things like :Rgenerate migr...

Macvim: horizontal scroll bar

Using macvim, which is awesome. However I would love to have some kind of horizontal scroll bar. Is this possible? ...

How can I map a key to execute a program, and show its output in GVim?

On my .gvimrc, I have the following line: map <f4> :!./%< On a source file, I have to press F4 and then enter, but it works correctly, shows the output, and hangs until I press enter again. If I change it for: map <f4> :!./%< <CR> It behaves shows the output, but doesn't wait until I press enter (and so the output becomes imposs...

vim search by syntax-highlighting type

I'm adding i18n to an existing project (web application). This involves replacing every bit of static text with calls to an i18n library. It would be convenient to be able to search for this text rather than rely on syntax highlighting to identify it visually. In vim, is it possible to search within a file for occurrences of a certain...

vim - howto close all buffers in the current tab?

Hello, I know that using a command like: :%bdelete Using this command I can close all buffers, in all tabs, what I'd like to do is to close all buffers open in the current tab, is that possible? Usage: What I'd like to do, is to open ViM and load :VSTreeExplorer and then open related files in the same window switching between them ...

Opening Vim and using some command in normal mode from the Terminal?

I want to be able to open Vim and automatically make some commands in normal mode (in this case, open two buffers put a mark in one line on one line, fold another line, and go to the bottom of the file). The closest thing I found would be using the -c or + command line switch, however these execute commands in Ex mode. For example, I wo...

Enablind and Disabling word wrap automatically on different file extensions on Vim

I usually have to read .txt files with long lines, and at the same time edit some source file, and I like to see word wrap on the .txt files, and not in the ones that aren't. Of course I can :set wrap and :set linebreak, but is there any way to make it automatucally, and dependent of the file extension? ...