Skip to content

Instantly share code, notes, and snippets.

View romainl's full-sized avatar
💰
Alwayz Into Somethin'

Romain Lafourcade romainl

💰
Alwayz Into Somethin'
  • Razorfish France
  • Paris, France
View GitHub Profile
@RichardBronosky
RichardBronosky / imgist.sh
Last active August 17, 2023 15:07
Imgur was down, so I created Imgist
#! /usr/bin/env bash
set -eu
_main(){
input_file="$1"
file_path="$(realpath -s "$input_file")"
file_name="$(basename "$file_path")"
cd "$(dirname "$(realpath -s "${BASH_SOURCE[0]}")")"
cp "$file_path" ./
git add "$file_name"
@roramigator
roramigator / post.js
Created January 29, 2022 20:04
this guy wrote a dynamic tutorial on how to write a compiler all in the same single javascript file
'use strict';
/**
* TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E
* T:::::TT:::::::TT:::::THH::::::H H::::::HHEE::::::EEEEEEEEE::::E
* TTTTTT T:::::T TTTTTT H:::::H H:::::H E:::::E EEEEEE
* T:::::T H:::::H H:::::H E:::::E
* T:::::T H::::::HHHHH::::::H E::::::EEEEEEEEEE

Annoying vim search highlight "everyone" tries to get rid of

You have turned on hlsearch for some reason in your vim config (well obviously to highlight your searches) but it gets in your way, right?

Now you try to find a solution to this problem, like

  1. spam random searches /klsdf<CR>

  2. do :nohl command or

@PeterRincker
PeterRincker / diff.md
Last active October 18, 2021 08:21 — forked from romainl/diff.md
:DiffOrig but smarter

:DiffOrig but smarter

This is an enhanced version of the snippet provided under :help diff-original-file.

Where the original :DiffOrig only shows differences between the buffer in memory and the file on disk, :Diff can be used in two ways:

  • against the file on disk, like the original, with:

    :Diff
    
@shmup
shmup / nonymous-ix.vim
Last active September 8, 2021 01:30
nonymous-ix.vim uses .netrc for auth, and fucks with ix.io
" nonymous-ix.vim uses .netrc for auth, and fucks with ix.io
" insert :IX [optional visual selection] - copies url to system clipboard
" replace :RX <URL> [optional visual selection]
" delete :DX <URL>
if has('win64') || has('win32') || has('win16')
let s:env = 'WINDOWS'
else
let s:env = toupper(substitute(system('uname'), '\n', '', ''))
endif
@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active January 12, 2024 10:51
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

Vim will move the cursor to the beginning of an object after invoking operator upon it. From an interactive editing perspective this may be considered annoying however it is the consistent choice as operators can be destructive. As such restoring the cursor to its prior position after invoking an operator on an object may not make sense.

There are many ways possible to alter this behaviour to your preference with mappings and/or scripting. But with custom operator mappings this can be particularly ugly.

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
@g0xA52A2A
g0xA52A2A / Vim_autoreply.md
Last active June 4, 2023 23:30
Vim autoreply

A modified version of Romain's gist.

See prior revisions for functionality closer to the original. This is now a simplification that aims only to provide prompts that would typically follow basic commands.

function! ExpandCommand(pattern) abort
  let aliases =
 \ { 'cn' : 'cnext'