Skip to content

Instantly share code, notes, and snippets.

View andlrc's full-sized avatar

Andreas Louv andlrc

  • Copenhagen
  • 11:27 (UTC +02:00)
View GitHub Profile
" gitsendmail.vim - gitsendmail after ftplugin
" Author: Andreas Louv <andreas@louv.dk>
" Last Change: Jan 04, 2013
setlocal includeexpr=GitSendMailIncludeExpr(v:fname)
function! GitSendMailIncludeExpr(fname) abort
let m = matchlist(a:fname, '^\%(a\|b\)/\(\f\+\)$')
if !empty(m)
let file = m[1]
" istagkeyword - add the content of the variable "b:istagkeyword",
" the content of the variable "g:istagkeyword",
" or a literal hyphen ('-'), in that order,
" to the 'iskeyword' option when jumping to tags
" Maintainer: Andreas Louv <andreas@louv.dk>
" Date: 2 Sep 2015
nnoremap <silent> <expr> <C-]> <Sid>Tag(':tag', "<C-]>")
nnoremap <silent> <expr> g<C-]> <Sid>Tag(':tjump', "g<C-]>")
nnoremap <silent> <expr> g] <Sid>Tag(':tselect', "g]")
" dyngrepprg - set "grepprg" to dynamically when inside a git repository
" Maintainer: Andreas Louv <andreas@louv.dk>
" Date: 3 Aug 2018
augroup DynGrepPrg
au!
au DirChanged * call <SID>SetGrepPrg()
augroup END
function! s:SetGrepPrg()
" di-prompt - Prompt for a number after using [I, [D, ]I and ]D
" Maintainer: Andreas Louv <andreas@louv.dk>
" Date: 01 Apr 2013
" List and jump to define and include
" \022\027 is ^R^W (Pasting word under cursor)
function! PromptAndExec(cmd)
let ans = input('Type number and <Enter> (empty cancels): ', '')
if ans =~# '^\s*$'
vim9script
# jump.vim - Calls git-jump and hydrate a qflist
# Maintainer: Andreas Louv <andreas@louv.dk>
# Last Change: Apr 19, 2023
def Jump(...args: list<string>): string
var strargs: string = args->map((key, val) => expand(val))->join(' ')
var cmd = 'git jump --stdout ' .. strargs
vim9script
# t-f - make it possible to provide a count after 't' and 'f'
# Maintainer: Andreas Louv <andreas@louv.dk>
# Date: 07 May 2023
xnoremap <expr> t v:count > 0 ? 't' : <Sid>TF('t')
xnoremap <expr> f v:count > 0 ? 'f' : <Sid>TF('f')
onoremap <expr> t v:count > 0 ? 't' : <Sid>TF('t')
onoremap <expr> f v:count > 0 ? 'f' : <Sid>TF('f')
#include <err.h>
#include <regex.h>
#include <stdio.h>
#include <string.h>
void redie(int eval, regex_t *re, char *msg) {
char buf[1024];
regerror(eval, re, buf, sizeof(buf));
@andlrc
andlrc / rpgle.mk
Created March 21, 2019 10:36
Compilation rules for ILE RPG programs
# NAME
# rpgle.mk - compilation rules for ILE RPG programs
#
# SYNOPSIS
# LIBL = XXX YYY
# OUTLIB = XXX
# PREFIX = dist/
# CLEANPREFIX = clean/
#
# include rpgle.mk