nvim ed

...a vim-based text editor!

basic usage ed

leave any mode by ESC ...go into "normal mode"

command mode ed

From general mode type :Some commands (enter ↵):

:q     quit
:q!    quit (ignore changes)
:wq    save + quit
:w     save
:!XXX  run a shell command XXX
:r FFF read a file and insert at cursor
:r!XXX run a shell command and insert the output

TAB can display auto complete

normal mode ed

/XXX↵ search
n     next
i     edit mode
dd    delete line
d10↵  delete 10 lines
yy    copy line
y10↵  copy 10 lines
p     paste after current line
P     paste before current line
u     undo
Ctrl+r  redo

insert mode ed

Almost like a regular text editor...

visual mode ed

Enter via v, or mouse...

advanced editing ed

ranges ed

[range] :=

 5,10    lines 5,...,10
 %       whole file
 .,$     from current line to end of file
 .3,.+7  current+3 to current+7 (+ optional)

edit ed

:s/OLD/NEW/g    replace (current line)
:[range]s/...   replace
:g/PATTERN      list all lines with
:[range]d       delete
:[range]t LINE  copy range to (after) LINE
:[range]m LINE  move range to (after) LINE

multi-document ed

windows ed

Ctrl+w,v     split horizontally
Ctrl+w,s     split vertically
Ctrl+w,c     close window
Ctrl+w,w     next window
Ctrl+w,arrow jump to...

documents ed

:e FILE    open/edit file (can use tab)
:b FILE    switch to file (tab)
:ls        list open files

special stuff ed

mouse ed

enable
set mouse=a

Now, selecting starts visual mode

disable
set mouse=

system clipboard ed

install xclipvisual mod select

"+y↵    copy

plugin managers ed

vim-plug ed

install vim-plug
according to https://github.com/junegunn/vim-plug:
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs  \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

install a plugin
call plug#begin()
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'lervag/vimtex'
Plug 'SirVer/ultisnips'
call plug#end()
...

ESC:PlugInstall

this will download and install all requested plugins

vim8 internal ed

...

plugins ed

nerd tree ed

install nerdtree
git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q

edit .config/nvim/init.vim
call plug#begin()
Plug 'preservim/nerdtree'
call plug#end()
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

ESC:PlugInstall

vimtex ed

Plug 'lervag/vimtex'

Categories: Computer