0% found this document useful (0 votes)
12 views

Gvim Command S

Gvim Commmands
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Gvim Command S

Gvim Commmands
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

-------------------www.linkedin.

com/in/ajay-g-mishra--------------------------

********GVIM COMMAND*******

Basic Navigation #GVimTips


- ‘h‘ Move left
- ‘j‘ Move down
- ‘k‘ Move up
- ‘l‘ Move right
- ‘0‘ Move to the beginning of the line
- ‘$‘ Move to the end of the line
- ‘w‘ Move to the next word
- ‘b‘ Move to the previous word
- ‘gg‘ Move to the beginning of the file
- ‘G‘ Move to the end of the file
- ‘Ctrl+f‘ Move forward one screen
- ‘Ctrl+b‘ Move backward one screen

Inserting Text #TextEditing


- ‘i‘ Insert before the cursor
- ‘I‘ Insert at the beginning of the line
- ‘a‘ Append after the cursor
- ‘A‘ Append at the end of the line
- ‘o‘ Open a new line below
- ‘O‘ Open a new line above

Editing Text #CodeEditing


- ‘x‘ Delete the character under the cursor
- ‘dd‘ Delete the current line
- ‘dw‘ Delete to the end of the word
- ‘d$‘ Delete to the end of the line
- ‘u‘ Undo the last change
- ‘Ctrl+r‘ Redo the last undone change
- ‘yy‘ Yank (copy) the current line
- ‘yw‘ Yank (copy) the word
- ‘p‘ Paste after the cursor
- ‘P‘ Paste before the cursor
- ‘r‘ Replace the character under the cursor
- ‘R‘ Enter replace mode

Visual Mode #GVimVisual


- ‘v‘ Start visual mode
- ‘V‘ Start visual line mode
- ‘Ctrl+v‘ Start visual block mode
- ‘y‘ Yank (copy) the selected text
- ‘d‘ Delete the selected text
- ‘>‘ Indent the selected text
- ‘<‘ Unindent the selected text

Searching and Replacing #SearchReplace


- ‘/pattern‘ Search for ‘pattern‘
- ‘?pattern‘ Search backward for ‘pattern‘
- ‘n‘ Repeat the search
- ‘N‘ Repeat the search in the opposite direction
- ‘:%s/old/new/g‘ Replace all occurrences of ‘old‘ with ‘new‘ in the file
- ‘:s/old/new/g‘ Replace all occurrences of ‘old‘ with ‘new‘ in the current line

Working with Files #FileManagement


- ‘:e filename‘ Open a file
- ‘:w‘ Save the current file
- ‘:w filename‘ Save with a new name
- ‘:q‘ Quit ‘vim‘
- ‘:q!‘ Quit without saving
- ‘:wq‘ Save and quit
- ‘:x‘ Save and quit
- ‘:wa‘ Save all open files
- ‘:qa‘ Quit all open files
- ‘:qa!‘ Quit all open files without saving

Window Management #Windows


- ‘:split filename‘ Split window horizontally and open ‘filename‘
- ‘:vsplit filename‘ Split window vertically and open ‘filename‘
- ‘Ctrl+w, h‘ Move to the window on the left
- ‘Ctrl+w, j‘ Move to the window below
- ‘Ctrl+w, k‘ Move to the window above
- ‘Ctrl+w, l‘ Move to the window on the right
- ‘Ctrl+w, q‘ Quit the current window
- ‘Ctrl+w, s‘ Split the window horizontally
- ‘Ctrl+w, v‘ Split the window vertically
- ‘Ctrl+w, =‘ Equalize window sizes

Buffers and Tabs #BuffersTabs


- ‘:bnext‘ or ‘:bn‘ Go to the next buffer
- ‘:bprev‘ or ‘:bp‘ Go to the previous buffer
- ‘:bfirst‘ or ‘:bf‘ Go to the first buffer
- ‘:blast‘ or ‘:bl‘ Go to the last buffer
- ‘:tabnew filename‘ Open ‘filename‘ in a new tab
- ‘:tabnext‘ or ‘:tabn‘ Go to the next tab
- ‘:tabprev‘ or ‘:tabp‘ Go to the previous tab
- ‘:tabfirst‘ Go to the first tab
- ‘:tablast‘ Go to the last tab
- ‘:tabclose‘ or ‘:tabc‘ Close the current tab

Miscellaneous #GVimMagic
- ‘.‘ Repeat the last command
- ‘:!command‘ Execute an external command (e.g., ‘:!ls‘)
- ‘:set number‘ or ‘:set nu‘ Show line numbers
- ‘:set nonumber‘ or ‘:set nonu‘ Hide line numbers
- ‘:set ignorecase‘ or ‘:set ic‘ Ignore case in searches
- ‘:set noignorecase‘ or ‘:set noic‘ Don’t ignore case in searches
- ‘:set hlsearch‘ or ‘:set hls‘ Highlight search results
- ‘:set nohlsearch‘ or ‘:set nohls‘ Don’t highlight search results
- ‘:set incsearch‘ or ‘:set is‘ Incremental search
- ‘:set noincsearch‘ or ‘:set nois‘ Don’t use incremental search
- ‘:set wrap‘ Enable line wrapping
- ‘:set nowrap‘ Disable line wrapping
- ‘:set spell‘ Enable spell check
- ‘:set nospell‘ Disable spell check
-------------------www.linkedin.com/in/ajay-g-mishra--------------------------

You might also like