Compare commits
13 Commits
759958b126
...
11d311dc5d
Author | SHA1 | Date | |
---|---|---|---|
|
11d311dc5d | ||
|
d6bed612d8 | ||
|
f82c4c7472 | ||
|
e884dc09e1 | ||
|
8db644bb0a | ||
|
1fab6dcf8e | ||
|
05fb14de24 | ||
|
60b42e4a14 | ||
|
b00ab02e0a | ||
|
b5b32cf017 | ||
|
9213bee290 | ||
|
fbd5e4214b | ||
|
3bdad1352c |
27
README.md
27
README.md
@@ -1,16 +1,14 @@
|
||||
# repo containing configs and scripts to set up a box
|
||||
|
||||
### script run
|
||||
- [prerequisites below are fulfilled]
|
||||
- fulfill prerequisites below
|
||||
- git clone this repo
|
||||
- from the repo's root directory, run `./box_setup`
|
||||
- from the repo's root directory, run `./box_setup <OS name>`
|
||||
|
||||
### prerequisites
|
||||
- package manager is configured (i.e. source repos, mirrors, etc. configured)
|
||||
- zsh is installed (scripts are written for zsh)
|
||||
- sudo access is configured for current user (2025-01-27, not needed on macos)
|
||||
- export the env var `BOX_SETUP_OS` to indicate the operating system
|
||||
- options defined in `set_script_env_vars` file
|
||||
- sudo access is configured for current user (as of 2025-01-27, not needed on macos)
|
||||
- system-specific items below are fulfilled
|
||||
|
||||
##### prereqs, os specific, linux-placeholder
|
||||
@@ -31,23 +29,16 @@
|
||||
|
||||
### todo items
|
||||
- add logic to the main run script to handle cloning of this repo
|
||||
- add logic to the main run script to set `BOX_SETUP_OS` var, either input param or detect
|
||||
- config for nvim
|
||||
- config for window manager for linux (first, decide which wm to use)
|
||||
- config for terminal emulator (currently ghostty)
|
||||
- config for mpd, mpc, ncmpcpp
|
||||
- config for ghostty
|
||||
- config for mpv
|
||||
- also, on macos, get it to open within terminal or just don't install it
|
||||
- config for gimp, `src_files/.config/GIMP` (dir)
|
||||
- set things in gtkrc only? still need to nest that within a sub dir?
|
||||
- or maybe just configure in gimp's gui, copy the whole resulting dir into
|
||||
`src_files/.config/GIMP` (edit out and delete what i don't need) and call it a day
|
||||
- for whatever is causing it, editor/terminal/other, git rid of ligatures/name?
|
||||
- for example, `>=` is two chars (`>` then `=`), not one char/symbol
|
||||
- decide on window manager for linux, then do config
|
||||
- look into xquartz for macos (x/xorg emulation or something?)
|
||||
- build in flags/logic for skipping certain installs/builds (and maybe configs?) on a
|
||||
given system (i.e. don't install on a company box, on a server, etc.)
|
||||
- or configure in gimp, copy resulting dir to `src_files/.config/GIMP`, call it a day
|
||||
- maybe build in flags/logic for skipping certain installs/builds (and maybe configs?)
|
||||
on a given system (i.e. don't install on a company box, on a server, etc.)
|
||||
- decide on and implement approach for languages and versioning
|
||||
- docker? or alternatives like podman? any license concerns?
|
||||
- asdf, or language-specific version managers?
|
||||
- docker? or alternatives like podman? any license concerns?
|
||||
- hybrid of the above?
|
||||
|
43
box_setup
43
box_setup
@@ -1,9 +1,42 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source set_script_env_vars
|
||||
[[ -z $1 ]] &&
|
||||
echo "OS must be passed as an arg (options: arch, artix, debian, macos)" &&
|
||||
echo "example: ./box_setup arch" &&
|
||||
exit 1
|
||||
|
||||
# set env vars for installs
|
||||
local install_cmd=''
|
||||
local update_pkg_manager_and_defs_cmd=''
|
||||
local update_pkgs_cmd=''
|
||||
case $1 in
|
||||
(arch | artix)
|
||||
install_cmd="sudo pacman -S"
|
||||
update_pkg_manager_and_defs_cmd='' # don't; update system instead?
|
||||
update_pkgs_cmd='sudo pacman -Syu'
|
||||
;;
|
||||
(debian)
|
||||
install_cmd="sudo apt install"
|
||||
update_pkg_manager_and_defs_cmd='sudo apt update'
|
||||
update_pkgs_cmd='sudo apt upgrade'
|
||||
;;
|
||||
(macos)
|
||||
install_cmd="brew install"
|
||||
update_pkg_manager_and_defs_cmd='brew update'
|
||||
update_pkgs_cmd='brew upgrade'
|
||||
;;
|
||||
esac
|
||||
|
||||
export BOX_SETUP_INSTALL_COMMAND="$install_cmd"
|
||||
export BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD="$update_pkg_manager_and_defs_cmd"
|
||||
export BOX_SETUP_UPDATE_PKGS_CMD="$update_pkgs_cmd"
|
||||
|
||||
# make dirs and copy configs/dotfiles
|
||||
source ./src_files/.config/zsh/.zshenv
|
||||
./make_config_dirs
|
||||
./make_dirs
|
||||
./copy_configs
|
||||
source $ZDOTDIR/.zshenv ; source $ZDOTDIR/.zshrc
|
||||
./make_org_structure_dirs
|
||||
./install_programs # TODO: moved this to after config copy, but does this work?
|
||||
|
||||
# install programs
|
||||
source $ZDOTDIR/.zshenv
|
||||
source $ZDOTDIR/.zshrc
|
||||
./install_programs
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/bin/zsh
|
||||
|
||||
execute() { log "execute $@" && "$@" }
|
||||
log() { echo "$@" }
|
||||
execute() { echo "executing: $@" && "$@" }
|
||||
|
||||
copy_file() {
|
||||
local from=$1
|
||||
@@ -30,14 +29,13 @@ copy_dir() {
|
||||
link_dir() {
|
||||
local src_dir=$1
|
||||
local link_dir=$2
|
||||
log "deleting existing link/dir: $link_dir"
|
||||
[[ -h "$link_dir" ]] && rm $link_dir
|
||||
[[ -d "$link_dir" ]] && rm -rf $link_dir
|
||||
log "sym-linking $link_dir -> $src_dir"
|
||||
echo "sym-linking $link_dir -> $src_dir"
|
||||
ln -s $src_dir $link_dir
|
||||
}
|
||||
|
||||
log "---------------- dotfiles ----------------"
|
||||
echo "---- copying dotfiles -------------------------"
|
||||
|
||||
copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR
|
||||
|
||||
@@ -48,5 +46,4 @@ copy_dir src_files/.local/scripts $DIR_SCRIPTS
|
||||
# on macos, gimp defaults to app-support, so sym-link to actual config
|
||||
[[ "$BOX_SETUP_OS" = "macos" ]] &&
|
||||
link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP"
|
||||
link_dir "$XDG_CONFIG_HOME/vim" "$HOME/.vim" # TODO: use vim wrapper or similar instead
|
||||
|
||||
|
@@ -1,31 +1,22 @@
|
||||
#!/bin/zsh
|
||||
|
||||
local single_script_filter=""
|
||||
local dry="0"
|
||||
|
||||
execute() {
|
||||
log "execute $@"
|
||||
[[ $dry != "1" ]] && "$@"
|
||||
}
|
||||
|
||||
log() {
|
||||
[[ $dry != "1" ]] && echo "$@" || echo "[DRY RUN]: $@"
|
||||
}
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
[[ $1 == "--dry" ]] && dry="1" || single_script_filter="$1"
|
||||
single_script_filter="$1" # if using param, export BOX_SETUP_OS first if needed
|
||||
shift
|
||||
done
|
||||
|
||||
log "install_programs // single_script_filter: $single_script_filter"
|
||||
echo "---- installing programs ----------------------"
|
||||
|
||||
local scripts=$(find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f | sort)
|
||||
for script in ${=scripts}; do
|
||||
if [[ -x $script ]]; then
|
||||
if echo "$script" | grep -qv "$single_script_filter"; then
|
||||
log "filter is $single_script_filter // ignoring: $script"
|
||||
continue
|
||||
continue # $single_script_filter set, ignore others
|
||||
fi
|
||||
execute ./$script
|
||||
echo "executing: $script"
|
||||
./$script
|
||||
fi
|
||||
done
|
||||
|
||||
|
@@ -8,7 +8,9 @@ ${=BOX_SETUP_INSTALL_COMMAND} \
|
||||
fzf \
|
||||
make \
|
||||
cmake \
|
||||
gettext
|
||||
gettext \
|
||||
grep \
|
||||
ripgrep
|
||||
|
||||
[[ "$BOX_SETUP_OS" = "macos" ]] &&
|
||||
${=BOX_SETUP_INSTALL_COMMAND} coreutils
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/bin/zsh
|
||||
|
||||
local option_prefix=''
|
||||
[[ "$BOX_SETUP_OS" = "macos" ]] && option_prefix='--cask'
|
||||
local firefox_package_name='firefox'
|
||||
[[ "$BOX_SETUP_OS" = "debian" ]] && firefox_package_name='firefox-esr'
|
||||
${=BOX_SETUP_INSTALL_COMMAND} "$option_prefix" "$firefox_package_name"
|
||||
# TODO: replace firefox with brave or another browser
|
||||
# local option_prefix=''
|
||||
# [[ "$BOX_SETUP_OS" = "macos" ]] && option_prefix='--cask'
|
||||
# local firefox_package_name='firefox'
|
||||
# [[ "$BOX_SETUP_OS" = "debian" ]] && firefox_package_name='firefox-esr'
|
||||
# ${=BOX_SETUP_INSTALL_COMMAND} "$option_prefix" "$firefox_package_name"
|
||||
|
@@ -1,5 +1,9 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# possible mpd clients to consider: ncmpc, inori
|
||||
# local music
|
||||
${=BOX_SETUP_INSTALL_COMMAND} mpd mpc ncmpcpp
|
||||
# TODO: ${=BOX_SETUP_INSTALL_COMMAND} <spotify stuff here>
|
||||
# possible mpd clients to consider: ncmpc, inori
|
||||
|
||||
# spotify
|
||||
# TODO: decide if i want to use the package-manager install below, or build from source
|
||||
# ${=BOX_SETUP_INSTALL_COMMAND} ncspot
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# TODO: pick filemanager; consider: lf, ranger, others?
|
||||
# TODO: do i even want a filemanager? if yes, pick one; consider: lf, ranger, others?
|
||||
# ${=BOX_SETUP_INSTALL_COMMAND} zxcv-placeholder
|
||||
|
@@ -7,4 +7,5 @@
|
||||
|
||||
#${=BOX_SETUP_INSTALL_COMMAND} "$lua_package" liblua5.1-0-dev
|
||||
|
||||
# TODO: do i want to install luarocks? lazy.nvim plugin manager currently expects it
|
||||
#luarocks install luacheck
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source ./src_files/.config/zsh/.zshenv # source these vars for use below
|
||||
|
||||
[[ ! -d "$DIR_LOCAL" ]] && mkdir "$DIR_LOCAL"
|
||||
[[ ! -d "$DIR_BIN" ]] && mkdir "$DIR_BIN"
|
||||
[[ ! -d "$DIR_BUILD" ]] && mkdir "$DIR_BUILD"
|
||||
[[ ! -d "$DIR_SCRIPTS" ]] && mkdir "$DIR_SCRIPTS"
|
||||
[[ ! -d "$DIR_TMP" ]] && mkdir "$DIR_TMP"
|
||||
|
||||
[[ ! -d "$XDG_CONFIG_HOME" ]] && mkdir "$XDG_CONFIG_HOME"
|
||||
[[ ! -d "$XDG_CACHE_HOME" ]] && mkdir "$XDG_CACHE_HOME"
|
||||
[[ ! -d "$XDG_DATA_HOME" ]] && mkdir "$XDG_DATA_HOME"
|
||||
[[ ! -d "$XDG_STATE_HOME" ]] && mkdir "$XDG_STATE_HOME"
|
23
make_dirs
Executable file
23
make_dirs
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source ./src_files/.config/zsh/.zshenv # ensure env vars set for use below
|
||||
|
||||
# some standard/common dirs, some overlap/use in XDG dirs
|
||||
[[ ! -d "$DIR_LOCAL" ]] && mkdir "$DIR_LOCAL"
|
||||
[[ ! -d "$DIR_BIN" ]] && mkdir "$DIR_BIN"
|
||||
[[ ! -d "$DIR_BUILD" ]] && mkdir "$DIR_BUILD"
|
||||
[[ ! -d "$DIR_SCRIPTS" ]] && mkdir "$DIR_SCRIPTS"
|
||||
[[ ! -d "$DIR_TMP" ]] && mkdir "$DIR_TMP"
|
||||
|
||||
# dirs related to XDG Base Directory specification
|
||||
[[ ! -d "$XDG_CONFIG_HOME" ]] && mkdir "$XDG_CONFIG_HOME"
|
||||
[[ ! -d "$XDG_CACHE_HOME" ]] && mkdir "$XDG_CACHE_HOME"
|
||||
[[ ! -d "$XDG_DATA_HOME" ]] && mkdir "$XDG_DATA_HOME"
|
||||
[[ ! -d "$XDG_STATE_HOME" ]] && mkdir "$XDG_STATE_HOME"
|
||||
|
||||
# dirs for how i'm organizing my system
|
||||
[[ ! -d "$DIR_HOME_BOX" ]] && mkdir $DIR_HOME_BOX
|
||||
[[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV
|
||||
[[ ! -d "$DIR_DEV/git" ]] && mkdir $DIR_DEV/git
|
||||
[[ ! -d "$DIR_DEV/git/me" ]] && mkdir $DIR_DEV/git/me
|
||||
[[ ! -d "$DIR_DEV/git/other" ]] && mkdir $DIR_DEV/git/other
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/zsh
|
||||
|
||||
[[ ! -d "$DIR_HOME_BOX" ]] && mkdir $DIR_HOME_BOX
|
||||
|
||||
[[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV
|
||||
[[ ! -d "$DIR_DEV/git" ]] && mkdir $DIR_DEV/git
|
||||
[[ ! -d "$DIR_DEV/git/me" ]] && mkdir $DIR_DEV/git/me
|
||||
[[ ! -d "$DIR_DEV/git/other" ]] && mkdir $DIR_DEV/git/other
|
@@ -1,28 +0,0 @@
|
||||
[[ -z $BOX_SETUP_OS ]] &&
|
||||
echo "BOX_SETUP_OS must be set; options: arch, artix, debian, macos" &&
|
||||
exit 1
|
||||
|
||||
local install_cmd=''
|
||||
local update_pkg_manager_and_defs_cmd=''
|
||||
local update_pkgs_cmd=''
|
||||
case $BOX_SETUP_OS in
|
||||
(arch | artix)
|
||||
install_cmd="sudo pacman -S"
|
||||
update_pkg_manager_and_defs_cmd='' # don't; update system instead?
|
||||
update_pkgs_cmd='sudo pacman -Syu'
|
||||
;;
|
||||
(debian)
|
||||
install_cmd="sudo apt install"
|
||||
update_pkg_manager_and_defs_cmd='sudo apt update'
|
||||
update_pkgs_cmd='sudo apt upgrade'
|
||||
;;
|
||||
(macos)
|
||||
install_cmd="brew install"
|
||||
update_pkg_manager_and_defs_cmd='brew update'
|
||||
update_pkgs_cmd='brew upgrade'
|
||||
;;
|
||||
esac
|
||||
|
||||
export BOX_SETUP_INSTALL_COMMAND="$install_cmd"
|
||||
export BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD="$update_pkg_manager_and_defs_cmd"
|
||||
export BOX_SETUP_UPDATE_PKGS_CMD="$update_pkgs_cmd"
|
0
src_files/.config/asdf/.placeholder
Normal file
0
src_files/.config/asdf/.placeholder
Normal file
@@ -1,3 +1,5 @@
|
||||
[init]
|
||||
defaultBranch = master
|
||||
[user]
|
||||
name = david
|
||||
email = david@silverwolf.studio
|
||||
|
57
src_files/.config/ncspot/config.toml
Normal file
57
src_files/.config/ncspot/config.toml
Normal file
@@ -0,0 +1,57 @@
|
||||
# [theme] # from eltoncezar, similar to official spotify colors
|
||||
# background = "#191414"
|
||||
# primary = "#FFFFFF"
|
||||
# secondary = "light black"
|
||||
# title = "#1DB954"
|
||||
# playing = "#1DB954"
|
||||
# playing_selected = "#1ED760"
|
||||
# playing_bg = "#191414"
|
||||
# highlight = "#FFFFFF"
|
||||
# highlight_bg = "#484848"
|
||||
# error = "#FFFFFF"
|
||||
# error_bg = "red"
|
||||
# statusbar = "#191414"
|
||||
# statusbar_progress = "#1DB954"
|
||||
# statusbar_bg = "#1DB954"
|
||||
# cmdline = "#FFFFFF"
|
||||
# cmdline_bg = "#191414"
|
||||
# search_match = "light red"
|
||||
|
||||
[theme] # from wojciech-zurek, tokyonight
|
||||
background = "#1a1b26"
|
||||
primary = "#9aa5ce"
|
||||
secondary = "#414868"
|
||||
title = "#9ece6a"
|
||||
playing = "#7aa2f7"
|
||||
playing_selected = "#bb9af7"
|
||||
playing_bg = "#24283b"
|
||||
highlight = "#c0caf5"
|
||||
highlight_bg = "#24283b"
|
||||
error = "#414868"
|
||||
error_bg = "#f7768e"
|
||||
statusbar = "#ff9e64"
|
||||
statusbar_progress = "#7aa2f7"
|
||||
statusbar_bg = "#1a1b26"
|
||||
cmdline = "#c0caf5"
|
||||
cmdline_bg = "#24283b"
|
||||
search_match = "#f7768e"
|
||||
|
||||
# [theme] # from clooles, uses defaults/primary, supports transparency, for dynamic themes
|
||||
# background = "default"
|
||||
# primary = "foreground"
|
||||
# secondary = "light black"
|
||||
# title = "primary"
|
||||
# playing = "primary"
|
||||
# playing_selected = "primary"
|
||||
# playing_bg = "primary"
|
||||
# highlight = "#FFFFFF"
|
||||
# highlight_bg = "#484848"
|
||||
# error = "#FF0000"
|
||||
# error_bg = "red"
|
||||
# statusbar = "primary"
|
||||
# statusbar_progress = "primary"
|
||||
# statusbar_bg = "primary"
|
||||
# cmdline = "default"
|
||||
# cmdline_bg = "primary"
|
||||
# search_match = "light red"
|
||||
|
@@ -1 +1 @@
|
||||
print("print from init.lua file")
|
||||
require("david_standard")
|
||||
|
@@ -0,0 +1,25 @@
|
||||
function SetColorSchemeWrapper(scheme)
|
||||
scheme = scheme or "tokyonight-night"
|
||||
vim.cmd.colorscheme(scheme)
|
||||
|
||||
-- Allow for transparency -- TODO: do i actually want transparency?
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
SetColorSchemeWrapper()
|
||||
|
||||
-- TODO: get this working as desired for different file types
|
||||
-- local dsGroup = vim.api.nvim_create_augroup("DavidStandardGroup", { clear = false })
|
||||
-- vim.api.nvim_create_autocmd('BufEnter', {
|
||||
-- group = dsGroup,
|
||||
-- callback = function()
|
||||
-- if vim.bo.filetype == "zig" then
|
||||
-- pcall(SetColorSchemeWrapper, "tokyonight-night")
|
||||
-- else
|
||||
-- pcall(SetColorSchemeWrapper, "rose-pine-main")
|
||||
-- pcall(SetColorSchemeWrapper, "slate")
|
||||
-- pcall(SetColorSchemeWrapper, "sorbet")
|
||||
-- end
|
||||
-- end
|
||||
-- })
|
||||
|
33
src_files/.config/nvim/lua/david_standard/init.lua
Normal file
33
src_files/.config/nvim/lua/david_standard/init.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
local dsGroup = vim.api.nvim_create_augroup("DavidStandardGroup", { clear = true })
|
||||
local dsgAutocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
require("david_standard.settings")
|
||||
require("david_standard.key_mappings")
|
||||
require("david_standard.plugin_config")
|
||||
require("david_standard.plugin_key_mappings")
|
||||
require("david_standard.colorscheme_settings")
|
||||
require("david_standard.lsp_enables")
|
||||
|
||||
dsgAutocmd({"BufWritePre"}, {
|
||||
group = dsGroup,
|
||||
pattern = "*",
|
||||
command = [[%s/\s\+$//e]],
|
||||
})
|
||||
|
||||
-- TODO: put this into separate file(s) for lsp stuff? if so, pass in or make new autocmd
|
||||
dsgAutocmd('LspAttach', {
|
||||
group = dsGroup,
|
||||
callback = function(e)
|
||||
local opts = { buffer = e.buf }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
vim.keymap.set("n", "<leader>vdv", function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set("n", "<leader>vdn", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "<leader>vdp", function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrl", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
end
|
||||
})
|
52
src_files/.config/nvim/lua/david_standard/key_mappings.lua
Normal file
52
src_files/.config/nvim/lua/david_standard/key_mappings.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
-- explore the directory of the current file (using netrw)
|
||||
vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
|
||||
|
||||
-- move selected lines up or down
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv")
|
||||
|
||||
-- vertically center cursor with half-page jumps iterating search results
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- maintain cursor position after paragraph formatting
|
||||
vim.keymap.set("n", "=ap", "ma=ap'a")
|
||||
|
||||
-- shortcuts for deleting into the void register
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", "\"_d")
|
||||
vim.keymap.set("x", "<leader>P", [["_dP]]) -- replace selected text, keep main register
|
||||
|
||||
-- shortcuts for using + register (system clipboard)
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
vim.keymap.set("n", "<leader>p", [["+p]])
|
||||
|
||||
-- search-and-replace shortcuts
|
||||
vim.keymap.set("n", "<leader>rw", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>ra", [[:%s//g<Left><Left>]])
|
||||
|
||||
-- toggle expandtab and show message
|
||||
vim.keymap.set("n", "<leader>tab", function()
|
||||
if vim.opt.expandtab:get() then
|
||||
vim.opt.expandtab = false
|
||||
print("using actual tabs")
|
||||
else
|
||||
vim.opt.expandtab = true
|
||||
print("using spaces in place of tabs")
|
||||
end
|
||||
end)
|
||||
|
||||
-- quicker switching between panes/splits
|
||||
vim.keymap.set("n", "<C-h>", [[<C-w>h]])
|
||||
vim.keymap.set("n", "<C-j>", [[<C-w>j]])
|
||||
vim.keymap.set("n", "<C-k>", [[<C-w>k]])
|
||||
vim.keymap.set("n", "<C-l>", [[<C-w>l]])
|
||||
|
||||
-- TODO: learn about quickfix (:help quickfix), then maybe use these
|
||||
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
-- vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
-- vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
6
src_files/.config/nvim/lua/david_standard/lsp/ruby.lua
Normal file
6
src_files/.config/nvim/lua/david_standard/lsp/ruby.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
cmd = { "ruby-lsp" },
|
||||
filetypes = { "ruby", "eruby" },
|
||||
root_markers = { "Gemfile", ".git" },
|
||||
init_options = { formatter = "auto" },
|
||||
}
|
10
src_files/.config/nvim/lua/david_standard/lsp_enables.lua
Normal file
10
src_files/.config/nvim/lua/david_standard/lsp_enables.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
-- c
|
||||
|
||||
-- c++
|
||||
|
||||
-- ruby
|
||||
vim.lsp.enable('ruby_lsp')
|
||||
-- vim.lsp.enable('typeprof') -- ruby builtin/official (but still labled experimental)
|
||||
-- vim.lsp.enable('standardrb')
|
||||
-- vim.lsp.enable('solargraph')
|
||||
-- vim.lsp.enable('herb_ls') -- targets html + ruby (erb files)
|
29
src_files/.config/nvim/lua/david_standard/plugin_config.lua
Normal file
29
src_files/.config/nvim/lua/david_standard/plugin_config.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
-- TODO: maybe switch this over from git-clone approach to neovim's builtin vim.pack.add
|
||||
local path_lazy_nvim = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(path_lazy_nvim) then
|
||||
local git_output = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
path_lazy_nvim,
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo(
|
||||
{ { "Failed to clone lazy.nvim:\n" }, { git_output }, },
|
||||
true,
|
||||
{}
|
||||
)
|
||||
vim.fn.getchar()
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(path_lazy_nvim)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "david_standard.plugins_lazy" },
|
||||
},
|
||||
checker = { enabled = false },
|
||||
change_detection = { notify = false },
|
||||
})
|
@@ -0,0 +1,54 @@
|
||||
-- telescope
|
||||
local builtin = require('telescope.builtin')
|
||||
local custom_tscope_grep = function()
|
||||
builtin.grep_string({ search = vim.fn.input("grep > ")})
|
||||
end
|
||||
vim.keymap.set('n', '<leader>ft', builtin.live_grep, {
|
||||
desc = 'Telescope find text (live_grep)'
|
||||
})
|
||||
vim.keymap.set('n', '<leader>fT', custom_tscope_grep, {
|
||||
desc = 'Telescope find text (grep_string)'
|
||||
})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.git_files, {
|
||||
desc = 'Telescope find git-tracked files'
|
||||
})
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
-- harpoon
|
||||
local harpoon = require("harpoon")
|
||||
vim.keymap.set("n", "<leader>hl", function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>ha", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<leader>hA", function() harpoon:list():prepend() end)
|
||||
vim.keymap.set("n", "<leader>hn", function() harpoon:list():next() end)
|
||||
vim.keymap.set("n", "<leader>hp", function() harpoon:list():prev() end)
|
||||
vim.keymap.set("n", "<leader>hz", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<leader>hx", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<leader>hc", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<leader>hv", function() harpoon:list():select(4) end)
|
||||
vim.keymap.set("n", "<leader>hZ", function() harpoon:list():replace_at(1) end)
|
||||
vim.keymap.set("n", "<leader>hX", function() harpoon:list():replace_at(2) end)
|
||||
vim.keymap.set("n", "<leader>hC", function() harpoon:list():replace_at(3) end)
|
||||
vim.keymap.set("n", "<leader>hV", function() harpoon:list():replace_at(4) end)
|
||||
|
||||
-- undotree
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
|
||||
-- treesitter and treesitter-context
|
||||
vim.keymap.set("n", "<leader>tc", function() vim.cmd.TSContext({ "toggle" }) end)
|
||||
|
||||
-- fugitive (git integration)
|
||||
vim.keymap.set("n", "<leader>gG", vim.cmd.Git)
|
||||
vim.keymap.set("n", "<leader>gg", ":Git ") -- shortcut, arbitrary git commands
|
||||
vim.keymap.set("n", "<leader>ga", function() vim.cmd.Git({ "add %"}) end)
|
||||
vim.keymap.set("n", "<leader>gs", function() vim.cmd.Git({ "-p status" }) end)
|
||||
vim.keymap.set("n", "<leader>gc", function() vim.cmd.Git({ "commit -a" }) end)
|
||||
|
||||
-- conform (formatter)
|
||||
vim.keymap.set("n", "<leader>fmt", function()
|
||||
require("conform").format({ bufnr = 0 })
|
||||
end)
|
||||
|
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
-- TODO: decide which of these i won't be using, then remove from this file
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
name = "gruvbox",
|
||||
-- priority = 1000,
|
||||
opts = {
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "", -- "hard", "soft", or ""
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
style = "night", -- "night", "storm", "moon", "day"
|
||||
styles = {
|
||||
functions = {} -- disable italic for functions
|
||||
},
|
||||
on_colors = function(colors)
|
||||
colors.hint = colors.orange
|
||||
colors.error = "#ff0000"
|
||||
colors.fg_gutter = "#9098B8"
|
||||
end
|
||||
},
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
opts = {},
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
-- c = { "fill-in" },
|
||||
-- cpp = { "fill-in" },
|
||||
go = { "gofmt" },
|
||||
lua = { "stylua" },
|
||||
ruby = { "standardrb" },
|
||||
python = { "black" },
|
||||
javascript = { "prettier" },
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "tpope/vim-fugitive" },
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2", -- https://github.com/ThePrimeagen/harpoon/tree/harpoon2
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup()
|
||||
end,
|
||||
},
|
||||
}
|
114
src_files/.config/nvim/lua/david_standard/plugins_lazy/lsp.lua
Normal file
114
src_files/.config/nvim/lua/david_standard/plugins_lazy/lsp.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"stevearc/conform.nvim",
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
-- snippets, using luasnip for now
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
|
||||
config = function()
|
||||
require("conform").setup({ formatters_by_ft = {} })
|
||||
local cmp = require('cmp')
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities()
|
||||
)
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
-- "gopls",
|
||||
"ruby_lsp",
|
||||
-- "tailwindcss",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name) -- default
|
||||
require("lspconfig")[server_name].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
|
||||
["lua_ls"] = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
format = {
|
||||
enable = true,
|
||||
defaultConfig = { -- NOTE: string values only
|
||||
indent_style = "space",
|
||||
indent_size = "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
cmp.setup({
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- vim.snippet.expand(args.body) -- TODO: native option, maybe try
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
})
|
||||
|
||||
-- `/` cmdline setup.
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
local glob_patterns_find_files = {
|
||||
"-g", "!**/.git/**",
|
||||
"-g", "!**/build/**",
|
||||
"-g", "!**/node_modules/**",
|
||||
}
|
||||
local glob_patterns_live_grep = {
|
||||
unpack(glob_patterns_find_files), -- same for now
|
||||
}
|
||||
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.8',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = {
|
||||
"rg", "--no-ignore", "--hidden", "--files",
|
||||
unpack(glob_patterns_find_files),
|
||||
},
|
||||
},
|
||||
live_grep = {
|
||||
additional_args = {
|
||||
"--no-ignore", "--hidden",
|
||||
unpack(glob_patterns_live_grep),
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = 'master',
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"vimdoc", "bash", "lua", "c", "cpp", "go", "python", "ruby",
|
||||
"html", "css", "javascript", "jsdoc", "sql", "json", "yaml",
|
||||
"markdown", "markdown_inline",
|
||||
-- "odin", "zig", "ocaml", "java", "typescript",
|
||||
},
|
||||
sync_install = false, -- install `ensure_installed` parsers synchronously
|
||||
auto_install = true, -- install missing on BufEnter, requires tree-sitter CLI
|
||||
ignore_install = {},
|
||||
-- indent = { enable = true }, -- TODO: do i want this?
|
||||
highlight = {
|
||||
enable = true, -- `false` will disable the whole extension
|
||||
disable = function(lang, buf)
|
||||
for i, v in ipairs({ "html", }) do
|
||||
if lang == v then
|
||||
print("treesitter disabled for this language")
|
||||
return true
|
||||
end
|
||||
end
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > (100 * 1024) then -- 100 KB
|
||||
vim.notify(
|
||||
"larger file, treesitter disabled for performance",
|
||||
vim.log.levels.WARN,
|
||||
{title = "Treesitter"}
|
||||
)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
-- true, false, or list of langs; may cause slowness or duplicate highlights
|
||||
additional_vim_regex_highlighting = { "markdown" },
|
||||
},
|
||||
})
|
||||
|
||||
-- TODO: decide if needed/wanted
|
||||
-- local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
-- treesitter_parser_config.templ = {
|
||||
-- install_info = {
|
||||
-- url = "https://github.com/vrischmann/tree-sitter-templ.git",
|
||||
-- files = {"src/parser.c", "src/scanner.c"},
|
||||
-- branch = "master",
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- vim.treesitter.language.register("templ", "templ")
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
after = "nvim-treesitter",
|
||||
opts = {
|
||||
enable = false, -- can enable/disable via manual command
|
||||
multiwindow = false,
|
||||
max_lines = 0, -- lines the window should span; x <= 0 means no limit
|
||||
min_window_height = 10, -- min window height to enable; x <= 0 means no limit
|
||||
line_numbers = true,
|
||||
multiline_threshold = 40, -- max lines to show for a single context
|
||||
trim_scope = 'outer', -- 'inner', 'outer'; discard lines if max_lines exceeded
|
||||
mode = 'cursor', -- 'cursor', 'topline'; line used to calculate context
|
||||
separator = "-", -- 1 char, like '-'; only shown when >= 2 lines above
|
||||
zindex = 20, -- z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean); return false to disable attaching
|
||||
},
|
||||
},
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
"mbbill/undotree",
|
||||
}
|
44
src_files/.config/nvim/lua/david_standard/settings.lua
Normal file
44
src_files/.config/nvim/lua/david_standard/settings.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- -- TODO: do i want these?
|
||||
-- vim.opt.isfname:append("@-@")
|
||||
-- vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.scrolloff = 2
|
||||
vim.opt.colorcolumn = "90"
|
||||
vim.opt.signcolumn = "yes" -- "auto", "yes", "no", "number"
|
||||
vim.opt.laststatus = 2
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.cursorlineopt = "both"
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.wrap = true
|
||||
|
||||
vim.opt.errorbells = false
|
||||
vim.opt.visualbell = false
|
||||
|
||||
vim.opt.updatetime = 1000
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.backup = false
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undodir = os.getenv("XDG_DATA_HOME") .. "/nvim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- netrw settings
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_preview = 1
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_winsize = 25
|
||||
|
@@ -2,34 +2,43 @@
|
||||
set -s escape-time 0
|
||||
|
||||
unbind C-b
|
||||
set-option -g prefix C-a
|
||||
bind-key C-a send-prefix
|
||||
set-option -g prefix C-Space
|
||||
bind-key C-Space send-prefix
|
||||
set -g status-style 'bg=#111111 fg=#22cc00'
|
||||
set -g base-index 1
|
||||
set -g base-index 0
|
||||
|
||||
# unbind keys
|
||||
unbind-key f; unbind-key C-f; unbind-key C-s
|
||||
unbind-key c; unbind-key n; unbind-key p
|
||||
unbind-key C-o; unbind-key C-n; unbind-key C-p; unbind-key C-l; unbind-key C-h
|
||||
|
||||
# vim-like movement stuff
|
||||
set-window-option -g mode-keys vi
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
bind -r ^ last-window
|
||||
bind -r k select-pane -U
|
||||
bind -r j select-pane -D
|
||||
bind -r h select-pane -L
|
||||
bind -r l select-pane -R
|
||||
|
||||
# reload tmux.conf
|
||||
bind r source-file "~/.config/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
|
||||
bind-key r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
|
||||
|
||||
# kill the current session
|
||||
# TODO: would it clash with other bindings to change these to C-q and C-w ?
|
||||
# TODO: combine these into one command; must cover case when only 1 session remains
|
||||
bind-key Q rename-session zzzz-temp-kill\; switch-client -p\; kill-session -t zzzz-temp-kill
|
||||
bind-key W kill-session # TODO: if i can combine this into the above when only 1 session remains, do so
|
||||
bind-key W kill-session
|
||||
|
||||
# custom find and switching for sessions using tmux-sessionizer
|
||||
unbind-key f
|
||||
bind-key f run-shell "tmux neww $DIR_SCRIPTS/tmux-sessionizer"
|
||||
bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-sessionizer existing"
|
||||
bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-sessionizer hub"
|
||||
bind-key C-l switch-client -l
|
||||
bind-key C-n next-window
|
||||
bind-key C-p previous-window
|
||||
# creating new windows
|
||||
bind-key n new-window
|
||||
|
||||
# find and switching for sessions, include using tmux-session-init
|
||||
bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init"
|
||||
bind-key C-s run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init find-existing"
|
||||
bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init hub"
|
||||
bind-key -r C-l switch-client -l
|
||||
bind-key -r C-o last-window
|
||||
bind-key -r C-n next-window
|
||||
bind-key -r C-p previous-window
|
||||
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#/bin/zsh
|
||||
|
||||
git clone https://github.com/ghifarit53/tokyonight-vim.git
|
||||
git clone https://github.com/leafgarland/typescript-vim.git
|
@@ -1,111 +0,0 @@
|
||||
" base settings
|
||||
set nocompatible
|
||||
let mapleader=","
|
||||
|
||||
" xdg base directory settings/clean-up
|
||||
set runtimepath^=$XDG_CONFIG_HOME/vim
|
||||
" add other dirs to path as needed
|
||||
" XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME, XDG_STATE_HOME, XDG_DATA_DIRS
|
||||
" set/override other filenames/paths/dirs as needed
|
||||
|
||||
" plugin config
|
||||
let g:netrw_banner=0 " hide banner
|
||||
let g:netrw_browse_split=0 " <cr> opens in same window
|
||||
let g:netrw_liststyle=3 " listing style: tree
|
||||
let g:netrw_list_hide= '.*\.swp$'
|
||||
|
||||
let g:typescript_indent_disable = 1
|
||||
|
||||
" functions
|
||||
func! ToggleTabMode()
|
||||
set expandtab!
|
||||
if &expandtab
|
||||
echo "using space characters in place of tabs"
|
||||
else
|
||||
echo "using tab characters"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" copy & paste: registers, clipboard
|
||||
set clipboard+=unnamed " TODO or maybe unamedplus?
|
||||
|
||||
" colors, themes, appearance
|
||||
"set background=light
|
||||
let g:tokyonight_style = 'night' " available: night, storm
|
||||
colorscheme tokyonight
|
||||
|
||||
" measurements, numbers, visual/audible cues
|
||||
set cursorline
|
||||
set colorcolumn=89,90
|
||||
set noerrorbells novisualbell
|
||||
set hlsearch
|
||||
set laststatus=2
|
||||
set number relativenumber
|
||||
set ruler
|
||||
set showcmd
|
||||
set noshowmode
|
||||
set title
|
||||
|
||||
" syntax highlighting
|
||||
syntax enable " TODO 'enable' or 'on'?
|
||||
|
||||
" settings for buffers
|
||||
set hidden
|
||||
|
||||
" settings for panes/splits, tabs
|
||||
set splitright splitbelow
|
||||
map <C-h> <C-w>h
|
||||
map <C-j> <C-w>j
|
||||
map <C-k> <C-w>k
|
||||
map <C-l> <C-w>l
|
||||
|
||||
" finding and opening files
|
||||
set wildmenu
|
||||
set path+=**
|
||||
|
||||
" text input and editing
|
||||
set tabstop=4
|
||||
set expandtab
|
||||
autocmd BufEnter * set formatoptions-=ro
|
||||
" TODO get recursion working for the tags command below
|
||||
command! MakeTags !ctags -f tags -R .
|
||||
|
||||
" shortcuts or aliases
|
||||
" shortcuts for find in pane/tab
|
||||
nnoremap <leader>f. :find<Space>*
|
||||
nmap <leader>fr :vnew<CR><leader>f.
|
||||
nmap <leader>fb :new<CR><leader>f.
|
||||
nmap <leader>ft :tabnew<CR><leader>f.
|
||||
|
||||
" shortcuts for grep in pane/tab
|
||||
nnoremap <leader>g, :r<Space>!grep<Space>--exclude-dir=node_modules<Space>-rIi<Space><Space>.<Left><Left>
|
||||
nmap <leader>g. :enew<CR><leader>g,
|
||||
nmap <leader>gr :vnew<CR><leader>g,
|
||||
nmap <leader>gb :new<CR><leader>g,
|
||||
nmap <leader>gt :tabnew<CR><leader>g,
|
||||
|
||||
" shortcuts for tree (netrw) in pane/tab
|
||||
nnoremap <leader>t. :edit<Space>.<CR>
|
||||
nnoremap <leader>tr :vsplit<Space>.<CR>
|
||||
nnoremap <leader>tb :split<Space>.<CR>
|
||||
nnoremap <leader>tt :tabnew<Space>.<CR>
|
||||
|
||||
" toggle tab/space mode
|
||||
nnoremap <leader>tab :call ToggleTabMode()<CR>
|
||||
|
||||
" toggles related to line numbers and cursor
|
||||
nnoremap <leader>nu :set number!<CR>
|
||||
nnoremap <leader>rnu :set relativenumber!<CR>
|
||||
nnoremap <leader>cc :set cuc!<CR>
|
||||
|
||||
" searching: replace-all in file
|
||||
nnoremap <leader>ra :%s//g<Left><Left>
|
||||
" TODO maybe add global (working dir, recursive) replace-all feature?
|
||||
|
||||
" format file content
|
||||
nnoremap <leader>fmtjson :%!jq<Space>.<Space>-<CR>
|
||||
|
||||
" automatic actions
|
||||
autocmd BufWritePre * %s/\s\+$//e " delete trailing whitespace
|
||||
" autocmd BufWritePre * %s/\n\+\%$//e " delete end-of-file newlines
|
||||
|
@@ -1,9 +1,11 @@
|
||||
# default programs
|
||||
export EDITOR='vim' # TODO: update to nvim once configured
|
||||
export BROWSER='brave'
|
||||
export EDITOR='nvim'
|
||||
|
||||
# env vars used for my organization structure
|
||||
export DIR_HOME_BOX="$HOME/dbox"
|
||||
export DIR_DEV="$HOME/dev"
|
||||
export DIR_GIT_PROJECTS="$DIR_DEV/git"
|
||||
|
||||
# util dirs; do not change without checking impact on xdg base dirs
|
||||
export DIR_LOCAL="$HOME/.local"
|
||||
@@ -26,6 +28,12 @@ export ZDOTDIR="$XDG_CONFIG_HOME/zsh" # may already be set, set anyway
|
||||
# git
|
||||
export GIT_EDITOR="$EDITOR"
|
||||
|
||||
# language support/tools
|
||||
export ASDF_DIR="$XDG_CONFIG_HOME/asdf"
|
||||
export ASDF_CONFIG_FILE="$ASDF_DIR/.asdfrc"
|
||||
export ASDF_DATA_DIR="$DIR_LOCAL/.asdf"
|
||||
export ASDF_TOOL_VERSIONS_FILENAME=".asdf_tool_versions"
|
||||
|
||||
# clean-up of home dir
|
||||
export __CF_USER_TEXT_ENCODING="0x0:0x0"
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
set -o vi
|
||||
|
||||
# path updates
|
||||
export PATH=$DIR_BIN:$DIR_SCRIPTS:$PATH
|
||||
export PATH=$DIR_BIN:$DIR_SCRIPTS:$PATH:$XDG_DATA_HOME
|
||||
export PATH=$PATH:/opt/homebrew/opt/ccache/libexec:/opt/homebrew/bin
|
||||
|
||||
# shortcuts for common commands
|
||||
@@ -10,28 +10,30 @@ alias 3e='echo;echo;echo'
|
||||
alias 12e='3e;3e;3e;3e'
|
||||
alias cl='clear; '
|
||||
alias cls='clear;ls'
|
||||
alias tms='tmux-sessionizer'
|
||||
|
||||
# shortcuts for executables
|
||||
alias nv='nvim'
|
||||
alias n='nvim'
|
||||
alias tms='tmux-session-init'
|
||||
|
||||
# executable name overrides
|
||||
alias ls='ls -F'
|
||||
alias youtube-dl='youtube-dl --write-info-json'
|
||||
|
||||
# git stuff
|
||||
alias gfo='git fetch origin'
|
||||
alias gpo='git pull origin'
|
||||
alias gfpo='git fetch origin; git pull origin'
|
||||
alias yt-dlp='yt-dlp --write-info-json'
|
||||
|
||||
# misc commands
|
||||
alias pdt='ping -c 4 drinkingtea.net'
|
||||
alias cal='khal calendar'
|
||||
alias pdt='ping -c 2 drinkingtea.net'
|
||||
alias ppw='ping -c 2 pinewoods.xyz'
|
||||
alias weather='curl wttr.in'
|
||||
alias shrug='echo "¯\\_(ツ)_/¯"'
|
||||
alias journal="cd $DIR_HOME_BOX; $EDITOR .current-journal"
|
||||
alias ncspotkeys="$EDITOR $DIR_GIT_PROJECTS/other/ncspot/doc/users.md"
|
||||
|
||||
# source extensions and system-specific files
|
||||
[[ -e "$HOME/.profile" ]] && source "$HOME/.profile" # TODO: do i want to source .profile?
|
||||
[[ -a "$ZDOTDIR/zsh-general-dev" ]] && source "$ZDOTDIR/zsh-general-dev"
|
||||
[[ -a "$ZDOTDIR/zsh-life-system" ]] && source "$ZDOTDIR/zsh-life-system"
|
||||
[[ -a "$ZDOTDIR/zsh-job-rs" ]] && source "$ZDOTDIR/zsh-job-rs"
|
||||
|
||||
# TODO: refactor the below; simplify or at least move elsewhere
|
||||
alias lintjs='npx prettier --write'
|
||||
export DEVKITARM=/opt/devkitpro/devkitARM
|
||||
. /opt/homebrew/opt/asdf/libexec/asdf.sh # TODO: ensure not duplicated asdf logic
|
||||
. $(brew --prefix asdf)/libexec/asdf.sh
|
||||
|
21
src_files/.config/zsh/zsh-general-dev
Normal file
21
src_files/.config/zsh/zsh-general-dev
Normal file
@@ -0,0 +1,21 @@
|
||||
# set env vars, path updates, etc
|
||||
[[ -a $HOME/.local-box-vars ]] && source $HOME/.local-box-vars
|
||||
|
||||
# login shortcuts
|
||||
alias assume="source assume"
|
||||
alias login-aws='aws sso login --profile'
|
||||
alias login-aws-id-list="grep sso_account_id $HOME/.aws/config"
|
||||
|
||||
# git stuff
|
||||
alias gfo='git fetch origin'
|
||||
alias git-push-to-temp='git branch -D temp; git checkout -b temp; git push origin temp -uf; git checkout -'
|
||||
alias gpdev='git-push-to-temp'
|
||||
alias gpo='git pull origin'
|
||||
|
||||
# code/test/linter run and build commands
|
||||
alias bel='bundle exec standardrb'
|
||||
alias bet='bundle exec rspec'
|
||||
alias lintjs='npx prettier --write'
|
||||
alias prl='poetry run black'
|
||||
alias prt='poetry run pytest'
|
||||
|
@@ -1,27 +0,0 @@
|
||||
# TODO: refactor this file; separate general dev from rs specific
|
||||
# set env vars, path updates, etc
|
||||
[[ -a $HOME/.rs-vars ]] \
|
||||
&& source $HOME/.rs-vars \
|
||||
&& export PATH=$PATH:$HOME/.rd/bin \
|
||||
&& . /usr/local/opt/asdf/libexec/asdf.sh
|
||||
|
||||
# login shortcuts
|
||||
alias assume="source assume"
|
||||
alias login-bunk='aws sso login --profile'
|
||||
alias login-bunk-id-list="grep sso_account_id $HOME/.aws/config"
|
||||
alias login-pulumi-bunk='pulumi login '$PULUMI_LOGIN_TARGET'$(aws sts get-caller-identity --query Account --output text)'
|
||||
|
||||
# git stuff
|
||||
alias git-push-to-develop='git branch -D develop; git checkout -b develop; git push origin develop -uf; git checkout -'
|
||||
alias gpdev='git-push-to-develop'
|
||||
|
||||
# misc shortcuts
|
||||
alias journal="cd $DIR_HOME_BOX; $EDITOR .current-journal"
|
||||
alias kra="cd $DIR_HOME_BOX/process/kra; open .current_kra"
|
||||
alias gll="cd $DIR_DEV/git/lampo/gitlab"
|
||||
alias bet='bundle exec rspec'
|
||||
alias bel='bundle exec standardrb'
|
||||
alias belr='bundle exec rubocop'
|
||||
alias prt='poetry run pytest'
|
||||
alias prl='poetry run black'
|
||||
|
@@ -2,7 +2,7 @@ local omitted_dirs=(
|
||||
$HOME
|
||||
$DIR_HOME_BOX
|
||||
$DIR_DEV
|
||||
$DIR_DEV/git
|
||||
$DIR_GIT_PROJECTS
|
||||
)
|
||||
[[ ! ${omitted_dirs[(re)$(pwd)]} ]] &&
|
||||
tmux new-window -d -n cmd &&
|
||||
|
@@ -7,7 +7,6 @@ switch_to() {
|
||||
hydrate() {
|
||||
local tmux_hydrate_path="$DIR_SCRIPTS/.tmux-session-hydrate-default"
|
||||
[[ -f $2/.tmux-session-hydrate ]] && tmux_hydrate_path="$2/.tmux-session-hydrate"
|
||||
# TODO: add special case: [[ "$1" = "hub" ]] && tmux_hydrate_path="$DIR_SCRIPTS/.tmux-session-hydrate-hub"
|
||||
[[ -f $tmux_hydrate_path ]] && tmux send-keys -t $1 "source $tmux_hydrate_path" c-M
|
||||
}
|
||||
|
||||
@@ -16,7 +15,7 @@ local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions | sed "s/
|
||||
local search_dirs=(
|
||||
$DIR_HOME_BOX
|
||||
$DIR_DEV
|
||||
$DIR_DEV/git/*
|
||||
$DIR_GIT_PROJECTS/*
|
||||
)
|
||||
local target_name=''
|
||||
local target_path=''
|
||||
@@ -24,7 +23,7 @@ local target_path=''
|
||||
[[ $# -eq 1 ]] && target_path=$1 ||
|
||||
target_path=$(find $search_dirs -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||
|
||||
if [[ $target_path = "existing" ]]; then target_name=$(echo $existing_sessions | fzf);
|
||||
if [[ $target_path = "find-existing" ]]; then target_name=$(echo $existing_sessions | fzf);
|
||||
elif [[ $target_path = "hub" ]]; then target_name="hub" && target_path="$HOME";
|
||||
elif [[ -n $target_path ]]; then target_name=$(basename "$target_path" | tr . _);
|
||||
fi
|
Reference in New Issue
Block a user