vim

Vim search for a pattern and if occurs delete to end of line

I am trying to search a text file for a certain pattern. If this pattern occurs then it means that the rest of the line is not needed and therefore can be deleted. I have tried using the following commands, but so far have been unsuccessful. :%s/{pattern}/d$ :g/{pattern}/d$ If anyone has any suggestions they would be greatly appreci...

Undo Close Tab in Vim

I close a tab in vim and immediately realize I need to re-open it again for something. Is there a way to undo close tab in Vim 7.2? ...

Any shortcut to open file in vim?

I want to open a file in vim like in Eclipse using "Ctrl + Shift + R", I type the file name and I get the options of all the files matching that name. I know opening it normally like: tabe: <filepath> new: <filepath> edit: <filepath> The problem here is that I have to specify the whole file path in these cases. Thanks in advance. ...

How can you have a xEmacs-like-Auctex in MacVim?

I would like to have a figures right in my MacVim, similarly as in xEmacs' AucTex. ...

Vim encryption: how to break it?

Recently I decided to encrypt my engineering log using vim's :X encryption feature. I wrote down the password, but evidently I misspelled something or messed something up because decrypting the file just gives gibberish. To make matters worse, all my backups are somehow corrupted (don't ask, I am not sure how either). I am not going...

Can I make vim respect my .gitignore files?

I was wondering if there is a way to get vim to read .gitignore files and use them to determine options not to present when auto-completing filenames. For example, working in python, I'd like to not see .pyc files offered for editing. I think vim has its own mechanism for this, I was wondering how to load information from .gitignore in...

VIM for XAML editing

Can VIM be used for XAML editing? ...

Vim for Word (or something like it)

Are there any rich-text editors that have Vi(m) keybindings? Specifically, something like Word where I can compose a document with colors, headings, et al. but use Vi(m) bindings to move around and compose? ...

How can I emulate Vim's * search in GNU Emacs?

In Vim the * key in normal mode searches for the word under the cursor. In GNU Emacs the closest native equivalent would be: C-s C-w But that isn't quite the same. It opens up the incremental search mini buffer and copies from the cursor in the current buffer to the end of the word. In Vim you'd search for the whole word, even if you ...

Should I switch from vim to emacs, and if so any suggestions?

First of all, I love vim. I have been using vim for a few years now and it has changed my perceptions of what an editor is capable of. I also love modes. However I am thinking of switching and here is why: I really like Xcode and it has emacs bindings. I use Mac OS X and it has emacs functionality in all text input fields. I hate using...

Vim forgetting its history when a file becomes read-only

After I commit a file to Perforce, it becomes read-only. If I have this file open in vim, I've just lost my undo-redo history, without even being asked. How do I make this not happen? ...

How can I add * to the end of each line in Vim?

I tried the code unsuccessfully :%s/\n/*\n/g ...

Is it possible to get gVim to remember window size?

I know how to set the initial window size in gVim, but how do I get it to automatically restore the window dimensions from last session? Is this even possible? ...

Is learning VIM worth the effort?

As a programmer I spend a lot of hours at the keyboard and I've been doing it for the last 12 years more or less. If there's something I've never gotten used to during all this time is these annoying and almost unconscious constant micro-interruptions I experience while coding, due to some of the most common code editing tasks. Things li...

_Painless_ integration of Eclipse with Vim?

Hi, Has anyone managed to get Vim integrated into Eclipse painlessly? I just want to use Vim for the editor while retaining the general Eclipse interface. I have tried using Eclim plugin but the editor seemed to crash more often than work (the site said that the editor replacement functionality is still beta). On the flip side, is ther...

How to get better bracket matching/alignment in VIM?

Hi, Is there any way to make VIM put the brackets in the right indentation? For example, whenever I type: if (something) do something and then I hit enter after "do something", to have it jump back in line with the if statement? Also, when I go into insert mode, can I make it so it automatically jumps to the correct indentation ...

Changing Variable Names in Vim

I am trying to read a lot of c/perl code through vim which contain many single letter variable names. It would be nice to have some command which could help me change the name of a variable to something more meaningful while I'm in the process of reading the code so that I could read the rest of it faster. Is there some command in vim...

Vim copy and paste

My previous question seems to be a bit ambiguous, I will rephrase it: I have a file like this: copythis abc replacethis1 xyz qwerty replacethis2 hasfshd replacethis3 fslfs And so on... NOTE: replacethis1, replacethis2, replacethis3, ... could be any words How do I replace "replacethis1","replacethis2","replacethis3",.. word by "copy...

Can terminals detect <Shift-Enter> or <Control-Enter>?

Is it possible for the terminal to detect < Shift-Enter > or < Control-Enter > keypresses? I am trying to configure vim to do key mappings that use these sequences, and while they work fine in gvim, they don't seem to work in any terminal console. The curious thing is that although < C-Enter > is not detected in vim, mapping < Enter > ...

VIM: Save and Run at the same time?

I do a lot of Python quick simulation stuff and I'm constantly saving (:w) and then running (:!!). I'm wondering, is there a way to combine these actions. Maybe a "save and run" command. Thanks for your help. ...