Skip to content

Instantly share code, notes, and snippets.

function! RepWincmd(...)
execute (v:count ? v:count : s:rep[1]) 'wincmd' s:rep[0]
endfunction
function! s:setup(rep, ...)
let s:rep = [a:rep, v:count ? v:count : get(a:000, 0, 1)]
set operatorfunc=RepWincmd
return 'g@l'
endfunction
set nocompatible noswapfile viminfo=
let g:re = '\m\C\%(\\right\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\\middle\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\\left\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)r\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)m\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)l\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\%(\w\[\)\@2<!\|\%(\\[bB]igg\?\[\)\@6<=\)\%(\\[bB]igg\?\)\%(\\r\%(angle\|floor\|ceil\|[vV]ert\)\>\|\\urcorner\>\|)\|]\|\\}\)\|\%(\\[bB]igg\?\)\%(\\vert\>\||\|\\|\)\|\%(\\[bB]igg\?\)\%(\\l\%(angle\|floor\|ceil\|[vV]ert\)\>\|\\ulcorner\>\|(\|\[\|\\{\)\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\\}\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\\{\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m]\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\[\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m)\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4
@andymass
andymass / getwinindir.vim
Last active July 14, 2018 00:22
get window number in a particular direction hjkl
function! WinRect(winnr)
let l:pos = win_screenpos(a:winnr)
return { 'top': l:pos[0],
\ 'left': l:pos[1],
\ 'bottom': l:pos[0] + winheight(a:winnr) - 1,
\ 'right': l:pos[1] + winwidth(a:winnr) - 1,
\}
endfunction
set nocompatible noswapfile viminfo=
let g:re = '\m\C\%(\\right\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\\middle\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\\left\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)r\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)m\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\\[bB]igg\?\)l\>\%(\\\w\+\>\|\\[|{}]\|.\)\|\%(\%(\w\[\)\@2<!\|\%(\\[bB]igg\?\[\)\@6<=\)\%(\\[bB]igg\?\)\%(\\r\%(angle\|floor\|ceil\|[vV]ert\)\>\|\\urcorner\>\|)\|]\|\\}\)\|\%(\\[bB]igg\?\)\%(\\vert\>\||\|\\|\)\|\%(\\[bB]igg\?\)\%(\\l\%(angle\|floor\|ceil\|[vV]ert\)\>\|\\ulcorner\>\|(\|\[\|\\{\)\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\\}\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\\{\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m]\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m\[\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4<=\m)\|\%(\\left\|\\right\|\[\@1<!\\[bB]igg\?[lr]\?\)\@6<!\v%(\\@<!%(\\\\)*)@4
==23888== Memcheck, a memory error detector
==23888== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23888== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==23888== Command: ../src/vim test2.tex
==23888== Parent PID: 17594
==23888==
--23888--
--23888-- Valgrind options:
--23888-- --leak-check=yes
--23888-- --track-origins=yes
@andymass
andymass / find-file
Last active March 13, 2018 16:33
vim :terminal find-file
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'find-file: no file name specified'
exit 1
fi
echo -en "\033]51;vim:$1\007"
@andymass
andymass / tex-mw.vim
Created December 2, 2017 14:19
TeX match_words prototype
let s:not_bslash = g:matchup#re#not_bslash
function! s:gen_match_words()
let l:delims = [
\ [ '\\l\(angle\|floor\|ceil\|[vV]ert\)\>', '\\r\1\>'],
\ [ '\\ulcorner\>', '\\urcorner\>' ],
\ [ '(', ')' ],
\ [ s:not_bslash.'\[', s:not_bslash.']' ],
\ [ '\\{', '\\}' ]
\]
@andymass
andymass / dtp.vim
Last active March 13, 2017 20:05
Detect TeX program from %! TeX program= directive
function! DetectTexProgram()
let l:pat = '^\c\s*%\s*!\?\s*tex\s\+\(TS-\)\?program\s*=\s*\zs.*\ze\s*$'
let l:engine_list = {
\ 'pdflatex' : '',
\ 'lualatex' : '-lualatex',
\ 'xelatex' : '-xelatex',
\ 'context (luatex)' : '-pdflatex=context',
\ 'context (xetex)' : '-pdflatex=''texexec --xtx''',
\ 'context (pdftex)' : '-pdflatex=texexec',
function h = absolute_handle(s)
% ABSOLUTE_HANDLE Get function handle to a file, not necessarily on path
% H = ABSOLUTE_HANDLE(S) get handle to function or script in file S
[p,n,e] = fileparts(s);
o = cd();
if ~isempty(p)
fu = onCleanup(@() clean(o));
cd(p);
end

Keybase proof

I hereby claim:

  • I am andymass on github.
  • I am mass (https://keybase.io/mass) on keybase.
  • I have a public key whose fingerprint is A88B DB37 573A C005 766A 9251 C80E 3435 F58A 5B36

To claim this, I am signing this object: