vim

Is there any way to get vim to auto wrap python strings at 79 chars?

I found this answer about wrapping strings using parens extremely useful, but is there a way in Vim to make this happen automatically? I want to be within a string, typing away, and have Vim just put parens around my string and wrap it as necessary. For me, this would be a gigantic time saver as I spend so much time just wrapping long ...

Vim: padding out lines with a character

How can I repeatedly add a character at the end of one or more lines, padding out the line(s) to a specific column? For instance: ('x' represents column 40, not a character on the line; and there are no spaces or tabs after the text) line one x line two x line three ...

ido mode filenames for vim?

I strictly use vim, but I was playing with emacs and really like ido-mode when opening files. just start typing part of a filename and it narrows down the search and just press enter when the file you want is at the front of the list. is there anything similar for vim? i've been searching with no luck. thanks ...

Change wrap width in a text file using Vim

I want to format srt subtitle text files to avoid wrapping problems on my media player. I need to set a line wrap width to a number of characters e.g. 43 I can do this with Editplus, its a built in function and works well. The reason I want to do it in Vim, firstly Editplus is only available on the PC and the secondly Vim is badass. ...

How do search for complete words in vim?

If I search for 'string'; i want to find just 'string'; and not 'qstring', 'sostring' etc ect Here are the options in my .vimrc set ic set showmatch set smartcase set incsearch ...

How to indent lines automatically?

Quick newbie question. Let's say I have the following code in Vim: void main() { int i = i + 1; return i; } I have the cursor on the empty line between the two lines of code. When I press i (or a) to enter text I want to cursor to indent to the right position (i.e. below the i in "int i..."). Any ideas how it can be done? ...

Vim - how to store and execute commonly used commands?

If I wanted to process a batch of text files with the same set of commands for example: :set tw=50 gggqG Can I save the above and run it with a shortcut command? ...

Vim python's buffer.append(line) switch window's focus

Hello Guys, I am trying to fill Vim's buffer from separate thread by using this python code. python << PYTHON_CODE import vim import time buffer_number = -1 class AppendLineTest( Thread ): def run(self): buffer = vim.buffers[buffer_number - 1] for i in range(10): buffer.append('Line number %s' % i) t...

Enabling italics in vim syntax highlighting for mac terminal

I'd like to have vim display my comments in italics, and I understand I need to place cterm=italic in the hi Comment line in the color.vim file I'm using. This, however, is having no effect on the text display, which I suspect has to do with some Terminal.app setting, unless I'm misunderstanding the vim syntax. I'd appreciate if some...

How does one navigate Ruby methods in VIM?

I'm learning VIM for Rails development and would like to easily navigate methods in a file. So far I see several options: Find 'def' by using /def<space> Create a macro that corresponds to a key using q and record use VIM marks? (not even sure what they do, they just sound promising Anyone have any better ideas? ...

Sorting words (not lines) in VIM

The built-in VIM :sort command sorts lines of text. I want to sort words in a single line, e.g. transform the line b a d c e f to a b c d e f Currently I accomplish this by selecting the line and then using :!tr ' ' '\n' | sort | tr '\n' ' ', but I'm sure there's a better, simpler, quicker way. Is there? Note that I use bash so if...

Splitting a patch in two (ideally in Vim)

I have a patch which I'd like to split into two patches. I need to split the patch with per-line granularity -- I can't just split the hunks up into two separate files. I could use Emacs diff mode, but I'm a Vim user, and I don't want to learn Emacs. I'm managing this patch in Mercurial Queues, and I've been using the crecord plugin, ...

VIM search for pattern into quickfix

Basically I need to create a quickfix buffer listing all lines that match a regex. What is the best way? The global command may not be the best, but I think it should be usable. The output of the global command is perfect, but I need it to hyperlink the matching lines. ...

How to modify existing highlight group in vim?

Hello. If i have existing highlight group in vim via link, for example hi link my_highlight_group my_default_color Is it possible to add 'bold' to my_highlight_group without changing my_default_color? Following does not work: hi my_highlight_group gui=bold Surprisingly, i can add bold if my_highlight group is defined directly (not...

Custom syntax highlighting in vim for links

I have a custom file format for graphs which looks like this: node1.link1 : node2 node1.attribute1 : an_attribute_for_node1 node2.my_attribute1 : an_attribute_for_node2 (there is nothing special about the attributes names, an attribute is a link iff one can find its value at the left of a dot. So node2 is a link, because there is a l...

backspace in vim deletes a whole word instead of one character

I think I need a setting to prevent vim (6.0) to delete an entire word instead of a character when I press a backspace. please suggest! ...

Problem with Pysmell on Vim

I've installed pysmell, and I think I did it right because I can 'import pysmell' and make PYSMELLTAGS... But when I try to autocomplete in Vim (^x^o), I get an error. I'll just post an image, since I can't seem to copy the error. I've tried asking on the Google Code page, but I didn't get any response. Pysmell error image ...

VIM highlight changed lines

Is it possible to have VIM highlight the changed lines since the last save? I know it can be done with version control, but can it be done without? I do not want to use any version control system, because the code I work on does not have that. I think UltraEdit has something like that. ...

Vim oddities in keymapping.

I like to insert blank lines without entering insert mode and I used this keymapping: nomap go o <esc> This does create the blank line but introduces some weird behaviour. I have smart indent and autoindent set. The new line follows the indents but doesn't remove them even though doing so manually automatically removes the redundant w...

To append a match efficiently in Vim :g/---/s/---/X/

How can you refer to the match in the command g in Vim? I would like to put X after the match without replacing the match. For instance, in the following command without writing the create_title twice. :g/create_title/s/create_title/X/ You should get create_titleX by running the command to create_tile ...