You are not logged in.

#1 2006-07-08 19:55:13

twiistedkaos
Member
Registered: 2006-05-20
Posts: 666

Using VIM

I've recently been using VIM via with the GTK gui(gvim) and I fell in love with the editor, but I'd also like to use it in console mode instead of nano. The issues I am having is I do not know the keybindings in order to save ect. I'm use to M$ style keybindings sad. It's something like Ctrl+X+S? Something like that xD. Odd keybindings. Thanks for my very newbish question sad

Offline

#2 2006-07-08 20:02:57

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

Re: Using VIM

Offline

#3 2006-07-08 20:03:57

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Using VIM

to save the file go into command mode (hit escape) and type :wq

: means this is a command
w means write
q means quit

also you can enter 'vim' in a console and type :help <keyword>

Google for vim tutorial:
google:vim tutorial

Offline

#4 2006-07-08 20:10:29

twiistedkaos
Member
Registered: 2006-05-20
Posts: 666

Re: Using VIM

Thanks for the quick replies guys smile time to start reading... mauha.

Offline

#5 2006-07-08 23:20:58

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: Using VIM

a good way to get started with vim is to run through the interactive tutorial that comes with the package:

$ vimtutor

All of your mips are belong to us!!

Offline

#6 2006-07-08 23:29:46

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Using VIM

Another usefull tool that comes along with vim, once you learn it, is vimdiff. Very useful for comparing and editing .pacnew files.

Offline

#7 2006-07-08 23:53:25

ozar
Member
From: USA
Registered: 2005-02-18
Posts: 1,686

Re: Using VIM

I'll second the vimtutor suggestion.  A few minutes with it and you'll be up and running before you know it.  smile


oz

Offline

#8 2006-07-09 04:42:20

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: Using VIM

Vimtutor is excellent, as is this reference chart. I'd recommend making sure you know the movement keys, how to save (:w) and quit (:q), then you can learn the rest at your pace. Undo (u) is handy too.

Offline

#9 2006-07-09 08:38:38

kishd
Member
Registered: 2006-06-14
Posts: 401

Re: Using VIM

If you need to save a file in command mode (press ESC to get to command mode) just type ZZ to save and exit. A little quicker than :wq


---for there is nothing either good or bad, but only thinking makes it so....
Hamlet, W Shakespeare

Offline

#10 2006-07-09 11:12:00

benplaut
Member
Registered: 2006-06-13
Posts: 383

Re: Using VIM

(insert some witty remark about how vim pwns emacs)


wink

Offline

#11 2006-07-09 15:45:17

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: Using VIM

I made this a while back and some people have found it helpful:

http://www.andy-roberts.net/misc/vim/vim.pdf

Offline

#12 2006-07-10 19:10:07

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Using VIM

Just a nitpick:

Penguin wrote:

: means this is a command

: means it is an Ex mode command. Normal mode commands are not colon prefixed, but are still "commands"

Offline

#13 2006-07-10 19:55:35

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Using VIM

ofc, unless you learn vim _well_ there is no reason you should use it when there are other, better editors for you out there.

This is important, as if you use vim for 2 years while not really knowing how to use it efficiently youd probable be more efficient using *insert notepad clone here*


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#14 2006-07-10 20:19:44

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: Using VIM

hahaha.  Vim in insert mode is a notepad clone.  So why don't you take the jump and learn the rest?

Offline

#15 2006-07-11 20:53:14

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Using VIM

codemac wrote:

hahaha.  Vim in insert mode is a notepad clone.  So why don't you take the jump and learn the rest?

My point was that if you are used to keycombinations like ctrl+c and ctrl+v, ctrl+z, ctrl+s and the like vim isn't another notepad clone since there are different ways to handle this functionality in vim. If you go download kwrite or scite you still have these shortcuts and can work just like you did when you was in good 'ol windows.

that might be more effective for you if you never learn to use vim good. There's nothing wrong with that, so don't go saying vim in 'insert mode' is the same as a notepad clone. It's not.


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#16 2006-07-11 21:41:20

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Using VIM

test1000 wrote:

ofc, unless you learn vim _well_ there is no reason you should use it when there are other, better editors for you out there.

What better editors?

Offline

#17 2006-07-11 21:51:33

lessthanjake
Member
From: Norway
Registered: 2005-11-09
Posts: 319
Website

Re: Using VIM

Gullible Jones wrote:
test1000 wrote:

ofc, unless you learn vim _well_ there is no reason you should use it when there are other, better editors for you out there.

What better editors?

Emacs, but you are out of luck with MS-key-bindings there too lol

Offline

#18 2006-07-11 21:57:38

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Using VIM

Other than Escape-Meta-Alt-Control-Shift, I mean. lol

Offline

#19 2006-07-11 22:55:38

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Using VIM

Gullible Jones wrote:
test1000 wrote:

ofc, unless you learn vim _well_ there is no reason you should use it when there are other, better editors for you out there.

What better editors?

i meant better as in 'better if you are used to windows keycombination and typical notepad-like interface and don't want to spend the time learning vim good enough so as to obliverate the necessity for previously mentioned like text-editor'

then better would be: scite kwrite kate ...
basically every editor except vim, emacs and nano tongue _almost_ i must make clear.

but i thought this was obvious. ach. i shall now construct everything i say so as to not leave a shred of possible misunderstanding in the air.


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#20 2006-07-12 12:30:39

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: Using VIM

test1000 wrote:

My point was that if you are used to keycombinations like ctrl+c and ctrl+v, ctrl+z, ctrl+s and the like vim isn't another notepad clone since there are different ways to handle this functionality in vim. If you go download kwrite or scite you still have these shortcuts and can work just like you did when you was in good 'ol windows.

I have to use Windows at work. When I installed Vim, ctrl+c/x/v combos were working out-of-the-box.

When I look at the original vimrc, there was a line saying 'behave mswin', and so I'm guessing that has something to do with it.

Therefore, you can have windows combos and the power of Vim.

Offline

#21 2006-07-12 13:02:51

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Using VIM

arooaroo wrote:

Therefore, you can have windows combos and the power of Vim.

yep, you just have to figure out how to get it to behave like that first, oh, and realise that it is even possible so you know that you can implement that functionality somehow... ach.

but it's cool, now I know atleast.


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#22 2006-07-12 13:15:38

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: Using VIM

test1000 wrote:
arooaroo wrote:

Therefore, you can have windows combos and the power of Vim.

yep, you just have to figure out how to get it to behave like that first, oh, and realise that it is even possible so you know that you can implement that functionality somehow... ach.

but it's cool, now I know atleast.

As I mentioned, if you are installing Vim on Windows, then this Windows-like behaviour is there straight-away with a fresh installation. You don't need to hunt for the vim settings to enable it or anything - it's just enabled by default.

It's obviously more effort to disable this default behaviour, in fact.

Offline

#23 2006-07-12 13:21:47

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Using VIM

what are you talking about? I thought we were talking about linux here.. isn't this a linux forum.. the newbie corner, am i delusional?

smile


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#24 2006-07-12 16:24:41

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Using VIM

source $VIMRUNTIME/mswin.vim
behave mswin

bamf.  mswin.vim script adds all the fun shortcuts, while 'behave' changes the mouse settings.

Offline

#25 2006-07-12 20:00:43

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: Using VIM

test1000 wrote:

what are you talking about? I thought we were talking about linux here.. isn't this a linux forum.. the newbie corner, am i delusional?

smile

I was tired! I managed think that the discussion was verging on notepad replacement territory, which is why there was all the ctrl-x/c/v malarky.

Anyway...

Offline

Board footer

Powered by FluxBB