Skip to content

Instantly share code, notes, and snippets.


Ahmed El Gabri ahmedelgabri

View GitHub Profile
ahmedelgabri / statusline.vim
Last active May 4, 2021
Trying to build my vim statusline without plugins
View statusline.vim
" Statusline & Tabline/Buffer line
" Dynamically getting the fg/bg colors from the current colorscheme, returns hex which is enough for me to use in Neovim
" Needs to figure out how to return cterm values too
let fgcolor=synIDattr(synIDtrans(hlID("Normal")), "fg", "gui")
let bgcolor=synIDattr(synIDtrans(hlID("Normal")), "bg", "gui")
" Tabline/Buffer line
set showtabline=2
set tabline="%1T"
ahmedelgabri / vimModeStateDiagram.svg
Created Mar 28, 2021 — forked from darcyparker/vimModeStateDiagram.svg
Vim Modes Transition Diagram in SVG Note, most of the nodes in this graph have clickable hyperlinks to documentation.
View vimModeStateDiagram.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View VimScriptForPythonDevelopers.MD

Vim Script for Python Developers

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 programming in Python.

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

For a similar guide 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, [abbrevi

ahmedelgabri / gist:8122545
Last active Dec 22, 2020
Shell function to open a static server (Python, Ruby or PHP)
View gist:8122545

Static server shell function

A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.

How it works

$ staticServer <lang> <port> #port is optional, default is 8000
ahmedelgabri / Sublime Text command log
Created Sep 21, 2013
Log Sublime Text command in the console, very helpful when trying to figure out command you want to create shortcuts for.
View Sublime Text command log
View default
# aerc default styleset
# This styleset uses the terminal defaults as its base.
# More information on how to configure the styleset can be found in
# the aerc-styleset(7) manpage. Please read the manual before
# modifying or creating a styleset.

Essential Apps

  • Blink: Install Blink on your iPad
  • Tailscale: Install Tailscale on all your devices.
  • mosh: Install mosh on all your devices. It comes with Blink by default.

Nice to have apps

Amphetamine for Mac

View md-to-html.js
var unified = require('unified')
var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var html = require('rehype-stringify')
var report = require('vfile-reporter')
ahmedelgabri /
Created Mar 7, 2020 — forked from jasonrudolph/
Programming Achievements: How to Level Up as a Developer
ahmedelgabri /
Created Jul 2, 2019
global types in Typescript

I'm migrating a legacy codebase to Typescript & it has some global objects attached to window & I want these to be available always.

So I created globals.d.ts file that looks something like this

interface Foo {
  a: string;
  b: number;