Skip to content

Latest commit

 

History

History
85 lines (70 loc) · 8.04 KB

README.md

File metadata and controls

85 lines (70 loc) · 8.04 KB

What's included, How to learn? etc

Browse the plugins/*.vim files to see which plugins we have.

Files in nvim/settings are our configurations or customizations.

  • nvim/settings/plugin-*.vim are configs for a specific plugin.
  • nvim/settings/vim-*.vim are general vim configs.
  • Whatever you don't see in the above files (or if a plugin doesn't have a correspondent file in there) means that we use that plugin's (or vim's) defaults.

If you are having an unexpected behavior, wondering why a particular key works the way it does, use: :map [keycombo] (e.g. :map <C-\>) to see what the key is mapped to. For bonus points, you can see where the mapping was set by using :verbose map [keycombo]. If you omit the key combo, you'll get a list of all the maps. You can do the same thing with nmap, imap, vmap, etc.

How to customize

You can place any number of *.vim files inside the folders before and after in the settings dir. They'll be loaded, accordingly, before or after the main installation and configuration steps. If you think something could benefit everybody, feel free to open a Pull Request.

Search/Code Navigation

  • ,f - instantly Find definition of class (must have exuberant ctags installed)
  • ,F - same as ,f but in a vertical split
  • ,gf or Ctrl-f - same as vim normal gf (go to file), but in a vertical split (works with file.rb:123 line numbers also)
  • gF - standard vim mapping, here for completeness (go to file at line number)
  • K - Search the current word under the cursor and show results in quickfix window
  • ,K - Grep the current word up to next exclamation point (useful for ruby foo! methods)
  • Cmd-* - highlight all occurrences of current word (similar to regular * except doesn't move)
  • ,hl - toggle search highlight on and off
  • ,gg or ,rg - Grep command line, type between quotes. Uses RipGrep.
  • After searching with ,gg you can navigate the results with Ctrl-x and Ctrl-z (or standard vim :cn and :cp)
  • ,gd - Grep def (greps for 'def [function name]') when cursor is over the function name
  • ,gcf - Grep Current File to find references to the current file
  • // - clear the search
  • ,,w (alias ,esc) or ,,b (alias ,shiftesc) - EasyMotion, a vimium/vimperator style tool that highlights jump-points on the screen and lets you type to get there.
  • ,mc - mark this word for MultiCursor (like sublime). Use Ctrl-n (next), Ctrl-p (prev), Ctrl-x(skip) to add more cursors, then do normal vim things like edit the word.
  • gK - Opens the documentation for the word under the cursor.
  • Space - Sneak - type two characters to move there in a line. Kind of like vim's f but more accurate.
  • :Gsearch foo - global search, then do your normal %s/search/replace/g and follow up with :Greplace to replace across all files. When done use :wall to write all the files.

Better keystrokes for common editing commands

  • Tab for snipmate snippets.
  • ,#,,",,',,],,),,} to surround a word in these common wrappers. the # does #{ruby interpolation}. works in visual mode (thanks @cj). Normally these are done with something like ysw#
  • Cmd-', Cmd-", Cmd-], Cmd-), etc to change content inside those surrounding marks. You don't have to be inside them (Alt in Linux)
  • ,. to go to last edit location (same as '.) because the apostrophe is hard on the pinky
  • ,ci to change inside any set of quotes/brackets/etc

Tabs, Windows, Splits

  • Use Cmd-1 thru Cmd-9 to switch to a specific tab number (like iTerm and Chrome) - and tabs have been set up to show numbers (Alt in Linux)
  • Ctrl-h,l,j,k - to move left, right, down, up between splits. This also works between vim and tmux splits thanks to vim-tmux-navigator.
  • Q - Intelligent Window Killer. Close window wincmd c if there are multiple windows to same buffer, or kill the buffer bwipeout if this is the last window into it.
  • vv - vertical split (Ctrl-w,v)
  • ss - horizontal split (Ctrl-w,s)
  • ,qo - open quickfix window (this is where output from Grep goes)
  • ,qc - close quickfix

Utility

  • Ctrl-p after pasting - Use p to paste and Ctrl-p to cycle through previous pastes. Provided by YankRing.
  • ,yr - view the yankring - a list of your previous copy commands. also you can paste and hit ctrl-p for cycling through previous copy commands
  • crs, crc, cru via abolish.vim, coerce to snake_case, camelCase, and UPPERCASE. There are more :help abolish
  • ,ig - toggle visual indentation guides
  • ,cf - Copy Filename of current file (full path) into system (not vi) paste buffer
  • ,cn - Copy Filename of current file (name only, no path)
  • ,yw - yank a word from anywhere within the word (so you don't have to go to the beginning of it)
  • ,ow - overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it
  • ,ocf - open changed files (stolen from @garybernhardt). open all files with git changes in splits
  • ,w - strip trailing whitespaces
  • sj - split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down)
  • sk - unsplit a link (k = up)
  • ,he - Html Escape
  • ,hu - Html Unescape
  • ,hp - Html Preview (open in Safari)
  • Cmd-Shift-A - align things (type a character/expression to align by, works in visual mode or by itself) (Alt in Linux)
  • :ColorToggle - turn on #abc123 color highlighting (useful for css)
  • :Gitv - Git log browsers
  • ,hi - show current Highlight group. if you don't like the color of something, use this, then use hi! link [groupname] [anothergroupname] in your vimrc.after to remap the color. You can see available colors using :hi
  • ,gt - Go Tidy - tidy up your html code (works on a visual selection)
  • :Wrap - wrap long lines (e.g. when editing markdown files)
  • Cmd-/ - toggle comments (usually gcc from tComment) (Alt in Linux)
  • gcp (comment a paragraph)

Vim Dev

  • ,vc - (Vim Command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc.
  • ,vr - (Vim Reload) source current file as a vim file