diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 10:40:11 -0700 |
| commit | ea127689e0ae2d39b49004be605e541ff80e2621 (patch) | |
| tree | abbe79e5e37792bd8ebea8f9ac788ff5b8aed704 /.config | |
| download | openbsd-dotfiles-ea127689e0ae2d39b49004be605e541ff80e2621.zip | |
Initial Commit
Diffstat (limited to '.config')
29 files changed, 882 insertions, 0 deletions
diff --git a/.config/lemonbar-xft/bar.sh b/.config/lemonbar-xft/bar.sh new file mode 100755 index 0000000..6aad4b8 --- /dev/null +++ b/.config/lemonbar-xft/bar.sh @@ -0,0 +1,120 @@ +#!/bin/sh +set -o errexit + +RED="%{F#cd0000}" +YELLOW="%{F#cdcd00}" +RESET="%{F-}" + +main() { + while true; do + update_bar + sleep 5 + done +} + +update_bar() { + printf "%%{l} %s | %s | %s | %s | %s %%{r} %s | %s | %s \n" \ + "$(battery)" \ + "$(temp)" \ + "$(cpu)" \ + "$(memory)" \ + "$(brightness)" \ + "$(volume)" \ + "$(wifi)" \ + "$(datetime)" +} + +battery() { + apm_output=$(apm -al) + percent=$(echo "$apm_output" | sed -n '1p') + batt_state=$(echo "$apm_output" | sed -n '2p') + minutes=$(apm -m) + + filled=$((percent / 10)) + bar="" + i=0 + while [ $i -lt 10 ]; do + if [ $i -lt $filled ]; then + if [ "$batt_state" = "1" ]; then + bar="${bar}+" + else + bar="${bar}#" + fi + else + bar="${bar}-" + fi + i=$((i + 1)) + done + + if [ "$percent" -lt 30 ] && [ "$batt_state" != "1" ]; then + bar="${RED}${bar}${RESET}" + elif [ "$percent" -lt 50 ] && [ "$batt_state" != "1" ]; then + bar="${YELLOW}${bar}${RESET}" + fi + + printf "%s%% %s (%s min)" "$percent" "$bar" "$minutes" +} + +temp() { + avg=$(sysctl hw.sensors | awk -F'=' '/temp/ { + gsub(/degC.*/, "", $2); + sum += $2; + count++ + } END { + printf "%.0f", sum/count + }') + + if [ "$avg" -ge 85 ]; then + printf "%s%d°C%s" "$RED" "$avg" "$RESET" + else + printf "%d°C" "$avg" + fi +} + +cpu() { + apm -Pv | awk '{gsub(/\(|\)/, ""); print $5, $6, $4}' +} + +memory() { + top -n | awk '/^Memory:/ { + split($3, r, "/"); + printf "Used:%s Free:%s", r[2], $6 + }' +} + +net() { + ifconfig egress 2>/dev/null | awk '/inet / {print $2}' +} + +brightness() { + bright=$(xbacklight -get | cut -d. -f1) + printf "Bri: %d%%" "$bright" +} + +volume() { + vol=$(sndioctl -n output.level) + percent=$(printf "%.0f" "$(echo "$vol" | awk '{print $1 * 100}')") + + if sndioctl output.mute | grep -q "=1"; then + printf "Vol: MUTE" + else + printf "Vol: %d%%" "$percent" + fi +} + +wifi() { + wifi_info=$(ifconfig iwx0 2>/dev/null | grep "ieee80211:") + if [ -n "$wifi_info" ]; then + ssid=$(echo "$wifi_info" | sed -n 's/.*join \(.*\) chan.*/\1/p' | tr -d '"') + signal=$(ifconfig iwx0 | awk '/ieee80211:/ {for(i=1;i<=NF;i++) if($i ~ /%/) print $i}' | head -1) + printf "%s %s %s" "$ssid" "$signal" "$(net)" + else + net + fi +} + +datetime() { + date '+%Y-%m-%d %H:%M' +} + +main diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..11ed567 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.lua @@ -0,0 +1 @@ +vim.opt_local.colorcolumn = '80' diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..ad59a73 --- /dev/null +++ b/.config/nvim/after/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.opt_local.commentstring = '-- %s' diff --git a/.config/nvim/after/ftplugin/makefile.lua b/.config/nvim/after/ftplugin/makefile.lua new file mode 100644 index 0000000..345d732 --- /dev/null +++ b/.config/nvim/after/ftplugin/makefile.lua @@ -0,0 +1,2 @@ +vim.opt_local.expandtab = false +vim.opt_local.tabstop = 4 diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..4f56524 --- /dev/null +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,19 @@ +local opt_local = vim.opt_local + +opt_local.textwidth = 80 +opt_local.formatoptions:append { 't' } +opt_local.formatoptions:remove { 'l' } + +opt_local.wrap = true +opt_local.linebreak = true +opt_local.breakindent = true + +opt_local.spell = true +opt_local.spelllang = 'en_us' + +opt_local.expandtab = true +opt_local.tabstop = 2 +opt_local.shiftwidth = 2 + +opt_local.list = true +opt_local.listchars = 'tab:»·,trail:·' diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..3fcff4e --- /dev/null +++ b/.config/nvim/after/ftplugin/python.lua @@ -0,0 +1,12 @@ +-- PEP 8 indentation settings +vim.opt_local.tabstop = 4 +vim.opt_local.softtabstop = 4 +vim.opt_local.shiftwidth = 4 +vim.opt_local.expandtab = true + +-- 88 character length lines for Black formatter +vim.opt_local.colorcolumn = '88' + +-- Google-style docstrings +vim.g.python_style = 'google' + diff --git a/.config/nvim/ftdetect/tmux.lua b/.config/nvim/ftdetect/tmux.lua new file mode 100644 index 0000000..d43c12a --- /dev/null +++ b/.config/nvim/ftdetect/tmux.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = '*.tmux', + callback = function() + vim.bo.filetype = 'tmux' + end, +}) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..4a5ce9f --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require 'eugenetriguba' diff --git a/.config/nvim/lsp/lua_ls.lua b/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..c4cacae --- /dev/null +++ b/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,11 @@ +---@type vim.lsp.Config +return { + settings = { + Lua = { + codeLens = { enable = true }, + hint = { enable = true, semicolon = 'Disable' }, + completion = { callSnippet = 'Replace' }, + }, + }, +} + diff --git a/.config/nvim/lua/eugenetriguba/autocmds.lua b/.config/nvim/lua/eugenetriguba/autocmds.lua new file mode 100644 index 0000000..145d00a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/autocmds.lua @@ -0,0 +1,8 @@ +-- Highlight when yanking (copying) text +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) diff --git a/.config/nvim/lua/eugenetriguba/global.lua b/.config/nvim/lua/eugenetriguba/global.lua new file mode 100644 index 0000000..006fe5e --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/global.lua @@ -0,0 +1,4 @@ +-- Set <space> as the leader key +-- See `:help mapleader` +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' diff --git a/.config/nvim/lua/eugenetriguba/init.lua b/.config/nvim/lua/eugenetriguba/init.lua new file mode 100644 index 0000000..1d7d3ca --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/init.lua @@ -0,0 +1,5 @@ +require 'eugenetriguba.global' +require 'eugenetriguba.options' +require 'eugenetriguba.autocmds' +require 'eugenetriguba.keymaps' +require 'eugenetriguba.plugins' diff --git a/.config/nvim/lua/eugenetriguba/keymaps.lua b/.config/nvim/lua/eugenetriguba/keymaps.lua new file mode 100644 index 0000000..0954462 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/keymaps.lua @@ -0,0 +1,36 @@ +local map = vim.keymap.set + +-- Create split panes using leader key +map('n', '<leader>sh', ':split<CR>') +map('n', '<leader>sv', ':vsplit<CR>') + +-- Clear highlights on search when pressing <Esc> in normal mode +map('n', '<Esc>', '<cmd>nohlsearch<CR>') + +-- Diagnostic keymaps +map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Cycle through buffers +map('n', '<Tab>', ':bnext<CR>') +map('n', '<S-Tab>', ':bprevious<CR>') + +-- Exit terminal mode in the builtin terminal with a +-- shortcut that is a bit easier to remember. +map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+<hjkl> to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) +map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) +map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) +map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) + +-- Delete the current buffer +vim.keymap.set('n', '<leader>bd', '<cmd>bdelete<cr>', { desc = 'Delete current buffer' }) +-- Force delete the current buffer (discard changes) +vim.keymap.set('n', '<leader>bD', '<cmd>bdelete!<cr>', { desc = 'Force delete current buffer' }) +-- Delete all buffers except the current one +vim.keymap.set('n', '<leader>ba', ':%bd|e#<cr>', { desc = 'Delete all other buffers' }) + diff --git a/.config/nvim/lua/eugenetriguba/options.lua b/.config/nvim/lua/eugenetriguba/options.lua new file mode 100644 index 0000000..6b70422 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/options.lua @@ -0,0 +1,96 @@ +local opt = vim.opt + +-- Make line numbers default +opt.number = true + +-- Use relative line numbers, to help with jumping. +opt.relativenumber = true + +-- In Insert mode, replace <Tab> with the appropriate +-- number of spaces. +opt.expandtab = true + +-- When starting a new line, use smart indentation to +-- figure out what indentation the new line should be +-- at. +opt.autoindent = true +opt.smartindent = true + +-- Number of spaces to use for each step of autoindentation. +opt.shiftwidth = 2 + +-- Number of spaces to use when using <Tab>. +opt.tabstop = 2 + +-- Case-insensitive searching UNLESS \C or one +-- or more capital letters in the search term +opt.ignorecase = true +opt.smartcase = true + +-- Keep signcolumn on by default +opt.signcolumn = 'yes' + +-- Show which line your cursor is on +opt.cursorline = true + +-- If performing an operation that would fail due to unsaved +-- changes in the buffer (like `:q`), instead raise a dialog +-- asking if you wish to save the current file(s) +-- +-- See `:help 'confirm'` +opt.confirm = true + +-- Save undo history +opt.undofile = true + +-- Minimal number of screen lines to keep above and below the cursor. +opt.scrolloff = 10 + +-- Enable mouse mode e.g. can be useful for resizing splits +opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- +-- Schedule the setting after `UiEnter` because it can increase +-- startup-time. Remove this option to keep the OS clipboard +-- independent from neovim. +-- +-- See `:help 'clipboard'` +vim.schedule(function() + opt.clipboard = 'unnamedplus' +end) + +-- Continue to visually indent wrapped lines +-- to preserve horizontal blocks of text +opt.breakindent = true + +-- Decrease update time +opt.updatetime = 250 + +-- Decrease mapped sequence wait time +opt.timeoutlen = 300 + +-- Configure how new splits should be opened +opt.splitright = true +opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters +-- in the editor. +-- +-- See `:help 'list'` and `:help 'listchars'` +opt.list = true +opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +opt.inccommand = 'split' + +-- Enable project-local configuration +vim.o.exrc = true + +-- Enable completions +vim.opt.complete:prepend 'o' -- include omnifunc (LSP) as a source +vim.opt.completeopt:append { 'menuone', 'noselect', 'popup', 'fuzzy' } +vim.o.autocomplete = true diff --git a/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua b/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua new file mode 100644 index 0000000..f93ae67 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/colorscheme.lua @@ -0,0 +1,16 @@ +vim.pack.add { + { + name = 'nord', + src = 'https://github.com/shaunsingh/nord.nvim', + }, +} + +vim.g.nord_contrast = true +vim.g.nord_borders = true +vim.g.nord_disable_background = true +vim.g.nord_uniform_diff_background = true +vim.g.nord_italic = false +vim.g.nord_bold = false + +require('nord').set() +vim.cmd.colorscheme 'nord' diff --git a/.config/nvim/lua/eugenetriguba/plugins/conform.lua b/.config/nvim/lua/eugenetriguba/plugins/conform.lua new file mode 100644 index 0000000..6d8571d --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/conform.lua @@ -0,0 +1,13 @@ +vim.pack.add { + { + name = 'conform.nvim', + src = 'https://github.com/stevearc/conform.nvim', + }, +} + +require('conform').setup { + formatters_by_ft = { + lua = { 'stylua' }, + sh = { 'shfmt' }, + }, +} diff --git a/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua b/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua new file mode 100644 index 0000000..6c02e9a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/fzf-lua.lua @@ -0,0 +1,56 @@ +vim.pack.add { + { + name = 'mini.icons', + src = 'https://github.com/nvim-mini/mini.icons', + }, + { + name = 'fzf-lua', + src = 'https://github.com/ibhagwan/fzf-lua', + }, +} + +require 'mini.icons'.setup {} + +require('fzf-lua').setup { + winopts = { + preview = { + default = 'bat', + }, + }, + keymap = { + fzf = { + ['ctrl-q'] = 'select-all+accept', + }, + }, + files = { + fd_opts = '--type f --hidden --exclude .git', + }, + grep = { + rg_opts = "--color=never --no-heading --with-filename --line-number --column --smart-case --hidden --glob '!.git/*'", + rg_grep = true, + }, +} + +local fzf = require 'fzf-lua' +vim.keymap.set('n', '<leader>fh', fzf.helptags, { desc = '[F]ind [H]elp' }) +vim.keymap.set('n', '<leader>fk', fzf.keymaps, { desc = '[F]ind [K]eymaps' }) +vim.keymap.set('n', '<leader>ff', fzf.files, { desc = '[F]ind [F]iles' }) +vim.keymap.set('n', '<leader>fc', fzf.commands, { desc = '[F]ind [C]ommands' }) +vim.keymap.set('n', '<leader>fs', fzf.builtin, { desc = '[F]ind [S]elect fzf-lua' }) +vim.keymap.set('n', '<leader>fw', fzf.grep_cword, { desc = '[F]ind current [W]ord' }) +vim.keymap.set('n', '<leader>fg', fzf.live_grep, { desc = '[F]ind by [G]rep' }) +vim.keymap.set('n', '<leader>fd', fzf.diagnostics_document, { desc = '[F]ind [D]iagnostics' }) +vim.keymap.set('n', '<leader>fr', fzf.resume, { desc = '[F]ind [R]esume' }) +vim.keymap.set('n', '<leader>f.', fzf.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) +vim.keymap.set('n', '<leader><leader>', fzf.buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '<leader>/', fzf.blines, { desc = '[/] Fuzzily search in current buffer' }) +vim.keymap.set('n', '<leader>f/', function() + fzf.live_grep { + filespec = vim.fn.expand '%:p', + prompt = 'Live Grep in Open Files> ', + } +end, { desc = '[F]ind [/] in Open Files' }) +vim.keymap.set('n', '<leader>fn', function() + fzf.files { cwd = vim.fn.stdpath 'config' } +end, { desc = '[F]ind [N]eovim files' }) + diff --git a/.config/nvim/lua/eugenetriguba/plugins/init.lua b/.config/nvim/lua/eugenetriguba/plugins/init.lua new file mode 100644 index 0000000..200cc98 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/init.lua @@ -0,0 +1,8 @@ +require 'eugenetriguba.plugins.colorscheme' +require 'eugenetriguba.plugins.tree-sitter' +require 'eugenetriguba.plugins.fzf-lua' +require 'eugenetriguba.plugins.mini' +require 'eugenetriguba.plugins.oil' +require 'eugenetriguba.plugins.conform' +require 'eugenetriguba.plugins.lsp' +require 'eugenetriguba.plugins.vim-tmux-navigator' diff --git a/.config/nvim/lua/eugenetriguba/plugins/lsp.lua b/.config/nvim/lua/eugenetriguba/plugins/lsp.lua new file mode 100644 index 0000000..f5ff7d5 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/lsp.lua @@ -0,0 +1,113 @@ +vim.pack.add { + { + name = 'lazydev.nvim', + src = 'https://github.com/folke/lazydev.nvim', + }, + { + name = 'nvim-lspconfig', + src = 'https://github.com/neovim/nvim-lspconfig', + }, + { + name = 'fidget.nvim', + src = 'https://github.com/j-hui/fidget.nvim', + }, +} + +require('fidget').setup {} +require('lazydev').setup { + library = { + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, +} + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + local fzf = require 'fzf-lua' + fzf.register_ui_select({}, true) + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', fzf.lsp_code_actions, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', fzf.lsp_references, '[G]oto [R]eferences') + map('gri', fzf.lsp_implementations, '[G]oto [I]mplementation') + map('grd', fzf.lsp_definitions, '[G]oto [D]efinition') + map('grD', fzf.lsp_declarations, '[G]oto [D]eclaration') + map('gO', fzf.lsp_document_symbols, 'Open Document Symbols') + map('gW', fzf.lsp_workspace_symbols, 'Open Workspace Symbols') + map('grt', fzf.lsp_typedefs, '[G]oto [T]ype Definition') + map('<C-space>', vim.lsp.completion.get, '[C]ompletion', 'i') + + local client = vim.lsp.get_client_by_id(event.data.client_id) + + if client and client:supports_method('textDocument/completion', event.buf) then + vim.lsp.completion.enable(true, client.id, event.buf, { + autotrigger = false, + convert = function(item) + return { abbr = item.label:gsub('%b()', '') } + end, + }) + end + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } + end, + }) + end + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('<leader>th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, +}) + +vim.api.nvim_create_autocmd('CursorHold', { + callback = function() + vim.diagnostic.open_float(nil, { + focus = false, + scope = 'cursor', + border = 'rounded', + source = 'if_many', + close_events = { 'CursorMoved', 'InsertEnter', 'BufLeave', 'WinLeave' }, + }) + end, +}) + +vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = ' ', + [vim.diagnostic.severity.WARN] = ' ', + [vim.diagnostic.severity.INFO] = ' ', + [vim.diagnostic.severity.HINT] = ' ', + }, + }, + virtual_text = false, +} + +vim.lsp.enable { 'lua_ls', 'clangd', 'bashls' } diff --git a/.config/nvim/lua/eugenetriguba/plugins/mini.lua b/.config/nvim/lua/eugenetriguba/plugins/mini.lua new file mode 100644 index 0000000..97290a7 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/mini.lua @@ -0,0 +1,73 @@ +vim.pack.add { + { + name = 'mini', + src = 'https://github.com/nvim-mini/mini.nvim', + version = 'main', + }, +} + +require('mini.statusline').setup() + +require('mini.indentscope').setup { + symbol = '│', + options = { try_as_border = true }, +} + +local miniclue = require 'mini.clue' +miniclue.setup { + triggers = { + -- Leader triggers + { mode = 'n', keys = '<Leader>' }, + { mode = 'x', keys = '<Leader>' }, + -- Built-in completion + { mode = 'i', keys = '<C-x>' }, + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'x', keys = 'g' }, + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'x', keys = "'" }, + { mode = 'x', keys = '`' }, + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'x', keys = '"' }, + { mode = 'i', keys = '<C-r>' }, + { mode = 'c', keys = '<C-r>' }, + -- Window commands + { mode = 'n', keys = '<C-w>' }, + -- `z` key + { mode = 'n', keys = 'z' }, + { mode = 'x', keys = 'z' }, + -- `s` surround keys + { mode = 'n', keys = 's' }, + }, + clues = { + -- Enhance this by adding descriptions for <Leader> mapping groups + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, + window = { + delay = 300, + }, +} + +-- Better Around/Inside textobjects +-- +-- Examples: +-- - va) - [V]isually select [A]round [)]paren +-- - yinq - [Y]ank [I]nside [N]ext [Q]uote +-- - ci' - [C]hange [I]nside [']quote +require('mini.ai').setup { n_lines = 500 } + +-- Add/delete/replace surroundings (brackets, quotes, etc.) +-- +-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren +-- - sd' - [S]urround [D]elete [']quotes +-- - sr)' - [S]urround [R]eplace [)] ['] +require('mini.surround').setup() + diff --git a/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua new file mode 100644 index 0000000..4cdd7f7 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua @@ -0,0 +1,16 @@ +vim.pack.add { + { + name = 'nvim-lint', + src = 'https://github.com/mfussenegger/nvim-lint', + }, +} + +local lint = require 'lint' +lint.linters_by_ft = {} +lint.linters_by_ft['c'] = { 'clangtidy' } +lint.linters_by_ft['ksh'] = { 'ksh' } +lint.linters_by_ft['ansible.yaml'] = { 'ansible_lint' } +lint.linters_by_ft['terraform'] = { 'tofu', 'tflint', 'terraform_validate' } +lint.linters_by_ft['python'] = { 'ruff' } +lint.linters_by_ft['sh'] = { 'shellcheck' } +table.insert(lint.linters.shellcheck.args, '-x') diff --git a/.config/nvim/lua/eugenetriguba/plugins/oil.lua b/.config/nvim/lua/eugenetriguba/plugins/oil.lua new file mode 100644 index 0000000..4791c43 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/oil.lua @@ -0,0 +1,26 @@ +-- Replace netrw with Oil to work with the file hierarchy +-- as a regular vim buffer. +vim.pack.add { + { + name = 'mini.icons', + src = 'https://github.com/nvim-mini/mini.icons', + }, + { + name = 'oil', + src = 'https://github.com/stevearc/oil.nvim', + }, +} + +require('mini.icons').setup {} +require('oil').setup { + keymaps = { + -- Clashes with tmux navigator + ['<C-l>'] = false, + ['<C-h>'] = false, + -- Remap refresh to a new key, since we just disabled it. + ['<C-r>'] = 'actions.refresh', + }, +} +vim.keymap.set('n', '\\', '<CMD>Oil --float<CR>', { desc = 'Open parent directory in floating window' }) +vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) + diff --git a/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua b/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua new file mode 100644 index 0000000..e01cfa4 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua @@ -0,0 +1,62 @@ +-- Treesitter adds understanding of the source code text +-- (e.g. fields, methods, classes). nvim has built-in support +-- for tree-sitter, however, nvim-treesitter makes it easier +-- to automatically install tree-sitter parser files for each +-- language. + +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(event) + local name, kind = event.data.spec.name, event.data.kind + if name == 'nvim-treesitter' and (kind == 'update' or kind == 'install') then + vim.schedule(function() + -- If nvim-treesitter was updated, run ':TSUpdate' to + -- ensure the installed parsers are also updated. + vim.cmd 'TSUpdate all' + end) + end + end, +}) + +vim.pack.add { + { + name = 'nvim-treesitter', + src = 'https://github.com/nvim-treesitter/nvim-treesitter', + version = 'main', + }, + { + name = 'nvim-treesitter-context', + src = 'https://github.com/nvim-treesitter/nvim-treesitter-context', + }, +} + +local langs = { + 'bash', + 'c', + 'commonlisp', + 'css', + 'hcl', + 'html', + 'javascript', + 'json', + 'lua', + 'make', + 'python', + 'sh', + 'sql', + 'tsx', + 'typescript', + 'yaml', +} + +require 'nvim-treesitter'.install { ensure_installed = langs } + +vim.api.nvim_create_autocmd('FileType', { + pattern = langs, + callback = function() + vim.treesitter.start() + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, +}) + +require('treesitter-context').setup { multiline_threshold = 10} + diff --git a/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua b/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..978f72a --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/vim-tmux-navigator.lua @@ -0,0 +1,13 @@ +-- Support navigating between tmux splits and vim splits +vim.pack.add { + { + name = 'vim-tmux-navigator', + src = 'https://github.com/christoomey/vim-tmux-navigator', + }, +} +vim.keymap.set('n', '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>') +vim.keymap.set('n', '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>') +vim.keymap.set('n', '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>') +vim.keymap.set('n', '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>') +vim.keymap.set('n', '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>') + diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..91e3f2d --- /dev/null +++ b/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,54 @@ +{ + "plugins": { + "conform.nvim": { + "rev": "016802de402556da54c36bd7359b441266b01cdd", + "src": "https://github.com/stevearc/conform.nvim" + }, + "fidget.nvim": { + "rev": "9e0201673e08e997e7cf52afca5565c70bd117f3", + "src": "https://github.com/j-hui/fidget.nvim" + }, + "fzf-lua": { + "rev": "c67fadd9a24230417267e4f9068227e093c0be2b", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "lazydev.nvim": { + "rev": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d", + "src": "https://github.com/folke/lazydev.nvim" + }, + "mini": { + "rev": "295af26358628c8ba8f007ff6a7e0aec2f642a31", + "src": "https://github.com/nvim-mini/mini.nvim", + "version": "'main'" + }, + "mini.icons": { + "rev": "f916635dc5ae2f479fbb9ab8184bb9444b62e86c", + "src": "https://github.com/nvim-mini/mini.icons" + }, + "nord": { + "rev": "80c1e5321505aeb22b7a9f23eb82f1e193c12470", + "src": "https://github.com/shaunsingh/nord.nvim" + }, + "nvim-lspconfig": { + "rev": "45a3a444b710511c39abca3b60bb6e23a21e3de5", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "ca581c3436fc2b236847f5b739ebc263739e5ca6", + "src": "https://github.com/nvim-treesitter/nvim-treesitter", + "version": "'main'" + }, + "nvim-treesitter-context": { + "rev": "8decd73460d26ef0a0befb745d022dd1fc2c38b8", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-context" + }, + "oil": { + "rev": "d3733d933833a0e59b813ecec99341527adf0c28", + "src": "https://github.com/stevearc/oil.nvim" + }, + "vim-tmux-navigator": { + "rev": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432", + "src": "https://github.com/christoomey/vim-tmux-navigator" + } + } +} diff --git a/.config/tmux/key-remappings.tmux b/.config/tmux/key-remappings.tmux new file mode 100644 index 0000000..103722f --- /dev/null +++ b/.config/tmux/key-remappings.tmux @@ -0,0 +1,19 @@ +# Remap prefix from 'C-b' to 'C-a' +# +# This works well if you remap the regular Caps Lock key to Ctrl. +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Remap pane splits to something more sane than the default. +# +# Split panes using | for horizontal splits and - for vertical splits +bind-key | split-window -h -c "#{pane_current_path}" +bind-key - split-window -v -c "#{pane_current_path}" +unbind '"' +unbind % +bind-key c new-window -c "#{pane_current_path}" + +# Easier configuration reloading and pane killing +bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded!" +bind-key x kill-pane diff --git a/.config/tmux/options.tmux b/.config/tmux/options.tmux new file mode 100644 index 0000000..7cb9075 --- /dev/null +++ b/.config/tmux/options.tmux @@ -0,0 +1,40 @@ +# Don't rename windows automatically. +# +# I often will use the `,` key to rename windows. +# However, by default, tmux will update the window +# title to the last executed command. +set-option -g allow-rename off + +# Enable mouse support (clickable windows, panes, resizable panes) +set-option -g mouse on + +# Enable system clipboard integration +set-option -g set-clipboard on + +# Allow focus events (for editors like Neovim) +set -g focus-events on + +# Start windows and panes at 1, not 0 +set-option -g base-index 1 +set-option -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +set-option -g status-position top + +# Don't do anything when a 'bell' rings +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +# Enable hyperlinks +set-option -as terminal-features ",*:hyperlinks" + +# Enable true color support +set -ga terminal-overrides ",*256col*:Tc" +set -ga terminal-overrides ",tmux-256color:Tc" + +set -g default-terminal "tmux-256color" +set -g default-shell $SHELL diff --git a/.config/tmux/plugins.tmux b/.config/tmux/plugins.tmux new file mode 100644 index 0000000..9072828 --- /dev/null +++ b/.config/tmux/plugins.tmux @@ -0,0 +1,45 @@ +set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins/" +set-option -g @plugin 'tmux-plugins/tpm' + +# 'Sensible' set of defaults +set-option -g @plugin 'tmux-plugins/tmux-sensible' + +# Tmux FZF is a plugin that integrates FZF with tmux +TMUX_FZF_ORDER="session|window|pane|command|keybinding" +TMUX_FZF_OPTIONS="-p -w 90% -h 70% -m" +set-option -g @plugin 'sainnhe/tmux-fzf' + +# Resurrect is a plugin that saves and restores tmux sessions +set-option -g @plugin 'tmux-plugins/tmux-resurrect' +set-option -g @resurrect-save 'S' +set-option -g @resurrect-restore 'R' + +# Continuum is a plugin that automatically saves tmux sessions +# at regular intervals +set-option -g @plugin 'tmux-plugins/tmux-continuum' +set-option -g @continuum-restore 'on' +set-option -g @continuum-save-interval '15' +set-option -g @resurrect-strategy-nvim 'session' + +# Vim Tmux Navigator allows you to navigate between Vim and tmux panes +set-option -g @plugin 'christoomey/vim-tmux-navigator' + +set-option -g @plugin 'tmux-plugins/tmux-yank' +set-option -g @plugin 'tmux-plugins/tmux-open' + +set-option -g @plugin "janoamaral/tokyo-night-tmux" +set-option -g @tokyo-night-tmux_theme night +set-option -g @tokyo-night-tmux_transparent 1 +set-option -g @tokyo-night-tmux_window_id_style digital +set-option -g @tokyo-night-tmux_pane_id_style hsquare +set-option -g @tokyo-night-tmux_zoom_id_style dsquare +set-option -g @tokyo-night-tmux_terminal_icon +set-option -g @tokyo-night-tmux_active_terminal_icon +set-option -g @tokyo-night-tmux_window_tidy_icons 1 +set-option -g @tokyo-night-tmux_show_git 0 +set-option -g @tokyo-night-tmux_show_wbg 0 +set-option -g @tokyo-night-tmux_show_datetime 0 + +set-option -g @plugin 'https://git.sr.ht/~eugenetriguba/tmux-toggle-term' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/.config/tmux/vi.tmux b/.config/tmux/vi.tmux new file mode 100644 index 0000000..85f2f37 --- /dev/null +++ b/.config/tmux/vi.tmux @@ -0,0 +1,6 @@ +set-window-option -g mode-keys vi + +# Use visual selection mode as vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel |