Questions tagged [vim]

An open-source text editor which is typically run from the command line. A minimal version is included in Ubuntu by default but the full version is available in repositories. Questions should relate to using Vim on Ubuntu.

Vim is a configurable text editor most commonly used as a command line application. It is free open-source software in active development, and the full version is available in Ubuntu repositories. A minimal version is installed by default.

Resources:


Helpful question for beginners: http://askubuntu.com/questions/252760/how-do-i-save-files-edited-with-vim

812 questions
274
votes
8 answers

vi shortcut to delete "until the next X character"

I understand that vi has shortcut keys to delete characters, words and lines with various options. However, I could not find this: delete from the cursor to the next specified character For example, I might type du" expecting the editor to…
kctang
  • 2,843
232
votes
7 answers

What is the difference between Vi and Vim?

I would appreciate it if someone can let a newbie know what the differences are between vi and vim. I've heard Vim is a successor to vi but whenever I try to open vi in Ubuntu it opens vim instead.
Ethylene
  • 2,421
  • 2
  • 13
  • 4
94
votes
4 answers

How to Display Hidden Characters in vim?

How can I configure vim to display hidden characters like tabs or spaces ONLY while those characters are typed? I do not want tabs and/or space replaced with special characters like ">" or "_" when the file is written.
dan0
  • 943
66
votes
4 answers

How do I save files edited with vim?

I can't save changes after editing sudo vi /etc/network/interfaces Text before editing: auto lo iface lo inet ... Edited to: auto eth0 iface eth0 inet dhcp What key combination or sequence must I press to save this?
And
  • 791
49
votes
8 answers

Vim editor, how can I save a file in other directory

I'm new in the world of ubuntu and vim editor. My question is: how can I save a file on my localhost using vim? When I use the command :w I save the file, but where? And how can I change the file location to /var/www/?
berga007
  • 639
  • 1
  • 5
  • 10
48
votes
2 answers

What features does vim-tiny have?

So, the cut down vim-tiny is installed by default in Ubuntu. I don't mind using it, but I can't find documentation and most of the commands I'm used to from normal Vim don't work. So far I've discovered that :n and :N go between buffers and :split…
James
  • 1,016
37
votes
3 answers

How do I get vim to keep its undo history?

If I'm editing two files with vim, changing to the other file ( :bnext, :bprev ) seems to drop the undo history from the open file - hitting the 'u' key reports "Already at oldest change". For example: vim testfile1 testfile2 add some stuff to…
Jeremy Kerr
  • 27,199
32
votes
2 answers

How do I get VIM to remember the line I was on when I reopen a file?

I just moved from RH/Fedora to Ubuntu 12.04. In RedHat, when I reopen a file with VIM, it opens with the cursor on the line it was on when I closed the file. However, what I am seeing now is that when I reopen a file, the cursor is always at the…
pennyrave
  • 453
31
votes
3 answers

Changing Vim editor settings?

How do I change default settings of Vim editor such as setting auto indent, setting Tab space to 4 and changing text colors? Also how to set vim as the default code editor?
25
votes
5 answers

What is the command in the terminal to update Vim on Ubuntu?

I'm on Ubuntu 12.04 and want to know how to update Vim via the command line. What is the command to update this?
Patoshi パトシ
  • 2,993
  • 15
  • 32
  • 44
24
votes
4 answers

Exit file explorer in Vim without closing

I have been trying to figure out how to exit the file explorer in Vim. :q works, but it closes Vim as well, not just the file browser. Am I missing something or is this a bug?
flyingfisch
  • 313
  • 2
  • 4
  • 14
23
votes
6 answers

What do % and ! mean in Vim commands?

In Vim, :%!ls executes ls command and prints its output to the current editable file. But what do % and ! mean separately in vim? Is it possible execute ls and not put its output to document?
vico
  • 4,527
  • 21
  • 58
  • 87
19
votes
5 answers

How to delete second column in Vim?

I have a tab-delimited file like: name1 verb1 name2 verb2 etc... I want to delete the second column. I tried editing one of these answers, but being not familiar with sed and awk, I couldn't. Can anyone help me?
teaLeef
  • 445
18
votes
2 answers

Why is my vimtutor blank?

I want to learn Vim. The vast majority of people advise me to use vimtutor. I downloaded the package and ran it, but I just get given a blank screen. I see on Youtube that there should be tons of things on there. But I am not getting it...How can I…
dayuloli
  • 7,355
  • 2
  • 18
  • 25
15
votes
3 answers

Permanently convert tabs to spaces in vi / vim

If I wanted to have traditional indentation in vi / vim, I would enter these commands: :set tabstop=4 :set shiftwidth=4 :set expandtab It is tedious to type those commands every time I open a file. How do I permanently store those settings?
JoJo
  • 253
1
2 3
8 9