Insert mode type 1.
Escape mode.
q a press q buffer name
copy and paste.
Ctrl+a increments the number in current cursor
Ctrl+x decrements the number in current cursor
q to quit from recording
to execute the recording buffer:
10 @ buffername(a)
-------------------------------------------------------------------- Ctrl + a => increase a number under the cursor. Ctrl + x => decrease a number under the cursor.
-------------------------------------------------------------------
^w- To decreasing the size of current split window
p put after current cursor
P put before the current cursor
In Insert mode Ctrl+w is used to cut the current word.
we can open multiple file at same time by passing all filename in vim command in single line. :next is used to go to next file.
J concatenates the line by deleting the end of line
:set aw this command ensures that file saved automatically before switching.
: on removes all other windows in split window and current window will become the full screen.
Buffer can be used in this file to create buffer "buffername commands output command is stored in buffername.
Eg: "a3yy - copy the 3 lines and stored in a buffer
We can replace the particular word in particular range of line Syntax: %10s/new/old/g - global
The % is used to match the item under the cursor. The item under the cursor can be a parenthesis, a curly bracket or a square bracket. By pressing the % key the cursor will jump to the corresponding match.
Edited by pludi: If you post something, please use the "Preview Post" button to check that whatever you post is actually legible!!!
Code:
#################################################################
@: : repeat last : command (then @@)
Open file under cursor:
gf : open file name under cursor.
<c-w>f open in a new window (Ctrl-w f)
<c-w>gf open in a new tab (Ctrl-w gf)
:nnoremap gF :view : open file under cursor, create if necessary
#################################################################
Searching
/joe/e : cursor set to End of match
/joe/e+1 : cursor set to End of match plus 1
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
:g/gladiolli/# : display with line numbers (YOU WANT THIS!)
#################################################################
Create a new file for each line of file eg 1.txt,2.txt,3,txt etc :g/^/exe ".w ".line(".").".txt"
#################################################################
:history : list of all your commands
:his c : commandline history
:his s : search history
#################################################################
q/ : Search history Window (puts you in full edit mode) (exit CTRL-C)
q: : commandline history Window (puts you in full edit mode)(exit CTRL-C)
#################################################################
---------- Post updated at 03:41 ---------- Previous update was at 03:11 ----------
I found a decent guide of VI basic tricks. This guide does expect you to have a decent understanding of VI. It does not go over very much beginner related.
vi Manual (3 Replies)
I downloaded vim.7.2 and compiled the vim source .
Added the vim binary path to PATH (Because iam not the root of the box)
when i load the file using vim it throws me an error
Error detected while processing /home2/e3003091/.vimrc:
line 2:
E185: Cannot find color scheme darkblue
line... (0 Replies)
I have a file which containd a string "old" and I need to replace all old with "new" if and only if it is a string not part of a string like Gold or fold etc.
I tried with sed like below
echo "old gold old" | sed 's/old/new/g'
It doesn't give the desired output, It give "old Gnew new".... (3 Replies)
Discussion started by: siba.s.nayak
3 Replies
4. Post Here to Contact Site Administrators and Moderators
What do you think could we open new top topic with tips and tricks and to show to other users some tricks what do we know like dtrace , new virtual server , how to add new users etc.
This is only suggestion (1 Reply)
1) I ran myScript with 2 arguments, I meant to use 3
if I do r my, it will rerun it with the 2 arguments. is there a way I can do r my and add a third argument at the end?
2) say I did
myAcript.ksh 2 5 7 8
I realise my typo. is there an easy way to redo the command replacing A with S?
... (4 Replies)
Hello there,
Is there anyway to make the tar utility print the contents of the files inside it (not list the files, but rather their contents) sequentially from the command line?
What I ultimately would like to do is to have a way of printing the contents of each file in the tar archive... (2 Replies)