Skip to content

Instantly share code, notes, and snippets.

View xEgorka's full-sized avatar
⌨️
keyboarding

Egor Maltsev xEgorka

⌨️
keyboarding
  • above the eternal peace
View GitHub Profile
@todgru
todgru / starttmux.sh
Last active May 27, 2024 08:20
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
@squarism
squarism / iterm2.md
Last active June 18, 2024 15:33
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@QuantumGhost
QuantumGhost / example.puml
Last active March 23, 2024 22:39
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@romainl
romainl / pseudo-text-objects.vim
Last active January 11, 2024 07:45
Custom pseudo-text objects
" 24 simple pseudo-text objects
" -----------------------------
" i_ i. i: i, i; i| i/ i\ i* i+ i- i#
" a_ a. a: a, a; a| a/ a\ a* a+ a- a#
" can take a count: 2i: 3a/
for char in [ '_', '.', ':', ',', ';', '<bar>', '/', '<bslash>', '*', '+', '-', '#' ]
execute "xnoremap i" . char . " :<C-u>execute 'normal! ' . v:count1 . 'T" . char . "v' . (v:count1 + (v:count1 - 1)) . 't" . char . "'<CR>"
execute "onoremap i" . char . " :normal vi" . char . "<CR>"
execute "xnoremap a" . char . " :<C-u>execute 'normal! ' . v:count1 . 'F" . char . "v' . (v:count1 + (v:count1 - 1)) . 'f" . char . "'<CR>"
execute "onoremap a" . char . " :normal va" . char . "<CR>"
@romainl
romainl / grep.md
Last active June 15, 2024 03:32
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

@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'

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

@viglioni
viglioni / string-bin.hs
Last active July 2, 2022 21:54
Encode/Decode strings into strings of binaries
--
-- Encodes/Decodes string in a string of binaries
--
-- Each char is converted to a string with eight 0s or 1s
-- λ> encode "The darkside of the force is a pathway to many abilities some consider to be unnatural"
-- "0101010001101000011001010010000001100100011000010111001001101011011100110110100101100100011001010
-- 01000000110111101100110001000000111010001101000011001010010000001100110011011110111001001100011011
-- 00101001000000110100101110011001000000110000100100000011100000110000101110100011010000111011101100
@ndtn97
ndtn97 / cmdtab2missioncontrol.json
Created April 5, 2022 11:06
Karabiner-Elements Command+Tab -> Mission Control
{
"title": "Command + Tab -> Mission Control",
"rules": [
{
"description": "Replace Command + Tab -> Mission Control",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "tab",