Skip to content

amanusk/dotvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vim tutorial and useful installations

Productivity

Why use vim

  • Comes preinstalled on many many Unix-like machines
  • Support for a large and fanatic community
  • Concepts are portable to many full featured IDEs Jet-Brains, VS-Code
  • Vim shortcuts are often avaialble in other unix programs
  • You never stop learning vim

Getting started

Resources to get started:

Interactive tutorial for basic movement

  • vimtutor
  • openvim
  • Type :help in your vim

The mode modal

There are 3 main modes for vim:

  1. Normal mode: Where you move around and do most of the things
  2. Insert mode: Where you insert text in short bursts
  3. Visual mode: For text selection, copy paste, etc

Basic motions

Chaning modes

  • esc: exit back to normal mode

  • i enter insert mode

  • v enter visual mode
    You should always be in visual mode, unless you are inserting text. The power of vim is treating text as repeatable actions.

  • /: Search mode, jump back and forth with n and N

Navigation

  • hjkl for moving around

  • Ctrl+o Jump to the last palce you have viewed

  • Ctrl+i/Tab Jump forward

  • w,b to skip words forward and back

  • Ctrl+d page down

  • Ctrl+u page up

Editing commands

  • c change
  • d delete
  • r replace
  • y yank
  • p paste
  • u undo
  • Ctrl+r redo
  • . repeat the last editing action

You can combine operator + number + motion
Examples:

  • Delete 7 lines down
  • Change word
  • Change between parenthesis

Saving and exiting

  • :w write
  • :q quit
  • :wa write all
  • :wq write and quit TIP: Remap the following to save frustration:
command! Q q
command! W w
command! Wq wq
command! WQ wq
command! WA wa
command! Wa wa
command! Qa qa
command! QA qa

More useful keys

  • > indent selected line or text right
  • < indent selected or text left
  • = Align indentation
  • * Search word under cursor forward
  • # Search word under cursor back

Plugins

Vim has an extensive plugin system. You can find a plugin for syntax highlight, spell check, linting, code completion, git integration.

To use plugins you need a plugin manager. There are a few to choose from.

Pathogen

After following installation process, simply clone the relevant repository into $HOME/.vim/bundle (other actions may apply)

Installation

Get support for python3 and/or lua

brew install vim
Then run vim --version to make sure you see +lua, +python

Main configuration file is $HOME/.vimrc Additional configurations an plugins $HOME/.vim

Repository installation:

Clone this repository as .vim

git clone https://github.com/amanusk/dotvim.git .vim

make soft links

ln -s .vim/vimrc .vimrc

Install the plugins on a new machine

cd .vim &&
git submodule init &&
git submodule update 

Update the plugins

git submodule foreach git pull origin master

Add new submodule

git submodule add http://github.com/tpope/vim-fugitive.git bundle/fugitive

Remove submodule

Delete the relevant section from the .gitmodules file.
Stage the .gitmodules changes git add .gitmodules
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Run rm -rf .git/modules/path_to_submodule
Commit git commit -m "Removed submodule <name>"
Delete the now untracked submodule files
rm -rf path_to_submodule

Other softlinks

ln -s .vim/.bash_aliases .bash_aliases &&
ln -s .vim/tmux.conf .tmux.conf 

Resources

Why vim looks like this Where vim came from

Releases

No releases published

Packages

No packages published