Skip to content

apolzon/meticulous_vim

Repository files navigation

My Vim Config

They aren’t very meticulously set up, but vim is so win.

Credits

This is based mostly based on rob cornery’s vim files

Installation

The simplest thing you can do is to create a “VimSettings” directory somewhere on your drive. Mines in my home root (~/). Just do a git clone from this repo and put it to your drive somewhere, then you need to setup some aliases to point to the vimrc and gvimrc files.

By default, Vim will look for these files in your root, so you’ll need to alias them like this: ln -s ~/VimSettings/vimrc .vimrc ln -s ~/VimSettings/gvimrc .gvimrc ln -s ~/VimSettings .vim

Highlighted plugins

NERDTree rails.vim fuzzyfinder (for buffer nav) peepopen that one that makes “end” statements appear when you start a function Ack for searching

Custom key bindings

I highly recommend remapping ESCAPE to CAPSLOCK. It’ll speed things up and save your pinky.

, as leader aka my custom shortcut ,b = buffer browser/searcher FuzzyFinderBuffer ,f = fuzzyfinder file wanted: ,l NERDTreeFind (opens nerdtree to the current file highlighted ,s last buffer? ,a ack in project,l NERDTreeFind (opens nerdtree to the current file highlighted ,s last buffer? ,a ack in project??

Cheat Sheet ==

TODO

FuzzyFileFinder

,b quick search buffers.
CTRL+K in buffer explorer, open current seleted file in veritcal split

NERDTree :NERDTreeFind open nerd tree current file m # add child node QUICKNAAV :set nu then you can just #G to it also you can use /dirname to quickly navigate to a dir C.……Change the tree root to the selected dir.….….….….|NERDTree-C| u.……Move the tree root up one directory.….….….….…..|NERDTree-u| U.……Same as ‘u’ except the old root node is left open.….…|NERDTree-U| m.……Display the NERD tree menu.….….….….….….……|NERDTree-m| cd.…..Change the CWD to the dir of the selected node.….……|NERDTree-cd| i.……Open selected file in a split window.….….….….….|NERDTree-i| gi.…..Same as i, but leave the cursor on the NERDTree.….…..|NERDTree-gi| gs.……Open selected file in a new vsplit.….….….….……|NERDTree-s|

COPY PASTE

copy the current line: yy
paste: p

SUPERTAB: Select Entry: CTRL - Y or ESCAPE COMMAND LINE / 2 MODE CTRL-B cursor to beginning of command-line CTRL-E cursor to end of command-line <C-Left> cursor one WORD left <C-Right> cursor one WORD right

CTRL-W          Delete the |word| before the cursor.  This depends on the

‘iskeyword’ option. c_CTRL-U CTRL-U Remove all characters between the cursor position and the beginning of the line. Previous versions of vim deleted all characters on the line. If that is the preferred behavior, add the following to your .vimrc: > :cnoremap <C-U> <C-E><C-U>

CTAGS

map <F8> :!/usr/bin/ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
 alternative
ctags -R --exlude=.svn --exclude=log *
CTRL+[  - go to definition

INSERT MODE “ map CTRL-E to end-of-line (insert mode) imap <C-e> <esc>$i<right> ” map CTRL-A to beginning-of-line (insert mode) imap <C-a> <esc>0i more: vimdoc.sourceforge.net/htmldoc/insert.html :h insert-index

REDO: CTRL-R

SNIPMATE shnb - .should_not be

*list-snippets*

:set ft=html.eruby # set filetype of current file to be html and erbuy RAILS.VIM :A (edit alternate file)

:AS (in split)
:AV (in vertical split)

:Rgenerate controller Blog FILES

:e **/filename

:Rgenerate migration

QUICK EDITING ci’ change text within quotes I insert at the begin. A append to end. o / O open a new line after/before the current. cc - change (replace) an entire line cw - change (replace) to the end of word ciw - change inner word (reglardess of cursor) DIRECTORIES :!mkdir my_project :!rails my_project ea - insert at end of word

BUFFERS :BD will close the current buffer. CTRL-^ Switch buffer :ls View the list of buffers along with their numbers. :!ls view all unlisted buffers :bf Go to the first buffer. :bl RIGHT Go to the last buffer. :bn or LEFT Go to next buffer :b [file]. Fantastic for quickly switching between buffers. You can give it just part of a file name and it will jump to the buffer that matches.

SPLIT Ctrl-w Ctrl-w moves between Vim viewports. Ctrl-w q will close the active window. :on make this the on;ly window CTRL-W CTRL-O make this the only window # ctrl+ws - Split windows # ctrl+ww - switch between windows # ctrl+wq - Quit a window # ctrl+wv - Split windows vertically

DELETING

x normal mode delete

EDITING :dw delete word :dd delete line

IDENTATION

={ autoindent block of code

> and < to ident a selected block - use . to repeat . Repeat last text-changing command

<Ctrl>-<Shift>-t to indent (mnemonic: tab), and
<Ctrl>-<Shift>-d to unident (mnemonic: de-tab/indent).
== to auto-indent the current line.

=% ident a function?

NAVIGATION 0 To the beginning of a line. A end of line or $ Forward Paragraph Shift-] or } ctrl-o to jump to the previous location and ctrl-i to jump forward to the next location again. Shift-Up Arrow = Page up ^ To the first non-blank character of the line

:jumps 
G End of file
gg top of file
Ctrl-o  moves the cursor to the last jump.

Ctrl-i moves the cursor to the previous jump. H moves the cursor to the top of the screen or viewport. M moves the cursor to the middle of the screen or viewport. L moves the cursor to the bottom of the screen or viewport. z. Redraw, line [count] at center of window (default cursor line). Put cursor at first non-blank in the line.

zz zz Like “z.”, but leave the cursor in the same column. Careful: If caps-lock is on, this command becomes “ZZ”: write buffer and exit! {not in Vi} zt - change the viewport so that the cursor is at the top z- - change the viewport so that the cursor is at the bottom

type in numbers: = nav

Command Mode Navigation

Control-F: page down

Control-b: page up

MISC The % key can be used: * To jump to a matching opening or closing parenthesis, square bracket or a curly brace: ([{}]) * To jump to start or end of a C-style comment: /* */. * To jump to a matching C/C++ preprocessor conditional: #if, #ifdef, #else, #elif, #endif. * To jump between appropriate keywords, if supported by the ftplugin file, for example, between begin and end in a Pascal program.

:set stl? print current statusline :set nonumber “ disable line numbers :set lines=100 columns=400 :cl bring up old ack list Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. (link) Jump back: Type CTRL-T or CTRL-O (repeat to go further back). :e /usr/share/vim/vim72/tutor/tutor

set list! Turn off show invisibles List Current Scripts “ where was an option set :scriptnames : list all plugins, _vimrcs loaded (super) :verbose set history? : reveals value of history and where set :function : list functions :func SearchCompl : List particular function You can quickly and easily reload your vimrc with the following command.

:source $MYVIMRC

If you want to know what your current vimrc is, just do the following.

:echo $MYVIMRC

:h slash< CTRL-d > to get a list of all help topics containing the word ‘slash’. is.gd/7Onk BROWSING DIRECTORIES

:Ex (mnemonic: Explore) opens up the current file in browser

SEARCH AND REPLACE

:%s/target/replacement/g

you can search and replace on multiple files by typing :args */.java —> open all java files under current directory (inside buffer) :argdo %s:search_for_something:replace_with_anything:g |w –> additional w means save to file without acknowledge us

vim.1045645.n5.nabble.com/fuzzy-finder-how-to-get-it-find-files-from-root-of-my-current-dir-located-in-any-subdirectory-td1181895.html

Found a post on another site. Solution append **/ after FuFile

so my mapping is now:

map <leader>f :FufFile **/<CR>

Copyright © 2010 Scott Schulthess

About

my vim files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published