Skip to content

Instantly share code, notes, and snippets.

@saurabh-sp-tripathi
Last active August 6, 2018 23:30
Show Gist options
  • Save saurabh-sp-tripathi/512980928bfb7f041baa6dba4b16ac3f to your computer and use it in GitHub Desktop.
Save saurabh-sp-tripathi/512980928bfb7f041baa6dba4b16ac3f to your computer and use it in GitHub Desktop.
  • file{begin,end}  : `gg, G`
    
  •  line{begin, end} : `0, $`
    
  •               Undo: `u`
    
  •  Select,copy,paste: `Vyp` (weep) 
    
  •  Select,cut,paste: `Vdp` (we dip)
    
  •  show line number : `:set number` ; hid : `set nonumber`
    
  • move cursor previous pos: ``

#File explorer

  • :set wildmenu >> :set path+=** >> :find <tab>
  • what the path again? :set path?
  • list buffers : :ls
  • swith between open tabs :b <tab> or :b he*.j <tab> or ....
  • File explorer :e . ; For windows you need to put shortcuts of dir under c:/Users/ .... doh! Stupid Window!!
  • after :e . type v for vertical split, t for tabs :ta<tab-2-autocomplete> >> tabnext tabprevious etc
  • for :e help :help netrw ; to nav through content: :help netrw-<content-name>

Super duper cool code navigation

  • jump to def:
prerequisite : should have ctags. (sudo apt-get install ctags)
# go to project directory
>$ ctags -R .  // >> this make a ./tags dir
>$ vim <file-name> 
// ^] to jump to declaration
// g^] to list occurence of all such declaration
// ^t to jump back up the tag stack
  • autocomplete : C-n for all else :help ins-completion

Macros

  • generate a sequence pattern like details
for i in range(1, 10) | put='\"uid'.i.'\",' | endfor
/**
output:
"uid1",
"uid2",
...
**/

vimrc :Big thanks to Pritesh https://www.vim.org/ugrankar.pdf

"Personal Settings
"More to be added soon
execute pathogen#infect()
filetype plugin indent on
syntax on

"Set the status line options. Make it show more information
colorscheme kolor
set guifont=Consolas:h12

"set line number buffer, search, highlight, autoindent and more
"line num
set nu
" hides the buffer without closing it?? todo: read https://medium.com/usevim/vim-101-set-hidden-f78800142855
set hidden 
"-------------vim.wikia.com/wiki/Searching :Start -----------------------------
" Ignore case while searching /the ==> the or ThE
set ignorecase
" show next match
set incsearch
" if search patther contains upper letter, search will be case sensitive
set smartcase
"-------------vim.wikia.com/wiki/Searching :ends -----------------------------
" http://vim.wikia.com/wiki/Moving_to_matching_braces
set showmatch

set autoindent
set ruler
" what's vb??? todo: research
set vb
set noerrorbells
set showcmd
set mouse=a
set history=1000
set undolevels=1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment