Gentoo Archives: gentoo-user

From: daid kahl <daidxor@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Commenting out multiple lines in vim
Date: Sat, 14 Feb 2009 04:21:15
Message-Id: 3ac129340902132021u704eba0bx76311db6a8f43535@mail.gmail.com
1 > >>> In vim, you can just select the rectangular region with Ctrl-v,
2 > >>> then type "I#<ESC>". This will insert # in each line at the same
3 > >>> column.
4 > >>
5 > >> If you want to comment a series of lines m-n , it's quicker to do :
6 > >>
7 > >> :m,ns/^/#/
8 > >
9 > > I saw similar comments in my Google searches, but I am flummoxed how one
10 > > could find it so.
11 > >
12 > > Is it only on my keyboard that forward-slash is a "lower-case" character
13 > > that is accessed *without* the shift key deployed?
14 > >
15 > > How do you know m & n?
16 >
17 > Column and line numbers are shown on the lower right part of the screen.
18 >
19 > You can also enable line numbering, either in command mode using "set nu",
20 or in ~/.vimrc (which I prefer since I always like line numbers, except if
21 I'm copy and pasting...then it's annoying). There is also a macro I made
22 (stole from somewhere and modified) to enter the date on \d entered in both
23 command mode and entry mode, which I find handy for journals or timestamp
24 comments in code. You can, of course, rearrange and edit how the time
25 appears if you dislike my style.
26
27 "Timestamp script for command (normal) mode
28 nmap \d :execute "normal i" . strftime("%d %b %Y %H:%M:%S ")<CR>
29 "Timestamp script for insert mode
30 imap \d <C-R>=strftime("%d %b %Y %H:%M:%S ")<CR>
31
32 Is there any way to access the vim buffers from other than vi? Using
33 Konsole, if I want to copy something from vim I have to highlight with the
34 mouse and right click, which is annoying. I really just want a better way
35 to copy from Konsole that doesn't involve right click. At least
36 shift+insert works for pasting from elsewhere...
37
38 ~daid

Replies

Subject Author
Re: [gentoo-user] Re: Commenting out multiple lines in vim Stroller <stroller@××××××××××××××××××.uk>