Our goal, here, is threefold:
- use Vim's built-in features to their fullest,
- be a good project citizen even if we don't use $EDITOR_DU_JOUR,
- have a minimal but beneficial impact on the infrastructure of the project we work on.
Our goal, here, is threefold:
" Print the sum of the lines covered by visual selection or motion | |
function! Sum(type, ...) | |
let sel_save = &selection | |
let &selection = "inclusive" | |
let reg_save = @@ | |
*t'> | |
'[,']!awk '{ sum += $0 } END { print sum }' | |
let &selection = sel_save |
nnoremap <expr> gt ":tabnext +" . v:count1 . '<CR>' | |
nnoremap <expr> gT ":tabnext -" . v:count1 . '<CR>' |
:help :global
is an incredibly cool command.
One thing I like to do with :global
is to list lines matching a given pattern in the current file and use that to move around. It looks like this:
:g/let/#
7 let &path .= 'src/**,public/**,static/**'
31 unlet b:gqview
33 nmap GQ :let b:gqview = winsaveview():set opfunc=Formatg@
A.Politz | |
Aaron Burrow | |
Adam Slater | |
Adnan Zafar | |
Adri Verhoef | |
Adrian Kocis | |
Adrien Beau | |
Agathoklis Hatzimanikas | |
Agorgianitis Loukas | |
Ajit Thakkar |
if toupper(substitute(system('uname'), '\n', '', '')) =~ 'DARWIN' | |
\ && exists('+pythonhome') | |
\ && exists('+pythondll') | |
\ && exists('+pythonthreehome') | |
\ && exists('+pythonthreedll') | |
let python_path = '/opt/local/Library/Frameworks/Python.framework/Versions' | |
let &pythonhome = '' | |
let &pythondll = '' | |
let &pythonthreehome = '' | |
let &pythonthreedll = '' |
function! Substitute(type, ...) | |
let cur = getpos("''") | |
call cursor(cur[1], cur[2]) | |
let cword = expand('<cword>') | |
execute "'[,']s/" . cword . "/" . input(cword . '/') | |
call cursor(cur[1], cur[2]) | |
endfunction | |
nmap <silent> <key> m':set opfunc=Substitute<CR>g@ | |
" Usage: |
#!/usr/bin/env bash | |
cd ~/Music/_dl | |
youtube-dl \ | |
--extract-audio \ | |
--audio-format mp3 \ | |
--audio-quality 0 \ | |
--embed-thumbnail \ | |
--output '%(title)s.%(ext)s' \ | |
"$1" |