Skip to content

bencao/vim_in_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim_in_docker

A customized vim run in a Docker container, it could be run in MacOS, Linux with docker installed.

Installation

sudo -- sh -c "curl -LSso /usr/local/bin/vim http://bit.ly/vim_in_docker; chmod  + x /usr/local/bin/vim"

Demo

Plugins Selection and Why

List of Plugins

Vim Frequently Used Key Bindings

VIM in Docker Help

  • [normal mode] Space then h open vim_in_docker help in VIM

Movement Key Bindings

  • [normal mode] Space then f quick jump to any words in the screen Demo
  • [normal mode] Space then r rebuild ctags for current directory
  • [normal mode] Ctrl + ] jump to definition, need to rebuild ctags first
  • [normal mode] Ctrl + o jump back to last cursor position
  • [normal mode] Ctrl + i jump back to next cursor position
  • [normal mode] Space then Space jump to and jump back between the current editing file and the last edited file

Selection Key Bindings

  • [normal mode] Ctrl + n press multiple times to select multiple current word and edit all of them at the same time Demo

Comment Key Bindings

  • [visual mode] g then c toggle comment

Complete Key Bindings

  • [insert mode] Tab auto complete with next candidate
  • [insert mode] Shift + Tab auto complete with previous candidate

Alignment Key Bindings

  • [visual mode] Enter then = align selected lines by =
  • [visual mode] Enter then : align selected lines by :

Search & Navigations Bindings

  • [normal mode] Space then b browse files, use Ctrl + j/Ctrl + k to move between candidates Demo
  • [normal mode] Space then a search text patterns in directories using Ag, the result will be shown in a Quickfix window

Windows Key Bindings

  • [normal mode] Space then t toggle directory tree
  • [normal mode] Space then T open directory tree and select current editing file Demo
  • [normal mode] Space then s split a new horizontal window to the left
  • [normal mode] Space then S split a new vertical window to the top
  • [normal mode] Space then o toggle window/fullscreen
  • [normal mode] Space then w shortcut for :w
  • [normal mode] Space then W shortcut for :w!
  • [normal mode] Space then q shortcut for :q
  • [normal mode] Space then Q shortcut for :q!
  • [normal mode] Ctrl + h/Ctrl + j/Ctrl + k/Ctrl + l move left/up/down/right among windows Demo

List Available Key Bindings

  • :map all mode key mappings
  • :nmap normal mode key mappings
  • :vmap visual mode key mappings
  • :imap insert mode key mappings

Known Limitation

MacOS users can only edit files under /Users directory

In MacOS we always need boot2docker which is a lightweight Linux where we could run docker(which relies on Linux Kernel features such as cgroups), when starting boot2docker, the typical installation only map the host's /Users directory inside the guest's /Users directory(reasonable from security perspective). Considering Vim in Docker is essentially a process in boot2docker VM, it can only read files inside the VM file system, that explains why we can only edit files in the /Users directory.

About

Vim run in a Docker container, support MacOS/Linux which has docker installed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published