All Questions

Filter by
Sorted by
Tagged with
13
votes
2answers
15k views

Insert tabs in INSERT mode when expandtab is set

I have set expandtab in my .vimrc file to convert tab to multiple space characters. However some files (like Makefile) need actual the tab character inserted. Is there an easy way to force the ...
6
votes
1answer
666 views

diffoff on all buffers

Occasionally I have a stray forgotten buffer in which I ran :diffthis. Later when I run :diffthis on some unrelated buffer that second buffer is immediately and unintentionally highlighted with the ...
6
votes
2answers
250 views

Deleting groups of autoindents in Insert mode

In my .vimrc I have set backspace=eol,start, which allows me to backspace over line breaks and the start of what I wrote since I entered Insert mode. This does not allow me to backspace over ...
10
votes
1answer
538 views

How can I stop Vim from writing a file without throwing an error?

I'm trying to improve the code from this answer to ask for confirmation before creating the missing directory, this is what I write: function! CreateDirectoryAskConfirmation(path) if !isdirectory(...
23
votes
8answers
6k views

How to add permanent line numbers to a file?

I have a text file like this (using gVim on Windows) foo bar baz quux corge grault garply waldo fred plugh [...150 more lines...] xyzzy thud I want to add a number to each line in the file. Not ...
9
votes
2answers
290 views

How can I check spelling in HTML attributes?

Vim spell check feature works great in most cases - it is even smart enough to distinguish code from literals and comments in most languages. However I have problems with HTML spell check: <div ...
3
votes
1answer
2k views

How to make auto-indent XML in vim?

I am thinking on a similar solution, which Eclipse also does: during the editing, the editor tries to always hold in a "well-indented" format of the edited textual data. Ideally, it would happen very ...
1
vote
0answers
72 views

How do I make Vim highlight a margin? [duplicate]

I want to make Vim highlight the entire margin past column 79. I've seen other people's editors have a nice indicator bar or margin for maximum line length. What do I add to my config?
38
votes
5answers
8k views

How do I save a file in a directory that does not yet exist?

Suppose I start Vim to edit a new file in a directory that is not yet created: vim nonExisitingDirectory/newFile.txt Vim will happily show me an empty buffer and I can start writing my new file. But ...
21
votes
1answer
2k views

How to make movements respect camelCase or snake_case?

It is common to use either camelCase or snake_case to separate multiple words which form an identifier. It would be nice if the "word" movements (b, w, e) would detect those inner-identifier ...
49
votes
6answers
43k views

How to add indentation guides/lines

In Sublime Text 2, you get vertical guides where your indentation is, like this: but in vim I obviously don't: Is there a way to show lines like that in vim? By the way, my indentation is 2 spaces. ...
5
votes
1answer
82 views

Programming-oriented word swap using transwrd.vim

The plugin transwrd.vim allows to to easily swap two words by pressing <A-t> while having cursor on the latter word. For example: two words becomes words two. I think the pattern which ...
11
votes
2answers
253 views

Quickly switch between fonts at runtime

While fonts can be manually selected in GVim from the menu, I have a few preferred fonts I would like to switch between depending on the task at hand (small bitmap, larger OTF... etc). Is there a way ...
11
votes
2answers
1k views

Zsh-like tab completion of partial paths

Related to Bash-like partial tab-complete for filenames in Vim One of the truly fantastic features of zsh is that you can type, for example, ls /u/s/m/m/who.1, press Tab and have it complete to ls /...
14
votes
1answer
2k views

vimdiff and merge conflicts

When merging branches under source control there is often the issue of a merge conflict with other developers. I know that we can use vimdiff to diff code changes against source control, but is there ...
16
votes
1answer
1k views

Bash-like partial tab-complete for filenames in Vim

In Bash, when there are several files with the same prefix and I type part of the prefix and hit Tab, it completes the common prefix and allows me to continue typing to differentiate among the ...
4
votes
1answer
3k views

Set an option dependent on the filetype [duplicate]

How to configure on the .vimrc file to use a particular set options for a particular filetype, but others for a different filetype? For example, I want to enable expand tab (set tabs to be spaces) ...
4
votes
1answer
330 views

Why does Vim force programming indentation when in “gitcommit” filetype?

I found that when I am using Vim to compose git commit messages (which I have been doing for a very long time now) that there are occasionally some quirks. For example today I wrote a commit message ...
8
votes
3answers
1k views

Make :edit {file} use current directory during :Explore

I often use :Ex or :Sex to explore the filesystem from an opened file directory, or just invoke vim passing a directory to start exploring the filesystem and then opening a file. In any case, while ...
15
votes
2answers
5k views

How can I change Vim's start or intro screen?

When I start Vim without any files, I always see this: VIM - Vi IMproved version 7.4.580 by Bram Moolenaar et al. Vim is open source and freely distributable ...
132
votes
7answers
174k views

How do I use vim as a diff tool?

I use vim as my primary editor. I would also like to use vim to diff files and modify the files while doing the diff to fix easy changes (rather than most diff techniques which are a cycle of diff/...
5
votes
2answers
3k views

How does one perform a multi-line copy and paste between two sessions in Vim?

I am familiar with the y, p method of copying and pasting a line within Vim; however, I have been unsuccessful in finding a straight forward method for copying multiple lines which have been yanked in ...
14
votes
1answer
1k views

What is a Vim plugin?

I understand that we can extend the power of Vim in order to add new features or modify existing ones and enhance our editing experience. Although being myself a Vim user for quite a long time, I am ...
4
votes
1answer
603 views

How can I specify a command-line command with options as an equalprg?

I am trying to set up the Node.js version of js-beautify as an equalprg command when I am editing a JavaScript file, so that the Vim = indent commands reflow my JavaScript at the same time. Initially,...
118
votes
7answers
170k views

How do I install a plugin in Vim/vi?

How do I install a plugin in Vim? Does it matter: Whether I use vi or Vim? Whether I use gVim? Which version of Vim I'm using? What my OS is?
22
votes
2answers
3k views

Swap function arguments

When refactoring code it would be useful to be able to swap function arguments. Changing for eg: func(foo[0], bar(), baz.spam) into func(baz.spam, foo[0], bar()) Is there some way to swap ...
6
votes
2answers
2k views

Bidirectional tag stack movement with cscope in vim

When using ctags, one can move back through the tag stack by using [count]CTRL-T or :[count]pop, and forward using :[count]tag However, when using cscope instead of ctags and setting 'cscopetag', ...
26
votes
7answers
6k views

Faster way to move a block of text

Here's how I usually copy a block of text or code: Select the block with Visual mode (V) and delete it with d; or if it's just a single line, just use dd. Go to where I want the text to be, I am too ...
13
votes
7answers
2k views

How to left-align two columns of text? [duplicate]

If I have a text file like this: alpha: 1 beta: 2 gamma: 3 delta: 4 epsilon: 5 Is there a way to align the numbers like so?: alpha: 1 beta: 2 gamma: 3 delta: 4 epsilon: 5
34
votes
3answers
11k views

Can I use a non-monospaced font in either Vim or gVim?

Is there any way to use a non-monospace font in either vim or gvim? I tried changing the font for gVim with: :set guifont=Dejavu\ Serif\ 12 But this gives me some rather ugly results: I get the ...
5
votes
1answer
891 views

Adding emmet plugin to Vim in Windows

I am using Vim in my windows PC . Currently I am working with a web project and I want to use Vim as code editor. I tried to download and add the http://emmet.io/ plugin to Vim editor from this site ...
2
votes
1answer
165 views

Does vim have a learning mode to help me get used to more advanced operations? [duplicate]

I have been using vim for over 5 years and I only ever use basic cursor movements and character/line replacements. I'm not using multiple windows or buffers or registers or splits. When I want to ...
19
votes
1answer
3k views

How to define a custom popup / menu in vimrc

Assigning every useful function to a key works well for frequently used tools, but there are some operations I use so rarely, that I would prefer to assign them to some popup menu defined in my vimrc. ...
6
votes
1answer
340 views

equalprg to use for Python

Python is whitespace dependent, and it can't be totally autoindented for that reason, but there are a lot of extra stuff that should be possible to do automatically to comply with PEP8. Things like ...
6
votes
1answer
746 views

Sharing vimrc options in different computers [closed]

Can I easily keep my vimrc files consistent across multiple computers? I have different computers (laptop, desktop home and desktop work) and I want to keep my Vim configuration consistent, ...
20
votes
3answers
12k views

Keeping lines to less than 80 characters [duplicate]

The code standard that I use indicates that lines should have less than 80 chars. I want to indicate this automatically while I write to avoid raising the error later. What is a good way of showing ...
18
votes
2answers
1k views

Can I use Vi or Vim with screen readers and/or Braille devices?

Can I use Vi or Vim with screen readers and/or Braille devices? If so, how would I go about it? Does it require any special setup?
56
votes
1answer
5k views

How much money has been raised for needy children in Uganda from Vim? [closed]

As it says under :help iccf… Vim is Charityware. You can use and copy it as much as you like, but you are encouraged to make a donation for needy children in Uganda. Please see kcc below or ...
33
votes
2answers
2k views

Can I see the history of key presses in normal mode?

I know that Vim keeps history for ex commands, searches, jump locations, changes, and possibly others. With showcmd set, Vim also shows you what keys you have entered so far for a normal mode command,...
3
votes
1answer
256 views

How can I make the “gn” motion wrap to the beginning of the file?

gn is a very useful command that selects the next search result. For example, if I insert foo bar baz into a file, move to the beginning, type /[aeiou]., and press gn, it would select oo in a visual ...
20
votes
1answer
576 views

What is the correct capitalization of 'vim'?

What is the proper way to capitalize 'vim'? I have seen these variants being used: vim Vim ViM VIM Which is the correct one? Or are they all considered correct? If I look at the :help files, I see ...
16
votes
1answer
278 views

Prevent Vim from breaking up links mid-tag in markdown

Let's say I have this Markdown file: [Lorem ipsum dolor sit ](http://vi.stackexchange.com/many-links-are-often-very) Lookin' good. But the link isn't finished it, so I type -long, and now Vim breaks ...
11
votes
1answer
373 views

Map a sequence of letters in insert mode

I can already map a key combination in insert mode: :inoremap abc <do stuff> However, this has a few drawbacks: When typing a partial version of the sequence, such as ab, the characters aren'...
13
votes
2answers
411 views

Raise window holding swap file

From time to time while working on multiple projects, and / or what ever, it leaves me with (too) many Vim instances open – as happens, I open a file which already is opened elsewhere, leaving me with ...
41
votes
1answer
8k views

See the Unicode code point of the current character

How can I see the Unicode code point of the character where the cursor is? For example, if my cursor is on a ⌘ character, I'd like Vim to tell me that it is U+2318. Alternative information, such as ...
14
votes
1answer
3k views

Is it possible to easily work with .odt, .doc, .docx, .rtf, and other non-plain-text formats in Vim?

Occasionally someone sends me a .odt, .doc, and .docx file; opening them in OpenOffice is always a pain because, well, OpenOffice. Right now I use a variety of commandline tools (such as odt2txt) to ...
8
votes
1answer
431 views

Run shell commands on current file based on file extension

I'm currently doing a lot of work with both Ruby and JavaScript. I know that I can run my Ruby files with :! ruby % and likewise my JavaScript with :! node %, and that I can bind either of those to, ...
22
votes
5answers
1k views

GitHub for .vimrc and plugins

I know many people store their .vimrc on GitHub to make it easier to get right to work on new machines, and that makes complete sense to me. Including plugins, however, is problematic, because the ...
7
votes
2answers
1k views

Creating & maintaining flowcharts in Vim

Here is a simple text-based flowchart I made in Vim for a weblog post: [DNS request] | | [Adsuck] | ...
9
votes
2answers
3k views

Folding fails: vim can't find any fold

I'm trying to fold some PHP code, and I have included a cut-down version of some of the code I'm trying to fold at the end of the post. I've tried the following vim commands, but only the ex commands ...

15 30 50 per page
1
184 185
186
187 188
190