Gvim Commands

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

https://vim.rtorr.

com/ 
https://www.cse.iitb.ac.in/~avadhut/sysadgiri/vim/vimtips.html
:w                             to save which is in write mode

:w!                            to overwrite/save which is in read mode

:wq                           to save and quit at same time

:q                             to quit with out saving

------------------------------------------------------------------------------------------

:sav 'file_name'        to save a new file with file name

:enew                      to create a new file

:E                            to open  files in list view(file explorer)

:set nu                    to set numbers of lines

:set nonu                to remove line numbers

:'number_of line'    to goto the specific line number

:set showmatch      to show matching the brackets(),{},[]

:nohls                      removes the hilights in your text

------------------------------------------------------------------------------------------

gg               to go to starting line of the opened file

G                 to go to last line of the file

H                 to go to first line of the screen

L                  to go to last line of the screen

M                to go to middle line of the screen

$                  cursor goes to the end of the line where the cursor is

^                 cursor goes to the start of the line where the cursor is

w                 cursor goes to starting of next word (left-right)

b                 cursor goes to starting of pervious word (right-left)

3w              cursor goes to starting of next 3rd word

e                 cursor goes to end of next word

j                  cursor goes to next line

k                 cursor goes up

 h                cursor goes left

 l                 cursor goes right

n                 cursor goes to end of next line

------------------------------------------------------------------------------------------
yy                to copy a line where cursor is present(1 line yanked)

3yy              to copy a 3lines where cursor is present

ggyG           to copy all text in the file

yw               to copy a word where cursor is present

yH               to copy from the line of cursor to first line of your screen

yL                to copy from the line of cursor to last line of your screen

ygg             to copy all lines above the cursor till first line

yG              to copy all lines below the cursor till last line

3yw            to copy a 3words where cursor is present

y$              to copy the line till end from the middle of line

y^             to copy the line till start from the middle of line

m+a y'a    to copy specific lines(m+a marks your line, move cursor to desired line till which you
want to copy and use y'a)

------------------------------------------------------------------------------------------

p              to paste which is previously copied or deleted in next line where cursor is present

3p            to paste the copied line 3times in next line where cursor is present

------------------------------------------------------------------------------------------

x              to delete single character

s              deletes the single character and goes directly to insert mode

cc            deletes the line and goes directly to insert mode

dd           to delete a line where cursor is present

3dd         to delete a 3lines down where cursor is present

ggdG      to delete all text in the file

dw          to delete a word where cursor is present

3dw        to delete a 3words where cursor is present

d$          to deletes the line till end from the middle of line

d^         to deletes the line till start from the middle of line

dH         to delete from the line of cursor to first line of your screen

dL          to delete from the line of cursor to last line of your screen

dgg       to delete all lines above the cursor till first line

dG         to delete all lines below the cursor till last line

m+a d'a     to delete specific lines(m+a marks your line, move cursor to desired line till which you
want to delete and use d'a)
u                to undo the previous action

U               for all undo

.                 to redo the previous action

------------------------------------------------------------------------------------------

*               to search the same word in the file(place cursor at that word)

n               to go next same word in search

N               to go previous same word in search

/'word'      to search specific word with name

------------------------------------------------------------------------------------------

:%s/'word1'/'word2'                to replace all word1 to word2

:%s/'word1'/'word2'/gc           to replace all word1 to word2 with check for each
word(globalcheck)

:%s/^/'word'                            to insert 'word' at starting of all lines

:%s/^/'word'/gc                       to insert 'word' at starting of all lines check for each
word(globalcheck)

:%s/$/'word'                             to insert 'word' at ending of all lines

:%s/$/'word'/gc                        to insert 'word' at ending of all lines check for each


word(globalcheck)

:set ic                                        (ignore case)to ignore case while searching same word
(product/PRODUCT)

:g/^\s*$/d                                to delete all blank lines in file

1 ctrl g                                      to get path of current file

:set guifont=12                         to set the font size

:set bg=dark                             to set background as dark

 gf                                             to got to file placing the cursor on the path

 :bd                                           to go back to prev file

 :ls                                             to list out the files open earlier

 :b  1                                         open buffer 1 from list of files

 :set expandtab                      

 :retab                                       to replace all tabs with spaces

 :set autoindent                        to set auto indentation

 :%s/.*sspbch/pdsch/gc            to replace till the string

  :%s/sspbch.*/pdsch/gc           to replace starting from string


  :., +14s/pbch/ssb/gc               to replace from 14th line

  ~                                             to convert to upper/lower case

  3l                                             to go to next 3 letters

Alt+F10                                     to maximize the gvim window

font size command  :set guifont=12

:bd                                             to go back to prev file

:se all

l for letter

k is up

U for all undo

command to remove all tabs

/\s to find the spaces in the file

:%s/\s\+$//e   to remove unwanted white space at the end of lines.

:set list to check any spaces

:set nolist

 gf -->on a path to open that particular file.

Terminal Commands:

Ctrl+c -->to kill process

Ctrl+z -->to kill process

Ctrl+\ -->to kill process

Ctrl+d -->to close terminal

Ctrl+l -->to clear terminal

Ctrl+a -->to go to beginning of line

Ctrl+e -->to go to end of line

Ctrl + u -->to remove everything when you type a wrong command/or remove the complete
command in terminal 

Ctrl+p -->to get the previously used command

Esc+p -->to get the complete command which used previously

Ctrl + S -->stops the output on the terminal. Nice if a running command prints too fast.

Ctrl + Q -->resumes from a Ctrl + S

Ctrl+shift+v -->to paste in terminal

Alt+B:   Go left (back) one word.


Ctrl+B: Go left (back) one character.

Alt+F: Go right (forward) one word.

Ctrl+F: Go right (forward) one character.

Ctrl+XX: Move between the beginning of the line and the current position of the cursor. This
allows you to press Ctrl+XX to return to the start of the line, change something, and then
press Ctrl+XX to go back to your original cursor position. To use this shortcut, hold the Ctrl key
and tap the X key twice.

 Ctrl+H or Backspace: Delete the character before the cursor.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy