Skip to content

Instantly share code, notes, and snippets.

@bfrg
bfrg / tabcomplete.vim
Last active August 1, 2020 10:15
Insert-mode completion using <Tab> as prefix instead of <C-X><C- >
" Shorthand for <c-x><c- > completion
"
" <tab>f triggers filename completion
" <tab>l triggers line completion
" <tab>] triggers tag completion
" ...
"
" Original idea by 'kvik' in #vim long time ago
for i in split(']defiklnopuvys', '\zs')
@bfrg
bfrg / gitblame.vim
Last active August 10, 2020 20:55
Vanilla git-blame
" Vanilla git-blame
"
" git-blame current line:
" :GB
"
" git-blame selected lines:
" :'<,'>GB
"
" git-blame entire buffer:
" :%GB
@bfrg
bfrg / onedark.vim
Last active March 11, 2021 00:23
onedark colorscheme for Vim
" ==============================================================================
" File: colors/onedark.vim
" Description: Colors based on onedark.vim by joshdick
" Maintainer: bfrg <https://github.com/bfrg>
" Last Change: Feb 13, 2021
" License: Same as Vim itself (see :h license)
" ==============================================================================
hi clear
@bfrg
bfrg / ls-chars.sh
Created June 5, 2022 13:02
Print the characters a font provides
#!/bin/bash
#
# Print all characters a font provides
#
# Example:
# $ ls-chars devicon
#
# Note:
# \U in printf is not POSIX standard, therefore we need bash
#
@bfrg
bfrg / autopair.vim
Last active August 8, 2022 08:28
Automatically close, skip and remove matching pairs in insert-mode
vim9script
# Auto-close parentheses
inoremap ( ()<c-g>U<left>
inoremap [ []<c-g>U<left>
inoremap { {}<c-g>U<left>
inoremap < <><c-g>U<left>
inoremap (<cr> (<cr>)<esc>O
inoremap {<cr> {<cr>}<esc>O
inoremap [<cr> [<cr>]<esc>O
@bfrg
bfrg / virttext.md
Last active November 27, 2022 00:45
Highlight quickfix (and/or location-list) errors as virtual text in the buffer

Highlight quickfix errors as virtual text

This script will display the errors in the current quickfix and/or location list as virtual text in the buffer.

Virtual text can be aligned after, right, below or above the line containing the error.

NOTE: For a full plugin, see vim-qf-diagnostics.

Commands