Skip to content

Instantly share code, notes, and snippets.

View BobToninho's full-sized avatar
🐘

Roberto Tonino BobToninho

🐘
View GitHub Profile
@BobToninho
BobToninho / large_brew_installs.sh
Created April 5, 2025 16:35
Show the brew installations that take the most space
du -sh $(brew --cellar)/* | sort -hr

Tooling

A list of things to remember about my tools.

vim

Delete all buffers but current one
@BobToninho
BobToninho / move_lines_macos.lua
Created February 7, 2025 15:33
Move lines by pressing Option+J/K
-- Move lines easily {{{
-- From https://vim.fandom.com/wiki/Moving_lines_up_or_down. Strange charachters are due to MacOS
-- ∆ = A-j
-- ˚ = A-k
vim.keymap.set("n", "∆", "<cmd>m .+1<CR>==")
vim.keymap.set("n", "˚", "<cmd>m .-2<CR>==")
vim.keymap.set("i", "∆", "<ESC><cmd>m .+1<CR>==gi")
vim.keymap.set("i", "˚", "<ESC><cmd>m .-2<CR>==gi")
-- using <cmd>m does not work with this
vim.keymap.set("v", "∆", ":m '>+1<CR>gv=gv")
@BobToninho
BobToninho / .bashrc
Created February 4, 2025 14:52
Tab completion that immediately fills the first result, to then cycle through all the results
# For some reason the correspondant .inputrc code does not work
bind TAB:menu-complete
bind '"\e[Z":menu-complete-backward' # Shift-TAB
@BobToninho
BobToninho / git_blame_current_line.vim
Last active February 4, 2025 14:52
git_blame_current_line.vim
nnoremap <leader>b <Cmd>echo system("git blame " .. expand("%") .. " -L " .. line(".") .. "," .. line("."))<CR>
@BobToninho
BobToninho / init.vim
Created January 10, 2025 09:46
Make neovim behave like vim (taken from rwxrob's video)
set runtimepath^=~/.vim runtimepath+=~/.vim/after
"runtimepath+=/opt/homebrew/share/vim/vim91/pack/
let &packpath = &runtimepath
source ~/.vimrc
# From https://stackoverflow.com/a/17029936
# git branch -d keeps us on the safe side
git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
def gch [] {
let branch = git branch | fzf --cycle | tr -d '[:space:]'
git checkout $branch
}
def --env np [] {
cd (fd . ~/dev/ --maxdepth 1 --type d | fzf --cycle)
}
@BobToninho
BobToninho / shortcuts.txt
Last active January 10, 2025 09:47
Collection of useful shortcuts for any type of app
Re-open the last closed tab.
CTRL + SHIFT + t
COMMAND + SHIFT + t
App: Chrome, Edge, Brave, Firefox
Switch to another window of the same program on MacOS
COMMAND + `
App: /