Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active June 8, 2024 08:50
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@adscriven
adscriven / findfile.vim
Last active September 13, 2020 01:08
Interactive file search (Vim)
" Way out of date now ...
" findfile.vim -- interactive file search
" Experimental; caveat emptor.
" Documentation is at the end.
" Public Domain.
let s:cpo = &cpo
set cpo&vim
@droustchev
droustchev / _README.md
Last active April 8, 2021 21:55
tmux vim navigation

I recently tried out the fantastic vim-tmux-navigator tmux plugin. Unfortunately, some the default key bindings conflict with some of the key bindings my fuzzy finder of choice uses. I wanted to remap them to the default vim split navigation commands that are prefixed with C-w, and found the solution of hjdivad in his gist. However, I wanted a simpler solution, so after some more digging I stumbled upon this reddit post and ultimately came up with the following solution, which doesn't rely on key bindings that unbind themselves, but uses tmux's 'key-tables'.

@ipan
ipan / diff-jq.md
Created January 16, 2018 04:47
compare two JSONs with jq #json #jq
@mbinna
mbinna / effective_modern_cmake.md
Last active June 8, 2024 08:39
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@yegappan
yegappan / gist:3b50ec9ea86ad4511d3a213ee39f1ee0
Last active April 11, 2023 00:03
Updating a quickfix/location list asynchronously without interfering with another plugin
Vim has many plugins (vim-go, ale, etc.) that use the quickfix/location list
feature. Some of these plugins process the output of an external command and
update the quickfix list asynchronously as the output becomes available.
Updating a quickfix or location list asynchronously opens up the possibility
that two or more plugins may try to update the same quickfix list with
different output. Also when a plugin is updating a quickfix list in the
background, the user may issue a command that creates or updates a quickfix
list. The plugin may then incorrectly use this new list to add the entries.
@romainl
romainl / vanilla-linter.md
Last active May 6, 2024 01:48
Linting your code, the vanilla way

Linting your code, the vanilla way

You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.

Defining makeprg

autocmd FileType <filetype> setlocal makeprg=<external command>

This autocommand tells Vim to use <external command> when invoking :make % in a <filetype> buffer. You can add as many similar lines as needed for other languages.

@romainl
romainl / curentline.md
Last active March 19, 2023 07:27
Insert the current line into the command-line

Insert the current line into the command-line

This is an intuitive command-line mode mapping to insert the current line.

It is no longer needed since 8.0.1787 because the feature is now built-in. See :help c_ctrl-r_ctrl-l.


My Vim-related gists.

@romainl
romainl / colorscheme-override.md
Last active May 27, 2024 00:17
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.