VIM Basic Tasks (to be completed ) 
//In Vim, what's an elegant way to grab output from the command-line? (see :help :r!)
:r !echo "foo"

//inserting a new line after current line
o

//inserting a line before current line
O

//Piping output of a command to vim and 'save as'
uname | vi -
:saveas

//VIM Terminology
yank (copy in windows lingo)
delete (cut in windows lingo)
put (paste in windows lingo)


//yank (copy) a line
yy

//delete (cut) a line
dd

//put (paste) a line
p

//using marks to yank multiple lines
ma
y'a
//Example:
ma~~~~~~~~~~~~~~
~~~~~text~~~~~~~~
y'a~~~~~~~~~~~~~~

//Inserting a character X number of times
<ESC>
250
i
a
<ESC>

//cut a line
v this-is-the-line d

//undo
u

//search
/

//search next
n

//write and copy (save and exit in windows lingo)
wq

//the ! overwrites
wq!

//comparing two files
vimdiff -O test1.txt test2.txt
vimdiff -o test1.txt test2.txt //horizontally

//opening multiple files
vim -O file1.txt file2.txt
vim -o file1.txt file2.txt //horizontally

//creating another file while editing one
:vert new test.txt
:vsplit test.txt
:vsp test.txt

//horizontally
:split
:sp

//changing windows
ctrl ww

//go to specific line
:77

//practice
shell$ vimtutor

[ view entry ] ( 1544 views )   |  print article

<<First <Back | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Next> Last>>



2024 By Angel Cool