VIM #9 ~ TUTORIALS by wglenz

View this thread on steempeak.com
· @wglenz · (edited)
$0.09
VIM #9 ~ TUTORIALS
<center><h3>VIM </h3><a href="https://steempeak.com/@wglenz">Published with SteemPeak</a></center>

<center><h6> $ ./configure<br>$ make<br># make install</h6></center>


<center>![Screenshot](https://files.steempeak.com/file/steempeak/wglenz/bZQTHmP6-Screenshot20from202019-06-032009-12-49.png)Screenshot by Willi Glenz</center>

<center><h4>SUMMARY</h4></center>

```
	VIM ~ A PROGRAMMER'S EDITOR

008 first-steps															v1 19-06
009 tutorials															v1 19-06 new
005 modes																v1 19-06
001 movements															v2 19-06
004 buffers																v1 19-06
006 macros																v1 19-06 
003 cheat-sheet															v2 19-06 
002 documentation														v2 19-06 

007 ~/.vimrc															v1 19-06

:h user-manual ....................... <ctrl-w_> ................... User manual
:h reference  ........................ <ctrl-w_> .............. Reference manual
```

<br>
<center><h4>#009</h4></center>

```
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
```

<br>
```
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
```

<br>
```
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(                            
```

<br>
```
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!
```

<br>
```
005 MODES 
```
```
:h vim-modes 

:h Normal-mode ..........<ctrl-w_>.................. Normal mode
:h Visual-mode ..........<ctrl-w_>.................. Visual mode
:h Select-mode ..........<ctrl-w_>.................. Select	mode
:h Insert-mode ..........<ctrl-w_>.................. Insert mode
:h Command-line-mode ....<ctrl-w_>............ Command-line mode
:h Ex-mode ..............<ctrl-w_>...................... Ex mode
:h Terminal-mode ........<ctrl-w_>................ Terminal mode
```

<br>
```
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
```

<br>
```
003 CHEAT-SHEET
```
```
:ve :version ............................................ version
:ab :abc :unab ^v .................................... abbreviate
a A i I o O s S C ~ .................... append insert substitute
$ vim -u NONE -N ....................................... baseline
r x ~ ..................................... replace delete change
ci( ci{ ci< ci" .................................... change inner
v j " + 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
m1 '1 `1 marks ............................................. mark
[InsertMode] ^n ........................................... match
: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
^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
```

<br>
```
002 DOCUMENTATION
```
```
:h user-manual ........... <ctrl-w_> ..................... User manual
:h reference  ............ <ctrl-w_> ................ Reference manual
$ man vim .................................................. man-pages
file:///usr/share/doc/vim-doc/html/index.html ............ file-system 
:h :resize ............... <ctrl-w_> ................. vim-help-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
```

<br>
```
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
```

👍  , , , , , , , , , , ,
properties (23)
post_id76,260,318
authorwglenz
permlinkvim-8-tutorials
categorylinux
json_metadata{"app":"steempeak\/1.11.1","format":"markdown","tags":["linux","debian","arch","vim","opensource"],"users":["wglenz","a"],"links":["\/@wglenz"],"image":["https:\/\/files.steempeak.com\/file\/steempeak\/wglenz\/bZQTHmP6-Screenshot20from202019-06-032009-12-49.png"]}
created2019-06-12 09:04:09
last_update2019-06-12 19:10:48
depth0
children0
net_rshares162,995,727,597
last_payout2019-06-19 09:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.072 SBD
curator_payout_value0.017 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length8,187
author_reputation1,724,513,770,671
root_title"VIM #9 ~ TUTORIALS"
beneficiaries
0.
accountsteemchiller
weight100
1.
accountsteempeak
weight100
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars0
author_curate_reward""
vote details (12)