Skip to content

12th April 2022

Computer Science

GNULinux

Basics

  • New: Get command output or default value if emtpy.

    echo | sed 's/^$/default value/'
    

neovim

  • New: Search for visual selection.

    vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
    
    To use the mapping, visually select the characters that are wanted in the search, then type // to search for the next occurrence of the selected text.

sed

  • New: Use matched pattern.

    echo "foobarbaz" | sed 's/^foo\(.*\)baz$/\1/'
    

    Returns bar.