Git Product home page Git Product logo

dotvim's Introduction

.vim

My ~/.vim and ~/.vimrc configuration.

Install

(Adjust accordingly)

# Create dotfiles directory
mkdir ~/.dotfiles

# Clone repo
git clone https://github.com/miguelmota/vim-config.git ~/.dotfiles/.vim

# Create backup directory
mkdir -p ~/.vim/backup

# Create symlinks
ln -s ~/.dotfiles/.vim ~/.vim
ln -s ~/.dotfiles/.vim/.vimrc ~/.vimrc

# Install Vundle bundle manager
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

# Install bundles (ignore errors about uninstalled bundles)
vim +BundleInstall +qall

Vundle commands

# Install bundles
vim +BundleInstall +qall

# Remove bundles
vim +BundleClean

# Update bundles
vim +BundleUpdate

Required dependencies

lua

# mac
brew install vim --with-lua

For installing vim with lua on Ubuntu see this gist gist

ctags for ctrlp and tagbar plugins

# Mac OSX
brew install ctags

# Ubuntu
sudo apt-get install exuberant-ctags

# fedora
sudo dnf install ctags

Tern for tern plugin

Make sure to have Node.js and npm installed first. You can use nvm.

cd ~/.vim/bundle/tern_for_vim

npm install

YouCompleteMe completers

# ubuntu requirements
sudo apt-get install python-dev python3-dev

# fedora
sudo dnf install cmake gcc-c++ python-devel python3-devel

# arch
cd ~/.vim/bundle/YouCompleteMe

git submodule update --init --recursive

# tern is deprecated
rm ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules

./install.py --clang-completer --go-completer --ts-completer --js-completer --racer-completer

# alternatively, compile with everything enabled
./install.py --all

Getting Go v1.11 auto completer to work

cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/
rm -rf gocode
git clone [email protected]:mdempsky/gocode.git
cd gocode
go mod init
go build .

vim-completor

javascript autocompleter

cd ~/.vim/bundle/completor.vim/
# make sure to install tern first before this
make js

Rust autocompleter

# requires nightly rust
rustup toolchain add nightly
cargo +nightly install racer

Python autocompleter

pip install jedi

NOTE: if YouComplete server crashes, try running install script (shown above) again:

Powerline

Powerline Installation instructions

vim-go

go get -u gopkg.in/alecthomas/gometalinter.v2
gometalinter --install

the_silver_searcher for content searching (used with FZF)

brew install the_silver_searcher

All done.

Installing bundles

Run BundleInstall after adding a Vundle bundle in .vimrc

Updating

wget https://raw.github.com/miguelmota/vim-config/master/update.sh -O - | bash

Reference

Below are references for shortcuts and key bindings (to help me remember).

toggle comment

<leader>c<space>

uncomment comment

<leader>cu

comment out using asterisks

<leader>cs

ctrlp Search/open files:

Ctrl+p

horizonal split
<c-x>

vertical split
<c-v>

Toggle fullscreen for a window (like in tmux)

<C-w> z

ctrlp shortcuts

source

Turn off search highlight

:noh
Press <F5> to purge the cache for the current directory to get new files.
Press <c-f> and <c-b> to cycle between modes.
Press <c-d> to switch to filename only search instead of full path.
Press <c-r> to switch to regexp mode.
Use <c-j>, <c-k> or the arrow keys to navigate the result list.
Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new split.
Use <c-n>, <c-p> to select the next/previous string in the prompt's history.
Use <c-y> to create a new file and its parent directories.
Use <c-z> to mark/unmark multiple files and <c-o> to open them.

Toggle NERDTree:

\ n

Comment toggle:

Hightlight text in visual mode then type \ cc

\ cl|cb - aligned to left \ cm - multiline \ cs - sexily

Close tag:

Ctr + Shift + _

Window switching:

Ctr + <movement key>

Paste mode toggle:

F9

List mode toggle:

F10

Strip whitespace:

\ ss

Tabs to whitespace:

\ ts` Reload vimrc:

\ rv

dit #delete everything in tag vit cit # change insidej tag yit

Eady Motion:

\ \ w

Buffer shortcuts

:ls - list buffers
:buffer <num>
:bn
:bp

Buffergator toggle panel:

\ b

Buffergator shortcuts:

<C-V> Open in vertical split
<C-S> Open in horizontal split
<C-T> Open in tab
Use `[b` (or <M-b>) and `]b` (or <M-S-b>) to flip through the most-recently
Use `<Leader><LEFT>`, `<Leader><UP>`, `<Leader><RIGHT>`, `<Leader><DOWN>` to

Mini Buffer Explorer

toggle panel

\ e

Switch to buffer

 number<C-^>

Recording

q<letter> Start recording
q Stop recording
@<letter> Replay recording

vim-node open required module file

gf on require('.') to open ./index.js`

ConqueTerm

run iteractive prompt

:ConqueTerm bash

Git

Common commands

:Gstatus
:Gdiff :0
:Gdiff [revision]
:Gdiff ~3
:Gblame
:Glog
:Gcommit -m "message"
:Gremove

Vim over (substitution preview)

:OverCommandLine

" shortcut"
\ fr

Vim obsession

:mksession
:source Session.vim

Vimux

\ x # prompt command
\ nt # npm test

Tmux complete

C-x C-u  # autcomplete

Multiple Cursors

C-n in Normal Mode
C-n again to select next occurance
v to go into Visual Mode after selections

C-p in Visual Mode go back to previous cursor location
C-x skip current location

:'<,'>MultipleCursorsFind <regex>

Number toggle

<ctrl-n>

Syntastic

# toggle lint error list
:lopen
:lclose
Indentation

Vim defaults (source)

>>   Indent line by shiftwidth spaces
<<   De-indent line by shiftwidth spaces
5>>  Indent 5 lines
5==  Re-indent 5 lines

>%   Increase indent of a braced or bracketed block (place cursor on brace first)
=%   Reindent a braced or bracketed block (cursor on brace)
<%   Decrease indent of a braced or bracketed block (cursor on brace)
]p   Paste text, aligning indentation with surroundings

=i{  Re-indent the "inner block", i.e. the contents of the block
=a{  Re-indent "a block", i.e. block and containing braces
=2a{ Re-indent "2 blocks", i.e. this block and containing block

>i{  Increase inner block indent
<i{  Decrease inner block indent

Ack

:Ack -i 'util' -H 'app/'
Tern commands

source

TernDef: Jump to the definition of the thing under the cursor.
TernDoc: Look up the documentation of something.
TernType: Find the type of the thing under the cursor.
TernRefs: Show all references to the variable or property under the cursor.
TernRename: Rename the variable under the cursor.

<Leader> td	:TernDoc	Documentation under cursor
<Leader> tb	:TernDocBrowse	Browse documentation
<Leader> tt	:TernType	Type hints
<Leader> td	:TernDef	Jump to definition (yes, 'td' is duplicated)
<Leader> tpd	:TernDefPreview	Jump to definition inside preview
<Leader> tsd	:TernDefSplit	Definition in new split
<Leader> ttd	:TernDefTab	Definition in new tab
<Leader> tr	:TernRefs	All references under cursor
<Leader> tR	:TernRename	Rename variable
Vim fugitive commands
:help fugitive
:Gblame
:GBrowse
Lisp Swank server
# start server
:call SlimvConnectSwank()

# in source file, white over text do the following to:
,d to eval defun
,e to eval current expression
,h hyperspec
,s to describe symbol
,g set package
,W wrap in pair of parens
,O split
,J join
,> move paren right
,< move paren left
,o some perf stuff
,I remove line but
,D compile defun
,F compile file
,L compile and load

License

MIT

dotvim's People

Contributors

miguelmota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.