Skip to content

Roger-Takeshita/Vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

TABLE OF CONTENTS

VIM

  vimtutor

Commands

Go Back to Contents

Insert

  a           # Append text after the cursor
  A           # End of line in insert mode
  i           # Insert mode
  o           # Creates a new line below the cursor and place you in Insert mode
  O           # Creates a new line above the cursor and place you in Insert mode
  R           # Insert mode (like Insert key)

Exit / Save

  :q!         # Exit without saving
  :wq         # Save and exit
  :w filename # Save as

Move

  j           # Down
  k           # Up
  h           # Left
  l           # Right
  w           # Beginning of the word
  e           # End of the word
  0           # Beginning of the line
  $           # End of the line
  Ctrl + g    # Show where you are in the file
  number + G  # Go to line
  %           # Find closing brackets
  Ctrl + o    # Takes you back to older positions
  Ctrl + i    # Takes you back to newer positions

  Ctrl + e    # Move down
  Ctrl + y    # Move up

Horizontal Move

  # File
  gg          # Top of the file
  Shift + g   # Bottom of the file

  # Screen
  H           # Top of the screen
  M           # Middle of the screen
  L           # Bottom of the screen
  zz          # Center the file in the middle of the screen
  zt          # Put your the file in the top of the screen
  zb          # Put your the file in the bottom of the screen (not very useful)
  Ctrl + e    # Move the screen down, the cursor stays still
  Ctrl + y    # Move the screen up, the cursor stays still
  Ctrl + d    # Move half of the screen down, cursor stay in the same height
  Ctrl + u    # Move half of the screen up, cursor stay in the same height

Vertical Move

  0           # Beginning of the line
  $           # End of the line
  ^           # First non blank character
  g_          # End of the line non blank character
  %           # Matches the open and closing (), [], ...

Search

  *           # Search for the word that I am current on
  f + character # Search in the line
    ;             # Move forward
    ,             # Move backwards

Marker

  mm          # Create a marker with the letter m
  `m          # Go to marker m
  'm          # Go to marker m, beginning of the line

Copy

  v           # Visual model
      y /      # Copy selected text
      p       # Paste selected text
  yw          # Copy single word

Delete

  x           # Delete single character
  dw          # Delete word
  d$          # Delete right until the end
  d2w         # Delete 2 words
  diW         # Delete big word (entire block of word)
  dt + symbol # Delete everything between not including the symbol
  df + symbol # Delete everything between including the symbol

Paste

  p           # Paste below

Replace

  r               # Replace character
  ce              # Replace until the end of the word (e)
  c$              # Replace until the end of the line ($)
  :s/old/new/g    # Substitute globally
  :%s/old/new/g   # Substitute globally in the line
  :%s/old/new/gc  # Substitute globally in the line and prompt y/n
  :#,#s/old/new/g # Substitute first # line, second # number of lines

Undo

  u           # Undo
  U           # Undo entire line

Redo

  Ctrl + r    # Redo

Search

  /           # Search forward
  # Option ---------------------------------------
    :set ic         # Search word, ignore case sensitive
    :set noic       # Disable case sensitive
    :set hls        # Activate highlight
    :set nohlsearch # Deactivate highlight
    /ign:ore\c       # Ignore case for just one search
  # Option ---------------------------------------
  ?           # Search backwards
  option n    # Next
  option N    # Previous

Execute Shell Commands

  :!          # External commands

Recording

  q           # Stop recording

Select Text and Save as New File

  v           # --Visual-- mode
              # Select your text (using h, j, k, l)
              # :w to save (:'<,'>w)

Insert Content

  :r path/file   # Will copy the content of the file as paste under your cursor
  :r !ls Desktop # Will paste all the filenames under your cursor

Change Window Focus

  Ctrl+w        # Switch window focus

Help

  :help
  :help w
  :help c_CTRL-D
  :help insert-index
  :help user-manual

Navigate

  • Search character in line

      f + letter # Move forward including the letter
      ;          # Move forward
      ,          # Move backward
    
      t + letter # Move forward not including the letter
      ;          # Move forward
      ,          # Move backward
    
      F # Search backwards including the letter
      T # Search backwards not including the letter

Replace Word / Inner Content Of a Tag + INSERT MODE

  cas # Change the whole block of sentence
  cw  # Change the word from cursor til the end
  ciw # Change the current word
  cit # Change inner content of a tag
  ci" # Change the inside word of ""
  cip # Change the inner p tag
  c#j # Change from current line + number
  c/word + enter # Change word that is not accessible easily

Change Surround

Copy Word

  yiw # Copy Word

Go Replace

Copy to Clipboard

  • christoomey/vim-system-copy

      cp   # Copy selection
      cpiw # Copy word into system clipboard
      cpi' # Copy inside single quotes to system clipboard
      cvi' # Paste inside single quotes from system clipboard

Commentary

Releases

No releases published

Packages

No packages published