Thursday, July 25, 2013

Work notes; more vim

Vim

Omit 'Pattern not found' error message in Vim script

:%s/x/y/ge
http://stackoverflow.com/questions/1043432/omit-pattern-not-found-error-message-in-vim-script

Advanced Vim macros

http://blog.sanctum.geek.nz/advanced-vim-macros/

Wonderful resource in helping me better understand registers, macros and how to use inside vim functions.

How to create escaped vim characters besides just copying?

<C-V> + somekey = escaped vim character code
http://unix.stackexchange.com/questions/46827/vim-executing-a-key-command-in-a-function

Variables in Vimscript: Registers as Variables

:let @a = "hello!"
http://learnvimscriptthehardway.stevelosh.com/chapters/19.html

How to use vim registers?

# from vim after selecting a block of text
"ny

# where n is the register letter you want to save the text in
http://stackoverflow.com/questions/1497958/how-to-use-vim-registers

Seven habits of effective text editing

:abbr Lunix Linux

vip:w !wc -w

:grep
:cn

[I:
http://www.moolenaar.net/habits.html

Vim Scripting - call function once for all selected lines

fun Foo() range
    ...
endfun
http://stackoverflow.com/questions/8597153/vim-scripting-call-function-once-for-all-selected-lines

Mapping keys in Vim - Tutorial (Part 1)

nunmap - Unmap a normal mode map
vunmap - Unmap a visual and select mode map
xunmap - Unmap a visual mode map
sunmap - Unmap a select mode map
iunmap - Unmap an insert and replace mode map
cunmap - Unmap a command-line mode map
ounmap - Unmap an operator pending mode map
http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_1%29

Escaping single quotes

    :echo escape('as''df', '''') 
http://vim.1045645.n5.nabble.com/escape-and-td1200763.html

Clearing/setting the last search

:let @/ = ""
:let @/ = '^\c[a-z0-9]'
http://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting

How do I emulate a keypress inside a Vim function?

" Press CTRL-Y:
normal <Ctrl+v><Ctrl+y>
http://stackoverflow.com/questions/9445273/how-do-i-emulate-a-keypress-inside-a-vim-function

Vim - yank into search register

" First, "Ayw to yank a word into register A
" Then, / ^R A to put the contents of register A into the search string.
http://stackoverflow.com/questions/2312844/vim-yank-into-search-register

No comments:

Post a Comment