Vim uses an alternative set of key binding for moving around, though the
usuall arrow keys work fine, but what every Vim user would recommend you
is to use the Vim style which is: h -> left, j -> down, k -> up and l ->
right (all in normal mode). I know it might look a bit odd at the first
place, but believe me, the moment you get comfortable with these keys,
you'll start pushing them even for your web browser.
You can use x to delete a character in normal mode, or d.
dd deletes a line, and o opens a new line to insert below the cursor; O
opens a new line to insert above the cursor and D deletes from cursor to
the end of the line.
(note that D means shift + d)
Undo is u and redo is Ctrl+r.
One of the most interesting features of almost every command in Vim is
that you can specify a counter for them, meaning that one would enter
10dd to delete the next 10 lines or 5ix to insert xxxxx. Nice, huh?!
And the last point for today's tutorial is :help.
Try these to learn more:
ZZ to save and quite; equivalent to :wq
:help x
:help :q
:help :w
Here come to give u moral support to keep posting this here.
Gain benefit from it also. ^^
On Jul 21, 1:10 pm, "meisam sarabadani" <meisam.sarabad...@gmail.com>
wrote:
> peyman thats fantastic, please go ahead, i dun let you stop this great job
> :D
>
better keep it in a single thread...we got too many emails to manage.....
On 7/22/07, Behdad Kh < behd...@gmail.com > wrote:O N L Y V I M
As a suggestion , isnt it better if you post each session as a single thread ? then if we had a question regards that
session simply we just post on that specific thread , another thing is just write a short session title then we can refer
to them in future , i think it makes it a good classified VIM tutorial by peyman taher .
You know how much we love you man ;)
--
Wong Ya Ping <ypw...@mmu.edu.my >
Lecturer, Faculty of Information Technology,
Multimedia University, Cyberjaya, Malaysia
Tel: +6 03 8312 5393
Loc: http://www.wikimapia.org/#y=2928421&x=101641163&z=18&l=0&m=a&v=2
GCS/ED/M/P/S/SS d+ s+:+ !a C++ U+ P+ L+>+++ E- W++ N+ o+++ w--- PGP t+>++ 5+ X+ tv- b+$ G++ e+++>++++
On Jul 21, 12:21 am, "Peyman Taher" <peyman.ta...@gmail.com> wrote:
--
Wong Ya Ping <ypw...@mmu.edu.my>
Lecturer, Faculty of Information Technology,
Multimedia University, Cyberjaya, Malaysia
Tel: +6 03 8312 5393
Loc: http://www.wikimapia.org/#y=2928421&x=101641163&z=18&l=0&m=a&v=2
GCS/ED/M/P/S/SS d+ s+:+ !a C++ U+ P+ L+>+++ E- W++ N+ o+++ w--- PGP t+>++ 5+ X+ tv- b+$ G++ e+++>++++
...hmm..as for me, I can't seems to remember things after a long time i don't use it. I used to be really good with vi long long time ago..before most of you people were born, certainly before you guys knew a,b,c.. :) Now i can only remember a few command. :(
Also, so far, it's really "vi" and you haven't touched "vim" yet
right?
Ian
Actually, have you thought of writing a small manual on this? (Of
course, using your own examples).
Also, so far, it's really "vi" and you haven't touched "vim" yet
right?
Ian
/it
On Aug 2, 12:26 am, "Reza Iranmanesh" <reza.iranman...@gmail.com>
wrote:
Multimedia University, Cyberjaya, Malaysia
Tel: +6 03 8312 5393
Loc: http://www.wikimapia.org/#y=2928421&x=101641163&z=18&l=0&m=a&v=2
GCS/ED/M/P/S/SS d+ s+:+ !a C++ U+ P+ L+>+++ E- W++ N+ o+++ w--- PGP t+>++ 5+ X+ tv- b+$ G++ e+++>++++
For near-light-speed result, I use the Ctrl+[ combination, and have
gotten used to it:
left pinky on the left ctrl, and right pinky on the [.
Nazri.
--
Cubert: That's impossible. You can't go faster than the speed of light.
Farnsworth: Of course not. That's why scientists increased the speed of
light in 2208.
I want to know what editor Tim O'Reilly uses: vi or emacs? Could you please tell us why?
-- Chris
Chris,
I have to confess that I'm a "vi guy." When I was new to UNIX, I actually started out using emacs (not GNU emacs, but Gosling's Emacs, in the early days of the emacs wars) and loved it. But then one day, I discovered that someone had blown away the custom emacs profile that I had gotten comfortable with. It took about a week for me to get it restored, and in the meantime, I switched to vi, and got hooked.
What I especially liked about vi was precisely that I didn't have to have all these nifty customizations to make it really usable. What really distinguished vi from emacs in my mind was that it was just there on any system I sat down at--tremendously portable. I didn't have to copy my emacs profile around to sit down and do useful work on someone else's machine.
Once you learn vi's admittedly unintuitive style, it is remarkably easy to use and tremendously powerful. Like a lot of things about UNIX, it only *seems* difficult. After a small barrier to entry, it is orders of magnitude more powerful and easy to use than commercial word processors. (But that's true of emacs as well!)
Despite emacs' higher profile as a free software poster child, I think more people actually use vi than emacs. We sell more copies of our vi book than of our emacs book -- almost twice as many each year. This could be because emacs has a free manual that is distributed with it. But I saw a matching statistic at Linux Expo, where O'Reilly sponsors a vi vs. emacs paintball game each year. I happened to check the signup list, and noticed that there were about twice as many people signed up for the vi team as for the emacs team. (Maybe they just like the vi t-shirt -- the team "uniform" -- more than the emacs t-shirt, but I don't think so.)
But I don't want to pour gasoline on this fire, any more than I want to pour gasoline on the perl vs. tcl vs. python fires. Both vi and emacs are great editors, and both are very widely used within O'Reilly. If you went down the list of our editors, you'd get strong partisans of each.
P.S. If you want to read more on why I like vi, you need only turn to the opening pages of our book Learning the vi Editor. While I don't have an author credit on the cover, I actually wrote a large part of the fourth and fifth editions, including the opening paean to the virtues of vi.
--Tim
someone better start and emacs version of this before this whole
newsgroup becomes vi fanatics ... :-P
The funniest part was then using Windows and editing using notepad. I
kept on pressing "i", "h", "j", "k", "l", etc etc instead of just
typing it out!.
But then, I still think that Emacs should have a following as it is
after all not just an editor, some call it a programming language
whilst some even call the environment an operating system!!
Ok, who's an Emacs person here ... hands up!
On Aug 11, 12:07 pm, "Peyman Taher" <peyman.ta...@gmail.com> wrote:
> I just found something worthy to share here:
>
> Date: Jun 21 1999
> From: Chris Cera
> To: ask_...@oreilly.com
> Subject: Editor: vi or emacs?
>
> I want to know what editor Tim O'Reilly uses: vi or emacs? Could you please
> tell us why?
>
> -- Chris
>
> ------------------------------
>
> Chris,
>
> I have to confess that I'm a "vi guy." When I was new to UNIX, I actually
> started out using emacs (not GNU emacs, but Gosling's Emacs, in the early
> days of the emacs wars) and loved it. But then one day, I discovered that
> someone had blown away the custom emacs profile that I had gotten
> comfortable with. It took about a week for me to get it restored, and in the
> meantime, I switched to vi, and got hooked.
>
> What I especially liked about vi was precisely that I didn't have to have
> all these nifty customizations to make it really usable. What really
> distinguished vi from emacs in my mind was that it was just there on any
> system I sat down at--tremendously portable. I didn't have to copy my emacs
> profile around to sit down and do useful work on someone else's machine.
>
> Once you learn vi's admittedly unintuitive style, it is remarkably easy to
> use and tremendously powerful. Like a lot of things about UNIX, it only
> *seems* difficult. After a small barrier to entry, it is orders of magnitude
> more powerful and easy to use than commercial word processors. (But that's
> true of emacs as well!)
>
> Despite emacs' higher profile as a free software poster child, I think more
> people actually use vi than emacs. We sell more copies of *our vi
> book*<http://www.oreilly.com/catalog/vi6/>than of
> *our emacs book* <http://www.oreilly.com/catalog/gnu2/> -- almost twice as
> many each year. This could be because emacs has a free manual that is
> distributed with it. But I saw a matching statistic at Linux Expo, where
> O'Reilly sponsors a vi vs. emacs paintball game each year. I happened to
> check the signup list, and noticed that there were about twice as many
> people signed up for the vi team as for the emacs team. (Maybe they just
> like the vi t-shirt -- the team "uniform" -- more than the emacs t-shirt,
> but I don't think so.)
>
> But I don't want to pour gasoline on this fire, any more than I want to pour
> gasoline on the perl vs. tcl vs. python fires. Both vi and emacs are great
> editors, and both are very widely used within O'Reilly. If you went down the
> list of our editors, you'd get strong partisans of each.
>
> P.S. If you want to read more on why I like vi, you need only turn to the
> opening pages of our book *Learning the vi
> Editor*<http://www.oreilly.com/catalog/vi6/>.
]CTRL-I backward
gd, and gD jump to the definition of a variable
]CTRL-D and [CTRL-D jump to the definition of a macro
]d, [d, ]D, [D to display the macro definition <- I like this one
Tomorrow, more for programmers...
--
Cheers,
Peyman.
Okey! :-)
> this little thing is very handy for me, it might be interesting for others
> as well:
> :map <space> /
> -----------------------------------------
that was good :->
> we always hear a problem with exponential complexity is almost unsolvable
> in real world. if you want to see and feel how bad an exponential growth is
> (in a vim manner), try this:
>
> open vim and write the following line:
> i am waiting for next chapter
>
> then in normal mode press:
> qaggVGypq
>
> now again in normal mode press
> 20@a
> (repeat 20 times)
>
that was bad! :-))
> exponential growth feels awful, doesn't it?
> anyone willing to try 50@a?
>
>
>
> >
>
--
Cheers,
Peyman.
Did I mention that you can list all the abbreviations by:
:ab
or
:abbreviation
To write your current configuration of Vim on a vimrc file:
:mkvimrc <file>
And to load a vimrc file:
:source <file>
:version gives a list of compile time configurations of your Vim.
I alway use:
:set textwidth=80
since a tty has 80 columns and also, 80 is long enough for up to three
nested loops, which if you have more, you'd better rewrite your
program!
BTW, you might need to:
:set formatoption+=t or c to make it work
and more on this comes later...
Substitute:
One can substitute or replace regexp using :s command, e.g.:
:s/X/Y/ will replace the first occurrence of X in the current line with Y
:1,5s/X/Y/ does the same thing for each line from 1 to 5
:%s/X/Y/ does it for the whole file
:s/X/Y/g replace "every" occurrence of X with Y in the current line
So, basically, the s command has the following form:
:[range]s/<regexp>/<expression>/[flag]
range is mmm, is a range!
regexp is a regular expression like the one we talked few sections back.
flags are as follows:
g for global
p for print
c for confirmation
i for ignore case
I for don't ignore case
:help su for more
--
Cheers,
Peyman.
It's the best replacement of ESC in ViM in my opinion, since it is
used in terminals as well to cancel/terminate.
On Aug 5, 9:54 pm, "Nazri Ramliy" <ayieh...@gmail.com> wrote:
Don't get me wrong, I love ViM, but I am also learning emacs at the
moment, so someone has to defend it. :P
part 1)
-Running CL as a subprocess of Emacs:
An even more powerful way of developing with Allegro CL is by running
it within Emacs in conjunction with a special Emacs/Lisp interface
provided by Franz Inc. This technique provides all the benefits of
running in an Emacs shell as outlined above, but is more powerful
because the Emacs-CL interface extends Emacs with several special
commands. These commands interact with the CL process, making the
editor appear to be "Lisp-aware." The combination of Emacs with the
Emacs-CL interface results in a development environment whose utility
approaches that of the vintage Symbolics Lisp Machines, which many
Lisp aficionados still consider to be technology advanced well beyond
anything produced today".
part 2)
-A Note on Emacs and Text Editors:
If you are used to working with the "vi"editor, Emacs comes with
several "vi" emulation modes...
cool link :-), thanks.
> Don't get me wrong, I love ViM, but I am also learning emacs at the
> moment, so someone has to defend it. :P
>
>
hehe! You don't start eating bacon and egg for breakfast, just because
Bijarne Strustroup does that (in case he does!). it's a matter of
taste!
--
Cheers,
Peyman.
On Sep 4, 7:19 pm, "Peyman Taher" <peyman.ta...@gmail.com> wrote:
--
Cheers,
Peyman.
--
Cheers,
Peyman.