All Questions

Tagged with
Filter by
Sorted by
Tagged with
3354 votes
35 answers
1.4m views

How do I make git use the editor of my choice for editing commit messages?

How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
brasskazoo's user avatar
  • 77.4k
2413 votes
34 answers
982k views

Indent multiple lines quickly in vi

It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
Allain Lalonde's user avatar
2017 votes
22 answers
952k views

How to duplicate a whole line in Vim?

How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/↓ in Eclipse?
sumek's user avatar
  • 27.4k
1506 votes
27 answers
631k views

Turning off auto indent when pasting text into vim

I am making the effort to learn Vim. When I paste code into my document from the clipboard, I get extra spaces at the start of each new line: line line line I know you can turn off auto ...
Rimian's user avatar
  • 37.5k
1422 votes
16 answers
999k views

How do I move to end of line in Vim?

I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?
salt.racer's user avatar
  • 22.1k
1104 votes
38 answers
1.1m views

How can I make Vim paste from (and copy to) the system's clipboard?

Unlike other editors, Vim stores copied text in its own clipboard. So, it's very hard for me to copy some text from a webpage and paste it into the current working file. It so happens I have to either ...
Santosh Kumar's user avatar
830 votes
70 answers
134k views

What are the dark corners of Vim your mom never told you about? [closed]

There are a plethora of questions where people talk about common tricks, notably "Vim+ctags tips and tricks". However, I don't refer to commonly used shortcuts that someone new to Vim would find cool....
797 votes
30 answers
531k views

Differences between Emacs and Vim

What practical, objective differences are there between Emacs and Vim? For example, what can be done using one but not the other (or done more easily with one than the other)? What should I know in ...
790 votes
28 answers
1.3m views

Copy all the lines to clipboard

Is there any way to copy all lines from open file to clipboard in VI editor. I tried yG but it's not using clipboard to store those lines. So is it possible?
Xinus's user avatar
  • 30.1k
465 votes
34 answers
276k views

What are the benefits of learning Vim? [closed]

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, it's these ...
390 votes
11 answers
169k views

Using Vim's tabs like buffers

I have looked at the ability to use tabs in Vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers. I would like every ...
indentation's user avatar
  • 9,955
362 votes
12 answers
98k views

How can I swap positions of two open files (in splits) in vim?

Assume I've got some arbitrary layout of splits in vim. ____________________ | one | two | | | | | |______| | | three| | | | |___________|...
wes's user avatar
  • 7,985
301 votes
5 answers
265k views

Go to first line in a file in vim?

How do I go to first line in a file in vim ?
Jean's user avatar
  • 22.2k
259 votes
10 answers
138k views

Disabling swap file creation in Vim

Is there a way to disable the creation of .swp files in Vim? Or, at least create them in one place so that I can find and delete them easily? I find swap files especially annoying when I copy the ...
Nadia Alramli's user avatar
213 votes
6 answers
64k views

Saving vim macros

Does anyone know how to properly save/reuse macros recorded inside of a vim editor?
jnadro52's user avatar
  • 3,574
212 votes
11 answers
73k views

How do you return from 'gf' in Vim

I am using Vim for windows installed in Unix mode. Thanks to this site I now use the gf command to go to a file under the cursor. I'm looking for a command to either: return to the previous file (...
JayG's user avatar
  • 4,429
209 votes
13 answers
124k views

How to comment out a block of Python code in Vim

I was wondering if there was any key mapping in Vim to allow me to indent certain lines of code (whether those lines have been selected in visual mode, or n lines above/below current cursor position). ...
Rishabh Manocha's user avatar
209 votes
60 answers
59k views

What is the best way to force yourself to master vi? [closed]

A good while ago, I read an article by the creator of viemu, clearing up a lot of the misconceptions about vi, as well as explaining why it's a good idea (and why it's been very popular for the last ...
203 votes
14 answers
89k views

How to paste in a new line with vim?

I often have to paste some stuff on a new line in vim. What I usually do is: o<Esc>p Which inserts a new line and puts me in insertion mode, than quits insertion mode, and finally pastes. ...
static_rtti's user avatar
  • 54.7k
198 votes
7 answers
40k views

Delete text in between HTML tags in vim?

I know di< will delete in an HTML tag itself. Is there an easy way to delete text in between two tags? <span>How can I delete this text?</span> Thanks!
CMB's user avatar
  • 4,115
165 votes
38 answers
57k views

Favorite (G)Vim plugins/scripts? [closed]

What are your favorite (G)Vim plugins/scripts?
159 votes
7 answers
86k views

Can you grab or delete between parentheses in vi/vim?

Given this line of code in C: printf("%3.0f\t%6.1f\n", fahr, ((5.0/9.0) * (fahr-32))); Is there a way to delete or yank from the first bold parenthesis to its matching parenthesis? I thought about ...
romandas's user avatar
  • 4,146
140 votes
11 answers
68k views

How can I maximize a split window?

Invoking :help in Vim, I got the help manual page with split window. I want to maximize the help manual window and close the other window. How can I do this? What is the Vim command to do this?
cola's user avatar
  • 12.3k
125 votes
17 answers
145k views

Vim file navigation

I'm trying really hard to learn vim after using TextMate for the last few years. I've started to commit some of the in-file navigation to memory but I'm struggling with navigating between multiple ...
Pete's user avatar
  • 2,593
117 votes
6 answers
63k views

Find and Replace within selection in `vi`

How do I do a Find and Replace within a selection in vi?
Agnel Kurian's user avatar
  • 58.7k
101 votes
10 answers
86k views

Vim yanking range of lines

I'm a C# developer who has just recently decided to expand my knowledge of the tools available to me. The first tool I've decided to learn is Vi/Vim. Everything has been going well so far, but there ...
jnadro52's user avatar
  • 3,574
98 votes
16 answers
61k views

How do you prefer to switch between buffers in Vim?

I've tried MiniBufExplorer, but I usually end up with several windows showing it or close it altogether. What I'd like is something like LustyJuggler with incremental search, the way I switch between ...
Alexey Romanov's user avatar
93 votes
7 answers
32k views

Is there an interactive way to learn Vim? [closed]

Years ago I was looking for a way to learn Vim that didn't involve a wall of text, or scrolling through vimtutor without knowing the commands to do so. I wondered if anything else existed for such a ...
eggonlegs's user avatar
  • 1,844
92 votes
4 answers
54k views

VIM: How can i open a file at right side as vsplit from a left side NerdTree panel?

I installed NerdTree plugin. How can i open a file at right side as vsplit from a left side NerdTree panel ?
cola's user avatar
  • 12.3k
91 votes
5 answers
33k views

Vim - yank into search register

Is there any easy/quick way to "yank" into vim's "last search" register ("/)? From the vim documentation, it appears that the answer is no, but that it can be assigned via a "let" command: It is ...
Dan's user avatar
  • 10.3k
90 votes
12 answers
39k views

How to navigate in large project in VIM

How do you manage big projects (hundreds of files) using only VIM? I personally start having problems in any larger than small project. is there any way to quickly 'go to file', preferably with name ...
Jakub Arnold's user avatar
  • 86.4k
83 votes
6 answers
114k views

How to do column editing in vim?

Vim is pretty powerful when editing by line - the search/replace tools are modeled to work linewise. But what if I want to change a particular column across all lines? For example, how can I change ...
Lazer's user avatar
  • 92.6k
68 votes
3 answers
31k views

Find and replace whole words in vim

To find and replace all instances of a word in vim, I use %s/word/newword/g How do I change this so that it only finds instances of "word" that are whole words?
neuromancer's user avatar
  • 54.7k
68 votes
4 answers
32k views

git rebase --editor=/something/other/than/vim? (for easier squashing)

I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with ...
Sridhar Sarnobat's user avatar
65 votes
5 answers
45k views

Opening files in Vim using Fuzzy Search

I'm looking for a way to make Vim have the ability to open a file by fuzzy-searching its name. Basically, I want to be able to define a project once, and then have a shortcut which will give me a ...
Edan Maor's user avatar
  • 9,932
62 votes
6 answers
25k views

How to launch an EDITOR (e. g. vim) from a python script?

I want to call up an editor in a python script to solicit input from the user, much like crontab e or git commit does. Here's a snippet from what I have running so far. (In the future, I might use $...
sam's user avatar
  • 773
59 votes
7 answers
32k views

Undo all changes since opening buffer in vim

How can I undo all changes since opening a buffer? I imagine there may be some form of :earlier that does this. UPDATE: Many are suggesting solutions for traversing to earlier file writes. This isn't ...
David Rivers's user avatar
  • 2,915
59 votes
6 answers
24k views

How to save all files in tabs on Vim?

If I have multiple files in tabs on VIM and I edit few of them. How to save them with one command?
rp101's user avatar
  • 1,289
58 votes
4 answers
68k views

How do I delete the last character in each line using vim

I have a file: 12345a 123456b 1234567c 12345678d 123456789e How do I delete the last character in each line. And the file will be 12345 123456 1234567 12345678 123456789
Larry Lu's user avatar
  • 1,639
58 votes
3 answers
40k views

In vim, how do I highlight TODO: and FIXME:?

In vim, FIXME and TODO are highlighted, but I can't get FIXME: and TODO: (note the colon after the keyword) to highlight? What should I put in my .vimrc to make this happen?
Paul Biggar's user avatar
  • 28.2k
57 votes
6 answers
17k views

In vim, is there a plugin to use % to match the corresponding double quote (")?

The % key is one of the best features of vim: it lets you jump from { to }, [ to ], and so on. However, it does not work by default with quotes: Either " or ', probably because the opening and ...
static_rtti's user avatar
  • 54.7k
56 votes
29 answers
36k views

Is it worth investing time in learning to use Emacs?

Right up front: I do not want to start a religious war. I've used vi for as long as I can remember, and the few times I've tried to pick up Emacs I've been so lost that I've quickly given up. Lots of ...
Andrew's user avatar
  • 12k
52 votes
4 answers
54k views

How do I jump to the beginning of line in vim?

How do I go to the beginning of the line in vim editor in normal mode? Is it possible to using my Home key on keyboard on Linux?
user avatar
50 votes
4 answers
39k views

How to edit a diff/patch file cleanly ? Are there any patch file editors?

Scenario: I have a patch file that applies cleanly to my working files, but I do not want all the changes from the patch. Usually, I do vim example.patch, remove unwanted changes and them apply ...
My_patch_question's user avatar
48 votes
3 answers
11k views

Automatically scroll screen in vim when near top/bottom?

I would like to have smarter screen scrolling when I'm editing. When I reach within X number of lines from the top/bottom of the screen, I would like it to scroll the screen as I continue moving the ...
CMB's user avatar
  • 4,115
47 votes
10 answers
20k views

Align text on an equals sign in vim

I tend to align code on equal signs for better readability. From this: $ = jQuery.sub() Survey = App.Survey Sidebar = App.Sidebar Main = App.Main To this: $ = jQuery.sub() Survey = App....
iblue's user avatar
  • 30k
45 votes
2 answers
10k views

Reflowing comment blocks with vim

I'm cleaning up someone else's code and working with vim. I'd like to reflow the comments so that they're formatted consistently. For example: # one two three four five six seven # eight ...
oalders's user avatar
  • 5,269
44 votes
2 answers
88k views

Vim: No write since last change, even though I changed the file [duplicate]

I'm trying to set up a file on my ubuntu machine, but when I try to change the contents before saving the file I've just created, vim returns the error: No write since last change. I've created the ...
Lenny Will's user avatar
39 votes
9 answers
39k views

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 ...
MichaelThompson's user avatar
38 votes
18 answers
11k views

I am looking for tips for learning Vim or Emacs the smart way

I am a quite happy user of Eclipse (I mostly develop in PHP and Python), however I found the answers to "What specific productivity gains does Vim/Emacs provide over GUI text editors?" interesting ...
mac's user avatar
  • 42.6k

1
2 3 4 5
10