> Also, the "." command has been limited in capability because it
> doesn't allow me to mix complex motion and insert commands.
Macros help there, but they do require forethought, unlike .
///ark
It's a tradeoff, in my opinion. In exchange for bracketing insertions
with i and Esc, you get to navigate without moving your hands from the
home row (and without most of the multi-key chording necessary with
emacs).
How long have you been using Vim? I've been using it for almost 25
years, off and on, beginning with a version I wrote myself. I still
get irritated at it (mainly when I forget to leave insert mode) but
I'm still learning lots of cool things to do with it. Because I've
gone back and forth to other editors, I've confirmed to myself that
Vim really is the most pleasurable for me to use. Maybe you should try
using a "standard" editor (or even emacs) for a while to see if Vim is
really for you?
///ark
I've used TextMate for about eight months, and I've used Vim on and
off over the past couple years. I've been using Vim nearly exclusively
over the past six weeks, studying the commands closely when editing,
but even as I've gotten comfortable with the commands that are
supposed to be Vim's most powerful, I've seen no productivity gain
worth mentioning. The reputation of Vim is that, once you get over the
"learning curve", things are great, and I think that I've at least
gotten over the first curve. I think that Emacs may end up catering
more to my style, but I haven't really done much of anything with it.
Here's what I think is the big problem: I can't use all of Vim's neat
navigation commands when in insert mode. When editing my code, I often
do many small edits within the same line. "esc + w + i" gets old fast.
On May 2, 10:32 pm, Mark Wilden <m...@mwilden.com> wrote:
> On May 2, 2008, at 7:20 PM, 703designs wrote:
>
> > It's being a pain in the ___ to work with.
> > Constantly having to press "Esc" and "i" gets old quickly when you
> > just want to do quick edits, and I have yet to find an alternative.
>
> It's a tradeoff, in my opinion. In exchange for bracketing insertions
> with i and Esc, you get to navigate without moving your hands from the
> home row (and without most of the multi-key chording necessary with
> emacs).
>
> How long have you been using Vim? I've been using it for almost 25
> years, off and on, beginning with a version I wrote myself. I still
> get irritated at it (mainly when I forget to leave insert mode) but
> I'm still learning lots of cool things to do with it. Because I've
> gone back and forth to other editors, I've confirmed to myself that
> Vim really is the most pleasurable for me to use. Maybe you should try
> using a "standard" editor (or even emacs) for a while to see if Vim is
> really for you?
>
> ///ark
Erik Falor
Registered Linux User #445632 http://counter.li.org
The key word is: customizability and variability. Everyone is different,
so I bet that my vimrc and my custom plugins, keymaps and colorscheme
would probably not suit you very well.
Find out which kinds of tasks you use repetitively; these are the ones
to make shorter and faster, but depending on what they are for, there
are several ways to make them easier:
- mappings (but which kind? see |map-overview|)
- abbreviations (they are not the same as mappings but the difference is
subtle)
- functions
- user-commands (sometimes it is useful to define a user-command which
does nothing else than invoke a user-defined function).
and also, to make Vim behave differently by default:
- option settings
- autocommands
- scripts of the various kinds distributed with Vim, but which should be
housed in other 'runtimepath' directory trees -- $VIMRUNTIME is for the
distribution only, and anything in that tree can be silently replaced by
any upgrade, and probably will -- next week, or two years from now.
Summary: no task too big, no task too small; just identify them, and
find the right tools for them.
One very important thing: study the help. Not from beginning to end, but
the way you would pass the time with a fascinating encyclopedia: start
with something which you find interesting, or with anything at random,
and follow links to other articles, and from there to still others. [You
wouldn't read a dictionary from A (letter) to A (abbreviation) to a
(article) to a- (prefix) to -a (suffix) to whatever comes next in
straight alphabetic sequence until you get to zymogen to zymotic to
zymurgy to Zyrian, would you?]
To that goal I have found the following useful:
:help
:help {subject}
try it literally: brace, s, u, etc.; and see
:help 'wildmenu'
:help 'wildmode'
:help c_wildchar
:help c_CTRL-D
the latter two (and also the two above them)
for helptag completion, after typing :help
plus part of the name of a help subject.
Also for all other kinds of completion of course
Ctrl-I (next jump)
Ctrl-O (previous jump)
Ctrl-T (previous tag)
these three to navigate help history
and, last but not least: the |:helpgrep| command.
Best regards,
Tony.
--
If an elephant is left tied to a parking meter, the parking fee has to
be paid
just as it would for a vehicle.
[real standing law in Florida, United States of America]
Here's what I think is the big problem: I can't use all of Vim's neat
navigation commands when in insert mode. When editing my code, I often
do many small edits within the same line. "esc + w + i" gets old fast.
I would say that, unlike with e.g. Notepad, Vim's learning curve is slow
but long -- you don't learn the same percentage of it the first day, but
you keep learning for years, until you reach heights of which a Notepad
user would never dream. I would say Notepad is like the step between the
road and the sidewalk: you scale it in one step but it doesn't bring you
very high -- while Vim is like a long winding road: there may be quite a
travel from the seaboard to the mountaintop, but oh boy, what a
landscape! -- and you can enjoy it long before you reach the end (if
ever you do).
Best regards,
Tony.
--
"To err is human, to forgive, beyond the scope of the Operating System"
See ":help i_CTRL-O": hitting Ctrl-O in Insert mode will let you execute
one Normal-mode command (which can be as short as k or as complex as a
full ex-command) and thereafter you'll be back in Insert mode. Also, Vim
can use the arrow keys: compare what the following do in Insert mode,
they do "almost" the same.
<Esc> w i
<Ctrl-O> w
<Ctrl-Right>
Another example:
<Esc> k a
<Ctrl-O> k
<Up>
Best regards,
Tony.
--
"See - the thing is - I'm an absolutist. I mean, kind of ... in a way ..."
True Vim usage only occurs when you frequently use f (with ; and ,) to move the
cursor within the current line, and c to change text (stuff like 'ct,' for 'change
to comma'). Then, you get real benefits from the . repeat. This applies mainly to
editing programs, although I suppose it might sometimes help with poetry.
It's useful to force yourself to study the following. You don't have to worry about
the more esoteric things like ! for filter, but you need to be really familiar with
the keys on the three main rows:
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
John
Why not? I have a bunch of mappings in my .vimrc that lets me use the
shortcuts/mappings that are common to most windows software...
/H.
For me, vim (vi from "way back") is intuitive because I just think
where the cursor is to go and it moves -- I don't think of the
individual keys any more, so much as "move it over there". The "3
lines down, 2 words and 4 letters left" is subconscious. Really.
The same way with editing, My thought process is "the word is wrong,
let me change it to `fred`". My fingers to the walking without
direction.
Once you get past the (first) learning curve and adapt to a modeful
editor, you won't notice the <esc> and "i" any more that emacs-heads
notice one finger always on <ctrl> or <alt> -- or how you move and
click the mouse to navigate web pages.
Hope this offers some encouragement!
-BryanE
I consider myself to now be a pretty good vim user, but 6 weeks wasn't
even the tip of the learning-to-use-a-modal-editor iceberg for me -
I'd say it took me around two years to really get to the point where
my fingers did the work without me thinking about what buttons to
press, and until you hit that point, a modeless editor is almost
certainly faster.
Just my $0.02.
~Matt
What am I missing?
but really, C-o (WOW!! I just learnt that!!!) is
---
Ditto...now if I can remember it.
Only 'down' was forgetting I was in insert mode again after the command, but
it's just habit.
I'd rather use a different {lhs}, preferably an F key: Ctrl-A (in Normal
mode) is useful to increment a number.
Yes, I know Ctrl-A is "Select All" in most other GUIs but Vim is older
than that convention, and trying to enforce it in Vim (as well as Ctrl-C
for Copy rather than Interrupt, Ctrl-V for Paste rather than Block
Visual (from Normal) or Literalize (from Insert), Ctrl-X for Cut rather
than Decrement, Ctrl-Z for Undo rather than Suspend, etc.) led to the
"mswin.vim" script of ill repute, which prevented countless Windows
users from learning Vim smoothly.
Best regards,
Tony.
--
Slurm, n.:
The slime that accumulates on the underside of a soap bar when
it sits in the dish too long.
-- Rich Hall, "Sniglets"
It should be working, but maybe something is preventing it. If you're
using Vim 7 or later, you can try
:verbose map jj
:verbose map! jj
Best regards,
Tony.
--
There's little in taking or giving,
There's little in water or wine:
This living, this living, this living,
Was never a project of mine.
Oh, hard is the struggle, and sparse is
The gain of the one at the top,
For art is a form of catharsis,
And love is a permanent flop,
And work is the province of cattle,
And rest's for a clam in a shell,
So I'm thinking of throwing the battle --
Would you kindly direct me to hell?
-- Dorothy Parker
works for me in gVIM(Win) but I am concerned that it will confuse me given
that j is the command that I use most frequently. In fact that concern
applies to all the keys. So I think I will stick with C-[ It is not so
hard now that I have got used to pressing the control key with the side of
my hand (UK keyboard).
> -----Original Message-----
> From: vim...@googlegroups.com [mailto:vim...@googlegroups.com]On
Weird. Seems straightforward. At least the Ctl-o worked...
-l
I meant an editor that uses the standard UI for the OS. For example,
TextEdit for Macs or Notepad for Windows.
///ark
Michael Henry
My overall reaction to your question is: post the
actual commands that you repeat most often. Most
likely there is a way to do them more efficiently.
One of the strong points of vim is *precisely*
that whatever it is you do repeatedly can be
accelerated by shortcuts and automation.
This list is really helpful, but posting vague
question will only generate vague replies.
* 703designs [2008.05.02 22:30]:
> Constantly having to press "Esc" and "i" gets
> old quickly when you just want to do quick
> edits, and I have yet to find an alternative.
What "quick edits"?
You've already got answers involving <C-O> and
<C-]>.
Also see:
:h ins-special-keys
:h ins-special-special
> I suppose I could map Ctrl+A to do the tedious
> "ggVG" to select all text...
You want to select all text to do what exactly?
Lots of Ex-commands take a range of lines to act
on. In that case, the whole file is usually
specified with '%', which really isn't that
tedious.
I don't remember the last time I needed to "select
all text".
> I'm still editing slowly...
If you're still editing slowly, something is
missing from your repertoire of commands/habits.
> I feel like I've given Vim a very fair shake;
> what am I doing wrong?
From what you write, you're not doing *anything*
wrong. Quite the opposite: you've read the docs,
switched to using vim only, and posted to this
list ;-).
Perhaps you underestimate the learning curve...
But my advice is: post more specific questions.
--
JR
> This list is really helpful, but posting vague
> question will only generate vague replies.
On the contrary - I think this thread has generated many interesting
(and specific) messages.
> I don't remember the last time I needed to "select
> all text".
"Selecting all" is actually so common that two major OSs devote keys
specifically to that purpose.
///ark
There are a couple mentioned here (I think):
http://vim.wikia.com/wiki/Vim_documentation
What I would recommend however, is studying the page in the first link above. In
Vim, use help to get more info (yes, I know it's a bit abrupt, but you get used to
it). For example, for 'c':
:help c
That refers to 'motion' which you can double-click, or put the cursor on it and
press Ctrl-] (and Ctrl-t to return).
John
Ed is the standard text editor.
Want proof?
http://www.gnu.org/fun/jokes/ed.msg.html
:-)
Michael Henry
> I'm *sure* he must be talking about Ed.
>
> Ed is the standard text editor.
>
> Want proof?
> http://www.gnu.org/fun/jokes/ed.msg.html
>
> :-)
Actually, back in the late '80s, I was something of a guru with edlin,
the MS-DOS line editor that everyone was guaranteed to have available.
I talked more than one secretary through editing AUTOEXEC.BAT with it
over the phone. :)
///ark
For such, I usually use
:%y
:%d
or, since the Ex yank/delete commands can take a register, this
is often done as
:%y+
:%d+
(sometimes using "*" instead of "+" as my target register) to put
the file in the system clipboard. It's short to type, and is
tweakable on the fly--such that if I just want from the current
line to the end of the file, I can use
:,$y+
or from the beginning to the current line:
:1,.d*
If Ex commands aren't your thing, you don't actually need to use
Visual mode for what you're doing:
ggdG
ggyG
will delete/yank the whole file.
-tim
See ":help mapmode-ic". ":map!" applies to both Insert/Replace and
Command-line modes, like ":map" applies to Normal, Visual and
Operator-pending. Thus using ":map" both with and without bang applies
to all modes.
Best regards,
Tony.
--
Speak roughly to your little boy,
And beat him when he sneezes:
He only does it to annoy
Because he knows it teases.
Wow! wow! wow!
I speak severely to my boy,
And beat him when he sneezes:
For he can thoroughly enjoy
The pepper when he pleases!
Wow! wow! wow!
-- Lewis Carrol, "Alice in Wonderland"
Well, ":help change" brings you to the help for the ":change"
ex-command, which is maybe not what you were looking for; however
looking at the status line shows that you're in a helpfile named
"change.txt" -- that might be interesting. Hit gg or, if you don't yet
know about that very useful movement, drag the scrollbar thumb all the
way to the top; and you'll see the table of contents of that helpfile
about making various kinds of changes.
Best regards,
Tony.
--
"I argue very well. Ask any of my remaining friends. I can win an
argument on any topic, against any opponent. People know this, and
steer clear of me at parties. Often, as a sign of their great respect,
they don't even invite me."
-- Dave Barry
The problem with Alt-letter is that Vim doesn't distinguish them from
[letter + 0x80] so Alt-a is á (a-acute), Alt-c is ã (a-tilde), Alt-v is
ö (o-umlaut) and Alt-x is ø (o-slash). Depending on which language(s)
you use, that might be a problem in Insert mode.
On Apple, maybe Command-c involves the same physical key as Alt-c on a
PC but I thought Command-c did more or less the same as Ctrl-c on a PC,
and that the close (functional) equivalent of Alt-c was Option-c ?
Best regards,
Tony.
--
Today is the tomorrow you worried about yesterday
>If you're still editing slowly, something is
>missing from your repertoire of commands/habits.
That could very well be it. "Learning vi|vim|*" isn't simply
translating one set of commands for another, ie, it ain't simply riding
the 'x' key instead of riding the <del> key to delete an entire line of
text, one char at a time (urg...). It means "thinking in 'vi'" in terms
of the command-set, like learning '14dd', visuals, marks, etc., to do
editing-in-bulk. If his "lots of little commands" might be to, eg,
switch the case of every word in a title-line, *maybe* he's doing
something like
x
iT<esc>
w
x
iN<esc>
/ad nauseam/, until the last word, instead of a single ':s///' command
using '\u' on each word, and getting it done in one shot. Done the
former way, yeah, there ain't all that much "gained" by switching to
'vim', etc.
It's analogous to "speeding up" a program by squeezing every byte and
clock-cycle out of routines that still use a bad algorithm; changing
the algorithm itself can result in a dramatic speed-up. Eg, think of
generating CRCs by individual bit-shifts and XORs, vs using a simple
lookup table.
The OP was advised to look at both
:verbose map jj
:verbose map! jj
and he found his imap in the output of the latter, which was the
expected result. The reason I told him to check both was in case he has
mistyped it without the initial i.
Best regards,
Tony.
--
Niklaus Wirth has lamented that, whereas Europeans pronounce his name
correctly (Ni-klows Virt), Americans invariably mangle it into
(Nick-les Worth). Which is to say that Europeans call him by name, but
Americans call him by value.
I've been following the other postings regarding possible changes to Vim
to better handle modifier keys like Alt. Hopefully in the future Vim
will be able to distinguish Alt+letter from accented letters and the
like. I'm sure there will always be terminals that can't provide enough
information to Vim, but hopefully that won't be enough to hold back the
terminals that can. I'm looking forward to the day when I can map
Alt-Enter successfully. Even on Gvim, the following doesn't work for me
(yet :-)):
:imap <M-Enter> <Ctrl-o>o
> On Apple, maybe Command-c involves the same physical key as Alt-c on a
> PC but I thought Command-c did more or less the same as Ctrl-c on a PC,
> and that the close (functional) equivalent of Alt-c was Option-c ?
>
Yes, on OS X there are four modifier keys: Shift, Control, Option, and
Command. They are physically in the same positions as Shift, Control,
Windows key, and Alt on a standard U.S. 104-key keyboard. Shift and
Control have the same meaning on both platforms. On OS X, the Option
key (also labeled Alt/Option on some keyboards) is the same as the
Windows Alt key semantically. The Command key on OS X has no direct
equivalent on Windows, and the Windows key has no direct equivalent on
OS X. As a system-wide convention on Windows, Ctrl-C means "Copy"; on
OS X, the system-wide convention is that Command-C means "Copy".
Happily, Vim lets me arbitrarily map Alt-C on Windows and Command-C on
OS X. I choose to map them both to mean "Copy" so I can press the same
physical keys on either platform. Ideally, there would be some simple
mapping I could perform system-wide that would let me put the physical
keys in the same place on both platforms. Unfortunately, it's not
really possible to do that in a satisfactory way. It's possible to
trade the positions of the Control and Command keys on OS X, for
example. That way, pressing the physical Control key with "C" would
actually generate Command-C, which would be the "Copy" operation
expected by a Windows touch typist. Unfortunately, in a terminal
emulator the Ctrl-C operation for breaking a running program would no
longer be in the expected position. The user would need to press the
physical Command key along with "C" to get a true Ctrl-C. Similarly,
Emacs-style editing keys integrated throughout OS X would no longer work
as expected. Ctrl-a would normally move to start of line (in Bash, for
example, as well as in the standard text edit box on OS X). With the
Control and Command keys exchanged, one would need to press Command-a
for the same purpose.
So in my .vimrc, I test whether I'm running on a mac and map accordingly:
if has("mac")
imap <D-c> <C-Insert>
else
imap <M-C> <C-Insert>
endif
(The "D" modifier means "Command" on OS X.)
I probably would have chosen the Windows convention and mapped OS X's
Ctrl-C to the "Copy" operation, but I'd like to retain Vim's meaning for
these control characters.
Michael Henry