Skip to content

Instantly share code, notes, and snippets.

@nfaction
Created May 18, 2017 21:52
Show Gist options
  • Select an option

  • Save nfaction/33591c26e78d4a2d4452356e4e02cad9 to your computer and use it in GitHub Desktop.

Select an option

Save nfaction/33591c26e78d4a2d4452356e4e02cad9 to your computer and use it in GitHub Desktop.

Vim

vim 8.0 released: https://groups.google.com/forum/#!topic/vim_dev/CmiGxtJ7fn4

Vundle: https://github.com/VundleVim/Vundle.vim

Helpful tips

Search

Lesson 4 SUMMARY

  4. To substitute new for the first old in a line type    :s/old/new
     To substitute new for all 'old's on a line type       :s/old/new/g
     To substitute phrases between two line #'s type       :#,#s/old/new/g
     To substitute all occurrences in the file type        :%s/old/new/g
     To ask for confirmation each time add 'c'             :%s/old/new/gc

Lesson 6.5: SET OPTION

  2. Set the 'ic' (Ignore case) option by entering:   :set ic

  3. Now search for 'ignore' again by pressing  n
     Notice that Ignore and IGNORE are now also found.

  4. Set the 'hlsearch' and 'incsearch' options:  :set hls is
  6. To disable ignoring case enter:  :set noic

NOTE:  To remove the highlighting of matches enter:   :nohlsearch
NOTE:  If you want to ignore case for just one search command, use  \c
       in the phrase:  /ignore\c  <ENTER>

Lesson 7.1: GETTING HELP

:help
:help <help-item>

Lesson 7.2: CREATE A STARTUP SCRIPT

  1. Start editing the "vimrc" file.  This depends on your system:
        :e ~/.vimrc             for Unix
        :e $VIM/_vimrc          for MS-Windows

  2. Now read the example "vimrc" file contents:
        :r $VIMRUNTIME/vimrc_example.vim

Lesson 7.3: COMPLETION

  4. Press  CTRL-D  and Vim will show a list of commands that start with "e".
  7. Press <TAB>.  Vim will complete the name (if it is unique).

NOTE:  Completion works for many commands.  Just try pressing CTRL-D and
       <TAB>.  It is especially useful for  :help .

Vim Bundles

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Sessions

  1. Create session directory

    mkdir -p ~/.vim/sessions
    
  2. Inside vim:

    1. Create session:

      :mks ~/.vim/sessions/rooster.vim
      
    2. Restore session:

      :source ~/.vim/sessions/rooster.vim
      
      OR
      
      vim -S ~/.vim/sessions/rooster.vim
      

Syntax Highlighting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment