1
2
Heavily opinionated comprehensive collection of configuration
3
files for various tools and applications you use on macOS.
4
5
It includes settings for wezterm, zsh, nvim, and several others
6
like tmux, htop, and btop.
7
8
It also features a Brewfile for managing macOS packages via
9
Homebrew.
10
11
12
14
15
alias gist="pbpaste | gh gist create | rg github | pbcopy"
16
alias lg="lazygit"
17
alias ld="lazydocker"
18
19
alias gf='nvim $(fzf)'
20
21
alias q="exit"
22
23
alias app='fd ".app" /System/Library/CoreServices /System/Applications /Applications /System/Applications/Utilities --max-depth 1 | fzf | xargs -I {} open "{}"'
24
25
alias ls='lsd --group-dirs first --classify'
26
alias la='lsd --group-dirs first --classify --almost-all'
27
alias ll='lsd --group-dirs first --classify --almost-all --long'
28
alias lt='lsd --tree'
29
30
31
32
33
34
35
36
37
38
alias gist="pbpaste | gh gist create | rg github | pbcopy"
alias lg="lazygit"
alias ld="lazydocker"
alias gf='nvim $(fzf)'
alias q="exit"
alias app='fd ".app" /System/Library/CoreServices /System/Applications /Applications /System/Applications/Utilities --max-depth 1 | fzf | xargs -I {} open "{}"'
alias ls='lsd --group-dirs first --classify'
alias la='lsd --group-dirs first --classify --almost-all'
alias ll='lsd --group-dirs first --classify --almost-all --long'
alias lt='lsd --tree'
# Determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* ./*;
fi;
}
function git_current_branch() {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo.
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
-- helper: run a search motion and briefly highlight the match
local function blink_search(key)
return function()
vim.cmd("normal! " .. key .. "zz")
vim.opt.hlsearch = true
vim.defer_fn(function()
vim.opt.hlsearch = false
end, 200)
end
end
-- buffer navigation
vim.keymap.set("n", "<up>", "<cmd>bn<cr>")
vim.keymap.set("n", "<down>", "<cmd>bp<cr>")
-- splits (with splitbelow/splitright cursor lands in new window automatically)
vim.keymap.set("n", "<leader>s", "<cmd>split<cr>")
vim.keymap.set("n", "<leader>v", "<cmd>vsplit<cr>")
-- write and exit current buffer
vim.keymap.set("n", "<C-q>", "ZZ")
-- if pressing 'a' on an empty line, use 'S' instead (respects indent)
vim.keymap.set("n", "a", "len(getline('.')) == 0 ? 'S' : 'a'", { expr = true })
-- highlight yanked text
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.hl.on_yank({ higroup = "Visual", timeout = 80 })
end,
})
-- restore cursor to last position when reopening a file
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function(ev)
local mark = vim.api.nvim_buf_get_mark(ev.buf, '"')
local lcount = vim.api.nvim_buf_line_count(ev.buf)
if mark[1] > 0 and mark[1] <= lcount
and not vim.tbl_contains({ "commit", "gitrebase" }, vim.bo[ev.buf].filetype)
then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})