VIM
A Programmer's EditorPublished with SteemPeak
$ ./configure
$ make
# make install

SUMMARY
002 documentation ..................................................... v3 19-06
003 cheat-sheet ....................................................... v3 19-06
018 youtube ........................................................... v1 19-06
007 ~/.vimrc .......................................................... v1 19-06
008 first-steps ....................................................... v1 19-06
009 tutorials ......................................................... v1 19-06
005 modes ............................................................. v2 19-06
001 movements ......................................................... v2 19-06
010 marks ............................................................. v1 19-06
004 buffers ........................................................... v1 19-06
013 tabs .............................................................. v1 19-06
015 windows ........................................................... v1 19-06
011 folds ............................................................. v1 19-06
006 macros ............................................................ v1 19-06
012 text-objects ...................................................... v1 19-06
014 ex-commands ....................................................... v3 19-06
017 github repository ................................................. v1 19-06
019 vim-mode in bash .................................................. v1 19-06
020 vim-mode in fish .................................................. v1 19-06 new
016 ranger - a console file manager with vi key bindings .............. v1 19-06
:h user-manual <ctrl-w_> ........................................... user manual
:h reference <ctrl-w_> ........................................ reference manual
#020
020 VIM-MODE IN FISH
~> vim .config/fish/config.fish
#fish_default_key_bindings
fish_vi_key_bindings
:wq
~> <ctrl-d>
019 VIM-MODE in BASH
$ vim ~/.bashrc
set -o vi
bind -m vi-insert "\C-l" # clear-screen
:wq
Source : sanctum.geek.nz/arabesque/vi-mode-in-bash/
018 YOUTUBE
Chris Toomey ~ Mastering the Vim Language ................. youtu.be/wlR5gYd6um0
017 GITHUB REPOSITORY
$ cd ~/Apps # Place of your local installations
$ git clone https://github.com/vim/vim.git # At the first time
$ git pull # Update to the latest version
$ cd vim/src
# make distclean # If you build Vim before
# make
# make install
vim.org/git.php
016 RANGER - A CONSOLE FILE MANAGER WITH VI KEY BINDINGS
F1 F2 F3 F4 F5 F6 F7 F8 F10
help rename view edit copy cut mkdir delete exit
Exit : q
Help : ? <f1>
--------------------------------------
Shell : S s
Show hidden files : <ctrl>h
File rename : <ctrl>cw :rename
File delete : <ctrl>dD :delete
File tag : t ct
Go home : gh
Go /etc : ge
INSTALLATION
# pip install ranger-fm
# apt install ranger
CONFIGURATION
$ ranger --copy-config=all
$ vim ~/.config/ranger/rc.conf
set draw_borders true
:wq
Homepage : ranger.github.io
Documentation : github.com/ranger/ranger/wiki
User-Guide : github.com/ranger/ranger/wiki/Official-user-guide
Wiki-Arch-Linux : wiki.archlinux.org/index.php/Ranger
015 WINDOWS
^ws ^wv :sp :vs :vs|b2 ................................................... split
^w= ^w_ ^w20< ^w :res :vertical res 120 ................................. resize
^wr ^wR ^wx ............................................................. rotate
^wn ........................................................................ new
^wc ^wq :q :close ........................................................ close
:h ^w ............................................................ documentation
^whjkl ^wt ^wb ^wp ^ww ^wx .............................................. move
^wo :ls :ba :vert ba :vert 2ba :vs|b2 ................................... buffer
:mks $ vim -S Session.vim .............................................. session
:set splitright laststatus=2 ............................................. vimrc
014 EX-COMMANDS
SUBSTITUTE
:s/abc/xyz/ ...................... substitute .................... first in line
:s/abc/xyz/gc .................... substitute ...................... all in line
:%s/^/# / ........................ substitute ............................. file
:%s/$/;/ ......................... substitute ............................. file
:%sort :sort ..................... sort ................................... file
:1,10sort ........................ sort ................................... part
013 TABS
:tabnew ................................................................ tab new
:tabe dummy.txt ....................................................... tab edit
:tab split ........................................................... tab split
:tabn :tabn2 :tabp gt 3gt gT ................................. tab next previous
:tabmove 0 ............................................................ tab move
:tab ba ......................................................... tab buffer all
:tabonly .............................................................. tab only
:tabm :tabm 0 ......................................................... tab move
:tabclose :q .................................................... tab close quit
012 TEXT OBJECTS
aw iw aW iW ...................... a|inner ................................ word
as is ............................ a|inner ............................ sentence
ap ip ............................ a|inner ........................... paragraph
a"'` i"'` ........................ a|inner .............................. string
a[](){}<> i[](){}<> .............. a|inner ............................... block
at it ............................ a|inner ........................... tag block
:h text-objects <ctrl-w_>
011 FOLDS
$ vim ~/.vimrc
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
:wq
zf ...................................................................... create
zo zn :%foldopen ..................................................... open none
zc zm :%foldclose ................................................... close more
zd ...................................................................... delete
:mkview :loadview .................................................... save load
:set foldmethod :set fdm ............................................ foldmethod
010 MARKS
ma 'a `a .............................................................. set mark
:marks :marks ABC ................................................... list marks
mA mB 'A 'B .................................................... different files
:delmarks A-Z a,b,c :delmarks! .................................... delete marks
009 TUTORIALS
• TutorialsPoint : tutorialspoint.com/vim/index.htm
• Bram Moolenaar : moolenaar.net/habits.html
• Ben McCormick I : benmccormick.org/2014/06/30/learning-vim-in-2014-the-basics
• Ben McCormick II : benmccormick.org/2014/07/02/learning-vim-in-2014-vim-as-language
008 FIRST-STEPS
01 INSTALL VIM
# apt-get install vim gvim vim-doc vim-scripts ....................... DEBIAN
# pacman -S vim ........................................................ ARCH
$ dpkg -L vim-doc
# update-alternatives --config editor
$ vim --version | less
02 REMAP <CAPS LOCK> TO <ESC>
• GNOME-TWEAK-TOOL: Typing-Tab > Caps Lock key behaviour > Make Caps Lock an additional ESC
03 LEARN AND TRAIN THE BASICS
$ vimtutor en
$ firefox vim-adventures.com
• vim, :h user-manual :resize
04 DISABLE YOUR ARROW KEYS
$ vim ~/.vimrc
map <up> <nop>
imap <up> <nop>
map <down> <nop>
imap <down> <nop>
map <left> <nop>
imap <left> <nop>
map <right> <nop>
imap <right> <nop>
:wq
05 CONFIGURE YOUR BASH-ENVIRONMENT
: echo $MYVIMRC
# update-alternatives --config editor
$ vim ~/.bashrc
EDITOR=/usr/bin/vim
VISUAL=$EDITOR
export EDITOR VISUAL
:wq
06 ACTIVATE VIM-MODE IN BASH
$ vim ~/.bashrc
set -o vi
bind -m vi-insert "\C-l" # clear-screen
:wq
07 ACTIVATE VIM-PLUGIN IN FIREFOX
Plugin: Vim Vixen
Homepage : vim.org
Reference : vimhelp.org/quickref.txt.html
007 VIMRC
colorscheme desert "desert default
let mapleader = "," "Leaderkey
set scrolloff=99 "Scrolling behaviour
set splitright "Splitting behaviour
set rnu "Relative line numbers
set nonu "Line numbers
set nocompatible
set showmode
set ruler
set linebreak
set showcmd
set laststatus=2
set background=dark
set encoding=utf8
filetype on
filetype plugin on
set mouse=a
"set colorcolumn=80
"set cursorline
"IDE
syntax on
set autoindent
set smartindent
set cindent
"FOLDING
autocmd BufWinLeave *.* mkview
"autocmd BufWinLeave *.* mks!
autocmd BufWinEnter *.* silent loadview
"DISABLE ARROW KEYS
map <up> <nop>
imap <up> <nop>
map <down> <nop>
imap <down> <nop>
map <left> <nop>
imap <left> <nop>
map <right> <nop>
imap <right> <nop>
"SEARCH
set nohlsearch
set incsearch
"TABs
set tabstop=4
set softtabstop=4
set shiftwidth=4
"set expandtab
"KEY MAPPINGS
"map <F2> :echo 'Current time is ' . strftime('%c')<CR>
nmap <F2> ggVG"+yzm
map <F5> :set list!<CR>
map <F6> :setlocal spell! spelllang=en_us<CR>
map <F8> :set nonu nornu<CR>
map <F9> :set rnu<CR>
map <F10> :set nu<CR>
map <Leader><F8> :set rnu!<CR>
map <Leader>, :mks!<CR> :wa<CR>
map <Leader>q zm:mks!<CR> :wqa<CR>
"ABBREVIATIONS
:iab ii <esc>
:iab psv public static void(String[] args) {<cr>}<esc>ko
:iab sout System.out.println(
006 MACROS
:reg .................................................................. register
qa q @a ....................................................... start stop run a
:put a .................................................................. edit a
0"ay$ ................................................................. update a
:map <F2> a<C-R>=strftime("%c")<CR><ESC>
:map <F2> ggVG"+y
:map <F2> :set list!
005 MODES
:h Normal-mode ......... <ctrl-w_> ................................. Normal mode
:h Insert-mode ......... <ctrl-w_> ................................. Insert mode
:h Visual-mode ......... <ctrl-w_> ................................. Visual mode
:h Command-line-mode ... <ctrl-w_> ........................... Command-line mode
:h Select-mode ......... <ctrl-w_> ................................. Select mode
:h Ex-mode ............. <ctrl-w_> ..................................... Ex mode
:h Terminal-mode ....... <ctrl-w_> ............................... Terminal mode
Normal Mode <esc>
Visual Mode v, V, <ctrl-v>
Command-line Mode :, /, ?
i I .................... INSERT MODE .................................... insert
aA ..................... INSERT MODE ........................... append & insert
sS cC .................. INSERT MODE ........................... delete & insert
oO ..................... INSERT MODE .................................... insert
:h vim-modes
004 BUFFERS
:ls :buffers .............................................................. list
:b1 :b2 :bn :bp :bf :bl :b# ....................... 1 2 next previous first last
:badd <ctrl-d> ............................................................. add
:bd ..................................................................... delete
:set hidden|nohidden .................................................... hidden
:mks :mks! ........................................................ save session
003 CHEAT-SHEET
:ab :abc :unab ^v ................................................... abbreviate
aA iI oO sS C ~ ....................................... append insert substitute
:ls :buffers :badd :b1 :b2 :bn :bp :bf :bl .............................. buffer
$ vim -u NONE -N ...................................................... baseline
r x ~ .......................................... character replace delete change
ci( ci{ ci< ci" ................................................... change inner
vj"+y ................................................................ clipboard
<esc> gg v G "+ y ......................................................... copy
dd D x d$ dip diw daw dit di" das ....................................... delete
$ vim -O ~/.vimrc ~/.bashrc ^ww ^wr ^wc ^wq ............................... edit
~ :e :edit $ ^xe .......................................................... edit
zf5j zo zc zd .......................................................... folding
:ve ^g g^g ......................................................... information
qa :reg a @a ............................................................ macros
m1 '1 `1 marks ............................................................ mark
[InsertMode] ^n .......................................................... match
hjkl gj gk gg G HML ................................................ move cursor
1% 50% 100% zz zb zt z<enter> ...................................... move cursor
:set nu|nonu :set rnu|nornu ............................................ numbers
. ....................................................................... repeat
/ f * # q/ q? q: :%s/one/two/g .......................................... search
/\cabc /\Cabc /\<abc\> :nohl ............................................ search
:set incsearch noincsearch :set hls nhls ................................ search
$ vimtutor en ......................................................... tutorial
u U ^r ............................................................... undo redo
:ve :version ........................................................... version
^wv ^ws ^wq ^ww ^wr ^wc ................................................ windows
gg G ^g 50% ^e ^y ^n ^u ^d ^f ^b ....................................... windows
:set ruler noruler ..................................................... windows
:set linebreak nolinebreak ............................................. windows
:call matchadd('colorColumn', '\%81v', 100) ............................ windows
:q :q! :qa :qa! :wq :wqa :exit ZZ ZQ ...................................... exit
002 DOCUMENTATION
:h user-manual ................ <ctrl-w_> .......................... User manual
:h reference ................. <ctrl-w_> ..................... Reference manual
:h :resize .................... <ctrl-w_> ...................... vim-help-system
$ man vim ............................................................ man-pages
file:///usr/share/doc/vim-doc/html/index.html ...................... file-system
Documentation I : vimhelp.org
Documentation II : vimhelp.org/usr_toc.txt.html
FAQ : vimhelp.org/vim_faq.txt.html
Wiki : vim.wikia.com/wiki/Vim_Tips_Wiki
001 MOVEMENTS
zz z. zb z- zt z<enter> ........ cursor ............................ move cursor
h j k l gj gk .................. character ............... left, down, up, right
b w B W ge e ................... word ............................ back, forward
0 ^ gm $ ....................... sentence ................... start, middle, end
( ) ............................ sentence ....................... next, previous
{ } ............................ paragraph ...................... next, previous
H M L .......................... window ...................... high, middle, low
gg G 1% 50% 100% ............... document ..................... first, last line
% .............................. brace, bracket, comment .................. next
Homepage : vim.org
Reference : vimhelp.org/quickref.txt.html
Are you using fish as your primary shell?
Posted using Partiko Android
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi,
it's my second shell. BASH is my base shell. There are a few features that I like better in the Fish Shell. -> command line replacement and functions, e.g. BASH-Scripting is awful ...
:-) Willi
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post had received 5.00% upvote from @steemitportugal account!

Vote for @steemitportugal to Witness. Your vote is very important to us!
Visit our WebSite www.steemitportugal.com (tutorials,news...)
Thank you very much.
Click here to vote
Delegation for daily voting: 10SP-25SP-50SP-100SP-250SP-500SP-1000SP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit