The expression below captures the first group match and adds its to a list for later use.
let t =[] | '<,'>s/\v\\code\{([^}]+)}\zs/\=add(t, submatch(1))[1:0]/g
We can then place the list into another section of the file with.
put = t
docker run --name <container_name> --rm -i -t <image> <shell, eg. /bin/bash> |
function! VimtexLabelRename(oldtag, newtag) | |
" Change figure tag in tex and move the corresponding | |
" file. | |
exe '%s/\v\{(fig:)?' . a:oldtag . '\}/{fig:' . a:newtag . '}/g' | |
exe '%s/\v\{' . a:oldtag . '(_.*)?\.png\}/{' . a:newtag . '\1.png}/g' | |
exe '!for i in `find assets -name 'a:oldtag.'*`; do mv $i ${i/'.a:oldtag.'/'.a:newtag.'}; done' | |
"exe '!mv' 'assets/'.a:oldtag.'.png' 'assets/'.a:newtag.'.png' | |
endfunction | |
command! -nargs=* VimtexLabelRename call VimtexLabelRename(<f-args>) |
The expression below captures the first group match and adds its to a list for later use.
let t =[] | '<,'>s/\v\\code\{([^}]+)}\zs/\=add(t, submatch(1))[1:0]/g
We can then place the list into another section of the file with.
put = t
from Stack Exchange
Select target pane and enter Prefix
-:
break-pane -dP
" from https://github.com/suy/vim-context-commentstring/blob/master/doc/context-commentstring.txt | |
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') |
docker inspect container | jq -r '..|.Mounts? |select(.!=null) | map(.Source)[]' |
// Before proceeding add an ID `target` to the table you want to perform the analysis on | |
// Google Chrome intercepts $ as a shortcut for document.querySelector() and | |
// $$() as a shortcut for document.querySelectorAll() | |
items = [] | |
$$('#target tr').forEach( | |
(row) => items.push( | |
parseFloat( |
set aw | |
" There are two different approaches for finding the target files | |
" execute "args" join(systemlist("ag -l pattern path/to/files"), " ") | |
args `ag -l pattern path/to/files` | |
argdo %s/pattern/new/g | w |
# from https://www.linuxquestions.org/questions/programming-9/removing-duplicate-lines-with-sed-276169/ | |
# $!N | |
# if not in the last line, append the next line of input | |
# pattern space (no duplicates): line1\nline2 | |
# stdout: null | |
# | |
# /^\(.*\)\n\1$/ | |
# does the pattern space (eg. line1\nline2) contains duplicate lines (eg. line1 == line2)? | |
# | |
# /<REGEX>/!P |
# sometimes we have a hierarchical list and we want to print all of the nodes | |
# that have a certain child, simple regular expression will only yield the child | |
# not the whole node. We can use sed to recover the whole node. | |
# | |
# let's say we want to recover all packages in pipenv graph that use pandas. | |
# /^ /!x{...} | |
# all of lines which do not start with a space are at the top of the | |
# hierarchy, swap them with the hold space. The hold space has now the node | |
# and the pattern space contains the contents of the hold space. Execute all | |
# commands between brackets. |