vim, editor dump

#saving

" Use qq in insert and command mode to Esc and to exit when in normal modeinoremap qq <Esc>cnoremap qq <Esc>nnoremap qq :q<cr>nnoremap q1 :q!<cr>" Use qs to save while in insert modeinoremap qs <Esc>:w<cr>a

#:h vim

i went weeks hitting ctrl + p which search only node modules before

hitting :h CtrlP where i learned how to set the custom ignore paths :~)

:h CtrlP

You can use Vim's |'wildignore'| to exclude files and directories from the results. Examples: >

  " Excluding version control directories  set wildignore+=*/.git/*,*/.hg/*,*/.svn/*        " Linux/MacOSX  set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\*  " Windows ('noshellslash')

#vim !$

or any command supplied w/ last bit of previous output

#vim.fandom.co.uk.biz.gov

vim tips wiki`

or any url = edit the html of said page

#r!

execute a command and print results under cursor

:r! echo $PATH

#vim frozen?

  1. review autocmds like autocmd BufWritePre * %s/\s+$//e`
  2. ctrl+c

#jump to last known cursor position / rename file

src

augroup vimrcEx  au!  autocmd FileType text setlocal textwidth=78  autocmd BufReadPost *    \ if line("'\"") > 0 && line("'\"") <= line("$") |    \   exe "normal g`\"" |    \ endifaugroup ENDfunction! RenameFile()    let old_name = expand('%')    let new_name = input('New file name: ', expand('%'), 'file')    if new_name != '' && new_name != old_name        exec ':saveas ' . new_name        exec ':silent !rm ' . old_name        redraw!    endifendfunctionmap <leader>n :call RenameFile()<cr>

#encrypt a file w/ a key

:X

enter a key

:wq!

open the file, re-enter the key

#search word beneath cursor in current dir

… and navigate 2 the first result… (in a new buffer!)

nnoremap <F5> :grep <C-R><C-W> *<CR>

src

#plugin overload?

vim --noplugin

#<3 the current setup?

:mk copy-of-current-settings.vim

copy-of-current-settings.vimif &cp | set nocp | endiflet s:cpo_save=&cposet cpo&vimimap <Nul> <C-Space>inoremap <expr> <Up> pumvisible() ? "\" : "\<Up>"inoremap <expr> <Down> pumvisible() ? "\" : "\<Down>"inoremap <expr> <S-Tab> pumvisible() ? "\" : "\<S-Tab>"inoremap <silent> <Plug>NERDCommenterInsert  <BS>:call NERDComment('i', "insert")inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<Del>" : "\<S-BS>"inoremap <silent> <Plug>delimitMateBS =delimitMate#BS()inoremap <silent> <C-Tab> =UltiSnips#ListSnippets()" etc

#what CTRL-x does?

:h ctrl-x

#delete rest of line

instead of d $ use C

#ctrl+p = best file explorer

don't use nnn, vifm, ranger, lynx etc.

#marks & jumps

ms = set a mark @ spot under cursor

s = go back 2 ms

(quicker: use c-i <tab> + c-o)

CTRL-O      Go to [count] Older cursor position in jump list<Tab>   or          *CTRL-I* *<Tab>*CTRL-I      Go to [count] newer cursor position in jump list

#set guifont=*

brings up font requester!

#ale > syntastic

by mucho ~ `:ALEInfo` on a rando blogpost in markdown returns:

 Current Filetype: markdownAvailable Linters: \['alex', 'markdownlint', 'mdl', 'proselint', 'redpen', 'remark-lint', 'textlint', 'vale', 'write-good']Enabled Linters: \['alex', 'markdownlint', 'mdl', 'proselint', 'redpen', 'remark-lint', 'textlint', 'vale', 'write-good']Suggested Fixers:'prettier' - Apply prettier to a file.Linter Variables:let g:ale_markdown_mdl_executable = 'mdl'let g:ale_markdown_mdl_options = ''Global Variables:let g:ale_completion_delay = v:nulllet g:ale_fix_on_save = 0

#:spell + zg + z=

// .vimrcmap <F5> :setlocal spell! spelllang=en_us<CR>

#z= find suggestions

zg add word to list

#div>ul>li*3 + ctrl y,

<div>  <ul>    <li><a href="#"> emmet </a></li>    <li><a href="#"> is </a></li>    <li><a href="#"> crazy </a></li>  </ul></div>

emmet is p sick

#gq}

wrap everything cutely, magically

#CD (NERDTree)

guess what this does

guess how many hours of my life i've wasted

opening a terminal to use `ack` bc i'd opened vim in not-the-directory

#L + ctrl + tab (vim-snippets)

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodtempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Atvero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,no sea takimata sanctus est Lorem ipsum dolor sit amet.

#ctrl p

ctrl-p(lease) use it

#vim 666

Was flirting with the idea of trying out emacs and reading the wiki. Found this funny section:

The Church of Emacs, formed by Richard Stallman, is a parody religion created for Emacs users.[49] While it refers to vi as the editor of the beast (vi-vi-vi being 6-6-6 in Roman numerals), it does not oppose the use of vi; rather, it calls it proprietary software anathema. ("Using a free version of vi is not a sin but a penance."[50])

#misc

you don't grok vi

vimways

generate TOC from markdown w/ ctags

romainl's gists

vimrc guide

/r/vim

#default keybindings

Key Action Followed bya enter insertion mode after current character text, ESCb back wordc change command cursor motion commandd delete command cursor motion commande end of wordf find character after cursor in current line character to findg UNBOUNDh move left one characteri enter insertion mode before current character text, ESCj move down one linek move up one linel move right one characterm mark current line and position mark character tag (a-z)n repeat last searcho open line below and enter insertion mode text, ESCp put buffer after cursorq UNBOUNDr replace single character at cursor replacement character expecteds substitute single character with new text text, ESCt same as "f" but cursor moves to just before found character character to findu undov UNBOUNDw move foreward one wordx delete single charactery yank command cursor motion commandz position current line CR = top; "." = center; "-"=bottomA enter insertion mode after end of line text, ESCB move back one WordC change to end of line text, ESCD delete to end of lineE move to end of WordF backwards version of "f" character to findG goto line number prefixed, or goto end if noneH home cursor - goto first line on screenI enter insertion mode before first non-whitespace character text, ESCJ join current line with next lineK UNBOUNDL goto last line on screenM goto middle line on screenN repeat last search, but in opposite direction of original searchO open line above and enter insertion mode text, ESCP put buffer before cursorQ leave visual mode (go into "ex" mode)R replace mode - replaces through end of current line, then inserts text, ESCS substitute entire line - deletes line, enters insertion mode text, ESCT backwards version of "t" character to findU restores line to state when cursor was moved into itV UNBOUNDW foreward WordX delete backwards single characterY yank entire lineZ first half of quick save-and-exit "Z"0 move to column zero1-9 numeric precursor to other commands [additional numbers (0-9)] command(SPACE) move right one character! shell command filter cursor motion command, shell command@ vi eval buffer name (a-z)# UNBOUND$ move to end of line% match nearest [],(),{} on line, to its match (same line or others)^ move to first non-whitespace character of line& repeat last ex substitution (":s ...") not including modifiers* UNBOUND( move to previous sentence) move to next sentence\ UNBOUND| move to column zero- move to first non-whitespace of previous line_ similar to "^" but uses numeric prefix oddly= UNBOUND+ move to first non-whitespace of next line[ move to previous "{...}" section "["] move to next "{...}" section "]"{ move to previous blank-line separated section "{"} move to next blank-line separated section "}"; repeat last "f", "F", "t", or "T" command' move to marked line, first non-whitespace character tag (a-z)` move to marked line, memorized column character tag (a-z): ex-submode ex command" access numbered buffer; load or access lettered buffer 1-9,a-z~ reverse case of current character and move cursor forward, reverse direction of last "f", "F", "t", or "T" command. repeat last text-changing command/ search forward search string, ESC or CR< unindent command cursor motion command> indent command cursor motion command? search backward search string, ESC or CR^A UNBOUND^B back (up) one screen^C UNBOUND^D down half screen^E scroll text up (cursor doesn't move unless it has to)^F foreward (down) one screen^G show status^H backspace^I (TAB) UNBOUND^J line down^K UNBOUND^L refresh screen^M (CR) move to first non-whitespace of next line^N move down one line^O UNBOUND^P move up one line^Q XON^R does nothing (variants: redraw; multiple-redo)^S XOFF^T go to the file/code you were editing before the last tag jump^U up half screen^V UNBOUND^W UNBOUND^X UNBOUND^Y scroll text down (cursor doesn't move unless it has to)^Z suspend program^[ (ESC) cancel started command; otherwise UNBOUND^\ leave visual mode (go into "ex" mode)^] use word at cursor to lookup function in tags file, edit that file/code^^ switch file buffers^_ UNBOUND^? (DELETE) UNBOUNDDefinitionsUNBOUND - this key is not normally bound to any vi commandword - a lower-case word ("w", "b", "e" commands) is defined by a consecutive string of letters, numbers, or underscore, or a consecutive string of characters that is not any of {letters, numbers, underscore, whitespace}Word - an upper-case word ("W", "B", "E" commands) is a consecutive sequence of non-whitespace.sentenceparagraphcursor motion command - any command which positions the cursor is ok here, including the use of numeric prefixes. In addition, a repeat of the edit command usually means to apply to the entire current line. For example, "<<" means shift current line left; "cc" means replace entire current line; and "dd" means delete entire current line.