diff options
| author | Nick Moore <nicholasvmoore@gmail.com> | 2026-11-07 07:54:14 -0600 |
|---|---|---|
| committer | Nick Moore <nicholasvmoore@gmail.com> | 2026-11-07 07:54:14 -0600 |
| commit | 29d66a4100637e2f0221e0954eaf2ad8f2847ff0 (patch) | |
| tree | b3a370f0a44978cc44fc3469482b78a521fcafff | |
| parent | f0bcbef5a603c16ee5639aac7dc79e7714b2d27f (diff) | |
Sync shared tools from rigel (laptop wins on divergence)
- alacritty: doom-one theming, Terminess Nerd Font 14
- tmux: native rewritten conf, C-a prefix, no TPM/powerline deps
- nvim: init.lua migrated to vim.pack (0.11+), nvim-pack-lock.json,
markdownlint.yaml added; keep lazy-lock.json (laptop parity)
| -rw-r--r-- | AGENTS.md | 8 | ||||
| -rw-r--r-- | alacritty/.config/alacritty/alacritty.toml | 77 | ||||
| -rw-r--r-- | nvim/.config/nvim/init.lua | 1566 | ||||
| -rw-r--r-- | nvim/.config/nvim/markdownlint.yaml | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/nvim-pack-lock.json | 156 | ||||
| -rw-r--r-- | tmux/.config/tmux/tmux.conf | 123 |
6 files changed, 1062 insertions, 872 deletions
@@ -58,9 +58,11 @@ machine's hardware or role; otherwise it's shared. hostnames/URLs, high-entropy strings. `git diff --cached --check` catches whitespace, not secrets — an actual grep review of the diff is required. If in doubt, leave it out and ask. -- Never commit: `*.bak` / `config.bak.*` backups, editor state, lock or - lock-state files, `fish_variables` (per-machine session state, - regenerates on login), anything under `old_config/` or `__pycache__/`. +- Never commit: `*.bak` / `config.bak.*` backups, editor state, session + state that regenerates per machine (`fish_variables`), `old_config/`, + `__pycache__/`. Plugin lock files (e.g. nvim's `lazy-lock.json`, + `nvim-pack-lock.json`) ARE tracked deliberately — they pin plugin + versions for reproducibility. - `git status` must be clean or intentionally scoped before commit. If stray files appear, fix the scope (`.gitignore` or exclude) — never sweep them in, never blanket `git add -A` without reading what's staged. diff --git a/alacritty/.config/alacritty/alacritty.toml b/alacritty/.config/alacritty/alacritty.toml index d70a628..4f0adf7 100644 --- a/alacritty/.config/alacritty/alacritty.toml +++ b/alacritty/.config/alacritty/alacritty.toml @@ -1,48 +1,57 @@ +# Alacritty — doom-one · Terminess Nerd Font Nerd Font + +[window] +padding = { x = 6, y = 6 } +dynamic_padding = true +opacity = 0.9 + [font] -size = 10 +size = 14 [font.normal] -family = "Hack" -style = "Bold" +family = "Terminess Nerd Font" +style = "Regular" -[window] -opacity = 0.85 -startup_mode = "Fullscreen" - -[window.padding] -x = 5 -y = 5 +[font.bold] +family = "Terminess Nerd Font" +style = "Bold" -[selection] -save_to_clipboard = true +[font.italic] +family = "Terminess Nerd Font" +style = "Italic" -# Colors (Doom One) +[font.bold_italic] +family = "Terminess Nerd Font" +style = "Bold Italic" -# Default colors [colors.primary] -foreground = '#bbc2cf' -background ='#282c34' +background = "#282c34" +foreground = "#bbc2cf" [colors.cursor] -cursor = '#51afef' -text = '#282c34' +text = "#282c34" +cursor = "#51afef" + +[colors.selection] +text = "#bbc2cf" +background = "#3f444a" [colors.normal] -black = '#282c34' -red = '#ff6c6b' -green = '#98be65' -yellow = '#ecbe7b' -blue = '#51afef' -magenta = '#a9a1e1' -cyan = '#46d9ff' -white = '#bbc2cf' +black = "#3f444a" +red = "#ff6c6b" +green = "#98be65" +yellow = "#ecbe7b" +blue = "#51afef" +magenta = "#c678dd" +cyan = "#46d9ff" +white = "#bbc2cf" [colors.bright] -black = '#3f444a' -red = '#ff6c6b' -green = '#98be65' -yellow = '#da8548' -blue = '#51afef' -magenta = '#a9a1e1' -cyan = '#46d9ff' -white = '#efefef' +black = "#5b6268" +red = "#ff6c6b" +green = "#98be65" +yellow = "#ecbe7b" +blue = "#51afef" +magenta = "#c678dd" +cyan = "#46d9ff" +white = "#dfdfdf" diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 0f92497..e2caad5 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,16 +1,89 @@ --- Set <space> as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +-- Plugins with vim.pack (Neovim 0.11+ built-in package manager) +-- Dependencies must be loaded before the plugins that need them +-- +-- IMPORTANT: Manage plugins with: +-- :lua vim.pack.update() -- installs missing and updates existing plugins +-- :lua vim.pack.del({ ... }) -- remove plugins +vim.pack.add { + -- Core dependencies + { src = 'https://github.com/nvim-lua/plenary.nvim' }, + { src = 'https://github.com/MunifTanjim/nui.nvim' }, + { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, + + -- Theme + { src = 'https://github.com/NTBBloodbath/doom-one.nvim' }, + + -- Status line (using lualine from old config) + { src = 'https://github.com/nvim-lualine/lualine.nvim' }, + + -- File tree + { src = 'https://github.com/nvim-neo-tree/neo-tree.nvim' }, + + -- Git + { src = 'https://github.com/lewis6991/gitsigns.nvim' }, + + -- Fuzzy finder + { src = 'https://github.com/nvim-telescope/telescope.nvim' }, + { src = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + { src = 'https://github.com/nvim-telescope/telescope-ui-select.nvim' }, + + -- LSP and Mason + { src = 'https://github.com/neovim/nvim-lspconfig' }, + { src = 'https://github.com/williamboman/mason.nvim' }, + { src = 'https://github.com/williamboman/mason-lspconfig.nvim' }, + { src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' }, + { src = 'https://github.com/j-hui/fidget.nvim' }, + + -- Lua LSP configuration + { src = 'https://github.com/folke/lazydev.nvim' }, + + -- Completion + { src = 'https://github.com/saghen/blink.cmp' }, + { src = 'https://github.com/L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, + + -- Formatting + { src = 'https://github.com/stevearc/conform.nvim' }, + + -- Linting + { src = 'https://github.com/mfussenegger/nvim-lint' }, + + -- Treesitter + { src = 'https://github.com/nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, + + -- AI Completion + { src = 'https://github.com/supermaven-inc/supermaven-nvim' }, + + -- Note taking + { src = 'https://github.com/nvim-neorg/neorg' }, + { src = 'https://github.com/nvim-neorg/lua-utils.nvim' }, + { src = 'https://github.com/nvim-neotest/nvim-nio' }, + { src = 'https://github.com/pysan3/pathlib.nvim' }, + + -- Navigation + { src = 'https://github.com/folke/flash.nvim' }, + { src = 'https://github.com/ThePrimeagen/harpoon', branch = 'harpoon2' }, + + -- Terminal + { src = 'https://github.com/akinsho/toggleterm.nvim' }, + + -- Utilities + { src = 'https://github.com/echasnovski/mini.nvim' }, + { src = 'https://github.com/folke/todo-comments.nvim' }, + { src = 'https://github.com/lukas-reineke/headlines.nvim' }, + { src = 'https://github.com/folke/which-key.nvim' }, + { src = 'https://github.com/tpope/vim-sleuth' }, + + -- Games / Fun + { src = 'https://github.com/ThePrimeagen/vim-be-good' }, +} + +-- ============================================================================ +-- OPTIONS +-- ============================================================================ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' - --- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true --- [[ Setting options ]] --- See `:help vim.opt` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' @@ -36,45 +109,76 @@ vim.opt.scrolloff = 30 vim.opt.confirm = true vim.opt.colorcolumn = '120' --- transparent background +-- ============================================================================ +-- THEME (Doom One) +-- ============================================================================ +-- Add color to cursor +vim.g.doom_one_cursor_coloring = true +-- Set :terminal colors +vim.g.doom_one_terminal_colors = true +-- Enable italic comments +vim.g.doom_one_italic_comments = false +-- Enable TS support +vim.g.doom_one_enable_treesitter = true +-- Color whole diagnostic text or only underline +vim.g.doom_one_diagnostics_text_color = false +-- Enable transparent background +vim.g.doom_one_transparent_background = true + +-- Pumblend transparency +vim.g.doom_one_pumblend_enable = false +vim.g.doom_one_pumblend_transparency = 20 + +-- Plugins integration +vim.g.doom_one_plugin_neorg = true +vim.g.doom_one_plugin_barbar = false +vim.g.doom_one_plugin_telescope = false +vim.g.doom_one_plugin_neogit = true +vim.g.doom_one_plugin_nvim_tree = true +vim.g.doom_one_plugin_dashboard = true +vim.g.doom_one_plugin_startify = true +vim.g.doom_one_plugin_whichkey = true +vim.g.doom_one_plugin_indent_blankline = true +vim.g.doom_one_plugin_vim_illuminate = true +vim.g.doom_one_plugin_lspsaga = false + +-- Load the colorscheme +vim.cmd.colorscheme 'doom-one' + +-- Transparent background vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'none' }) vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'none' }) --- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` +-- ============================================================================ +-- KEYMAPS (General) +-- ============================================================================ --- Clear highlights on search when pressing <Esc> in normal mode --- See `:help hlsearch` +-- Clear highlights on search vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') --- Diagnostic keymaps +-- Diagnostic keymap vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use <C-\><C-n> to exit terminal mode +-- Exit terminal mode vim.keymap.set('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 +-- Window navigation vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` +-- Scroll and center +vim.keymap.set('n', '<C-d>', '<C-d>zz') +vim.keymap.set('n', '<C-u>', '<C-u>zz') --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` +-- ============================================================================ +-- AUTOCOMMANDS +-- ============================================================================ + +-- Highlight when yanking text vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), @@ -83,844 +187,712 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) --- [[ Install `lazy.nvim` plugin manager ]] --- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } - if vim.v.shell_error ~= 0 then - error('Error cloning lazy.nvim:\n' .. out) - end -end ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) - --- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- To update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. -require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - -- 'ThePrimeagen/vim-be-good', - -- { 'akinsho/toggleterm.nvim', version = '*', config = true }, - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. - -- +-- ============================================================================ +-- PLUGIN: Lualine (Status line) +-- ============================================================================ +pcall(function() + require('lualine').setup { + options = { + icons_enabled = true, + theme = 'moonfly', + }, + } +end) - -- Alternatively, use `config = function() ... end` for full control over the configuration. - -- If you prefer to call `setup` explicitly, use: - -- { - -- 'lewis6991/gitsigns.nvim', - -- config = function() - -- require('gitsigns').setup({ - -- -- Your gitsigns configuration here - -- }) - -- end, - -- } - -- - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, +-- ============================================================================ +-- PLUGIN: Neo-tree (File tree) +-- ============================================================================ +pcall(function() + require('neo-tree').setup { + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + }, }, }, - }, + } + vim.keymap.set('n', '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal', silent = true }) +end) - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `opts` key (recommended), the configuration runs - -- after the plugin has been loaded as `require(MODULE).setup(opts)`. +-- ============================================================================ +-- PLUGIN: Gitsigns +-- ============================================================================ +pcall(function() + require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + } +end) - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - -- delay between pressing a key and opening which-key (milliseconds) - -- this setting is independent of vim.opt.timeoutlen - delay = 0, - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default which-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = '<Up> ', - Down = '<Down> ', - Left = '<Left> ', - Right = '<Right> ', - C = '<C-…> ', - M = '<M-…> ', - D = '<D-…> ', - S = '<S-…> ', - CR = '<CR> ', - Esc = '<Esc> ', - ScrollWheelDown = '<ScrollWheelDown> ', - ScrollWheelUp = '<ScrollWheelUp> ', - NL = '<NL> ', - BS = '<BS> ', - Space = '<Space> ', - Tab = '<Tab> ', - F1 = '<F1>', - F2 = '<F2>', - F3 = '<F3>', - F4 = '<F4>', - F5 = '<F5>', - F6 = '<F6>', - F7 = '<F7>', - F8 = '<F8>', - F9 = '<F9>', - F10 = '<F10>', - F11 = '<F11>', - F12 = '<F12>', - }, +-- ============================================================================ +-- PLUGIN: Telescope +-- ============================================================================ +pcall(function() + require('telescope').setup { + defaults = { + vimgrep_arguments = { + 'rg', + '--color=never', + '--no-heading', + '--with-filename', + '--line-number', + '--column', + '--smart-case', + '--hidden', }, - - -- Document existing key chains - spec = { - { '<leader>s', group = '[S]earch' }, - { '<leader>t', group = '[T]oggle' }, - { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + }, + ['ui-select'] = { + require('telescope.themes').get_dropdown(), }, }, - }, + } - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin + -- Load Telescope extensions + local telescope = require 'telescope' - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', + local fzf_loaded = pcall(telescope.load_extension, 'fzf') + if not fzf_loaded then + -- Match old_config behavior: ensure fzf-native is actually built + local fzf_dir = vim.fn.stdpath 'data' .. '/site/pack/core/opt/telescope-fzf-native.nvim' + local fzf_lib = vim.fn.glob(fzf_dir .. '/build/libfzf.*') - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', + if vim.fn.isdirectory(fzf_dir) == 1 and fzf_lib == '' and vim.fn.executable 'make' == 1 then + local build = vim.system({ 'make' }, { cwd = fzf_dir }):wait() + if build.code == 0 then + pcall(telescope.load_extension, 'fzf') + else + vim.notify('telescope-fzf-native build failed; find_files will use default sorter', vim.log.levels.WARN) + end + end + end - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, + pcall(telescope.load_extension, 'ui-select') - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: <c-/> - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! + -- Telescope keymaps + local builtin = require 'telescope.builtin' + vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', '<leader>sf', function() + builtin.find_files { hidden = true } + end, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + local function live_grep_with_space_and(opts) + opts = opts or {} - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case', - '--hidden', - }, - }, - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } + local function quote_pcre_literal(term) + -- Use \Q...\E so user input is treated literally (no regex parse errors). + return '\\Q' .. term:gsub('\\E', '\\E\\\\E\\Q') .. '\\E' + end - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') + builtin.live_grep(vim.tbl_extend('force', { + additional_args = function() + return { '--pcre2' } + end, + on_input_filter_cb = function(prompt) + prompt = prompt or '' - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', '<leader>sf', function() - builtin.find_files { hidden = true } - end, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) + local terms = {} + for term in prompt:gmatch '%S+' do + table.insert(terms, quote_pcre_literal(term)) + end - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '<leader>/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) + if #terms <= 1 then + return { prompt = prompt } + end - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', '<leader>s/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) + local and_pattern = '' + for _, term in ipairs(terms) do + and_pattern = and_pattern .. '(?=.*' .. term .. ')' + end - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', '<leader>sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, + return { prompt = and_pattern } + end, + }, opts)) + end - -- LSP Plugins - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, - }, + vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', '<leader>sg', function() + live_grep_with_space_and() + end, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '<leader>/', function() + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + vim.keymap.set('n', '<leader>s/', function() + live_grep_with_space_and { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + vim.keymap.set('n', '<leader>sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) +end) + +-- ============================================================================ +-- PLUGIN: Mason (LSP installer) +-- ============================================================================ +require('mason').setup { + ui = { + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', }, }, - { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { - 'williamboman/mason.nvim', - opts = { - ui = { - icons = { - package_installed = '✓', - package_pending = '➜', - package_uninstalled = '✗', - }, - }, - }, - }, - { - 'williamboman/mason-lspconfig.nvim', - opts = { - ensure_installed = { - 'lua_ls', - 'ansible_ls', - 'pyright', - 'yamlls', - 'bash-language-server', - 'python-lsp-server', - 'clangd', - 'terraform_ls', - 'jinja_lsp', - }, - }, - }, - 'WhoIsSethDaniel/mason-tool-installer.nvim', +} - -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, +-- Mason-tool-installer is for formatters, linters, debuggers (not LSP servers) +-- LSP servers are installed via mason-lspconfig below +require('mason-tool-installer').setup { + ensure_installed = { + 'stylua', -- Lua formatter + 'markdownlint', -- Markdown linter + 'ruff', -- Python linter + }, + auto_update = false, + run_on_start = true, +} + +-- ============================================================================ +-- PLUGIN: Fidget (LSP status) +-- ============================================================================ +pcall(function() + require('fidget').setup {} +end) - -- Allows extra capabilities provided by blink.cmp - 'saghen/blink.cmp', +-- ============================================================================ +-- PLUGIN: Lazydev (Lua LSP configuration) +-- ============================================================================ +pcall(function() + require('lazydev').setup { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` + } +end) - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end +-- ============================================================================ +-- PLUGIN: LSP Configuration +-- ============================================================================ - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') +-- Try to load telescope for LSP pickers, fallback to native LSP if not available +local telescope_builtin_ok, telescope_builtin = pcall(require, 'telescope.builtin') +local lsp_picker = { + references = telescope_builtin_ok and telescope_builtin.lsp_references or vim.lsp.buf.references, + implementations = telescope_builtin_ok and telescope_builtin.lsp_implementations or vim.lsp.buf.implementation, + definitions = telescope_builtin_ok and telescope_builtin.lsp_definitions or vim.lsp.buf.definition, + document_symbols = telescope_builtin_ok and telescope_builtin.lsp_document_symbols or vim.lsp.buf.document_symbol, + workspace_symbols = telescope_builtin_ok and telescope_builtin.lsp_dynamic_workspace_symbols or vim.lsp.buf.workspace_symbol, + type_definitions = telescope_builtin_ok and telescope_builtin.lsp_type_definitions or vim.lsp.buf.type_definition, +} - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) +-- Diagnostic configuration +vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = ' ', + [vim.diagnostic.severity.WARN] = ' ', + [vim.diagnostic.severity.INFO] = ' ', + [vim.diagnostic.severity.HINT] = ' ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, +} - -- Find references for the word under your cursor. - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') +-- LSP attach autocmd +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-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 - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + -- Rename the variable under your cursor + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press <C-t>. - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- Execute a code action + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- Find references + map('grr', lsp_picker.references, '[G]oto [R]eferences') - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + -- Jump to implementation + map('gri', lsp_picker.implementations, '[G]oto [I]mplementation') - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + -- Jump to definition + map('grd', lsp_picker.definitions, '[G]oto [D]efinition') - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- WARN: This is not Goto Definition, this is Goto Declaration + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end + -- Fuzzy find all the symbols in your current document + map('gO', lsp_picker.document_symbols, 'Open Document Symbols') - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) + -- Fuzzy find all the symbols in your current workspace + map('gW', lsp_picker.workspace_symbols, 'Open Workspace Symbols') - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) + -- Jump to the type of the word under your cursor + map('grt', lsp_picker.type_definitions, '[G]oto [T]ype Definition') - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end + -- Toggle inlay hints + local client = vim.lsp.get_client_by_id(event.data.client_id) + 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 - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client_supports_method(client, 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 + -- Highlight references when cursor rests + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-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('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } end, }) + end + end, +}) - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = ' ', - [vim.diagnostic.severity.WARN] = ' ', - [vim.diagnostic.severity.INFO] = ' ', - [vim.diagnostic.severity.HINT] = ' ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } +-- LSP servers configuration (Neovim 0.11+ / 0.13+ style) +-- Only use blink.cmp capabilities if it's installed, otherwise use native +local blink_ok, blink = pcall(require, 'blink.cmp') +local capabilities = blink_ok and blink.get_lsp_capabilities() or vim.lsp.protocol.make_client_capabilities() - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. - local capabilities = require('blink.cmp').get_lsp_capabilities() +local servers = { + lua_ls = { + settings = { + Lua = { + completion = { callSnippet = 'Replace' }, + }, + }, + }, + jinja_lsp = {}, + pylsp = {}, + bashls = {}, + ansiblels = {}, + terraformls = {}, + clangd = {}, + yamlls = {}, +} - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- +-- Combine server names for mason-lspconfig to install +local lsp_servers_to_install = vim.tbl_keys(servers) - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - settings = { - Lua = { - completion = { callSnippet = 'Replace' }, - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - jinja_lsp = {}, - } +-- Register per-server configs via vim.lsp.config() +for server_name, server in pairs(servers) do + local merged = vim.tbl_deep_extend('force', { + capabilities = capabilities, + }, server) + vim.lsp.config(server_name, merged) +end - -- Ensure the servers and tools above are installed - -- - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - 'ansiblels', - 'terraformls', - 'pylsp', - 'bashls', - 'jinja_lsp', - 'clangd', - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } +-- Let mason install servers, then explicitly enable them with vim.lsp.enable() +require('mason-lspconfig').setup { + ensure_installed = lsp_servers_to_install, + automatic_enable = false, +} - require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, +for _, server_name in ipairs(lsp_servers_to_install) do + vim.lsp.enable(server_name) +end - { -- Autoformat - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - '<leader>f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, +-- ============================================================================ +-- PLUGIN: Blink.cmp (Completion) +-- ============================================================================ +pcall(function() + require('blink.cmp').setup { + keymap = { preset = 'default' }, + appearance = { + nerd_font_variant = 'mono', }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - if disable_filetypes[vim.bo[bufnr].filetype] then - return nil - else - return { - timeout_ms = 500, - lsp_format = 'fallback', - } - end - end, - formatters_by_ft = { - lua = { 'stylua' }, - jinja = { 'jinja_lsp' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - }, - }, - }, - - { -- Autocompletion - 'saghen/blink.cmp', - event = 'VimEnter', - version = '1.*', - dependencies = { - -- Snippet Engine - { - 'L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + completion = { + ghost_text = { enabled = true }, + documentation = { + auto_show = true, + auto_show_delay_ms = 100, + window = { + border = 'rounded', + min_width = 20, + max_height = 30, + max_width = 80, }, - opts = {}, }, - 'folke/lazydev.nvim', + menu = { + auto_show = true, + min_width = 15, + max_height = 15, + }, }, - --- @module 'blink.cmp' - --- @type blink.cmp.Config - opts = { - keymap = { - -- 'default' (recommended) for mappings similar to built-in completions - -- <c-y> to accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - -- 'super-tab' for tab to accept - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- For an understanding of why the 'default' preset is recommended, - -- you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - -- - -- All presets have the following mappings: - -- <tab>/<s-tab>: move to right/left of your snippet expansion - -- <c-space>: Open menu or open docs if already open - -- <c-n>/<c-p> or <up>/<down>: Select next/previous item - -- <c-e>: Hide menu - -- <c-k>: Toggle signature help - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, + }, + snippets = { preset = 'luasnip' }, + fuzzy = { implementation = 'lua' }, + signature = { enabled = true }, + } +end) - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', - }, +-- ============================================================================ +-- PLUGIN: Conform (Formatting) +-- ============================================================================ +pcall(function() + require('conform').setup { + notify_on_error = false, + format_on_save = function(bufnr) + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + end + return { + timeout_ms = 500, + lsp_format = 'fallback', + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Let Jinja use LSP formatting fallback (no built-in conform formatter) + -- jinja = { ... }, + }, + } + vim.keymap.set('n', '<leader>f', function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, { desc = '[F]ormat buffer' }) +end) - completion = { - -- By default, you may press `<c-space>` to show the documentation. - -- Optionally, set `auto_show = true` to show the documentation after a delay. - ghost_text = { - enabled = true, - }, - documentation = { - auto_show = true, - auto_show_delay_ms = 100, - window = { - border = 'rounded', - min_width = 20, - max_height = 30, - max_width = 80, - }, - }, - menu = { - auto_show = true, - min_width = 15, - max_height = 15, - }, - }, - sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, - providers = { - lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, - }, - }, +-- ============================================================================ +-- PLUGIN: nvim-lint +-- ============================================================================ +local lint = require 'lint' +-- Only enable linters that are commonly available +-- Install with mason-tool-installer or manually: +-- npm install -g markdownlint-cli +-- pip install ruff +lint.linters_by_ft = { + markdown = { 'markdownlint' }, + python = { 'ruff' }, + -- json = { 'jsonlint' }, -- Uncomment if jsonlint is installed + -- text = { 'vale' }, -- Uncomment if vale is installed +} - snippets = { preset = 'luasnip' }, +local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) +vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + if vim.opt_local.modifiable:get() then + -- Only lint if a linter is configured for this filetype + local ft = vim.bo.filetype + if lint.linters_by_ft[ft] then + lint.try_lint() + end + end + end, +}) - -- Blink.cmp includes an optional, recommended rust fuzzy matcher, - -- which automatically downloads a prebuilt binary when enabled. - -- - -- By default, we use the Lua implementation instead, but you may enable - -- the rust implementation via `'prefer_rust_with_warning'` - -- - -- See :h blink-cmp-config-fuzzy for more information - fuzzy = { implementation = 'lua' }, +require('lint').linters.markdownlint.args = { + '--config', + vim.fn.expand '$XDG_CONFIG_HOME/nvim/markdownlint.yaml', +} - -- Shows a signature help window while you type arguments for a function - signature = { enabled = true }, +-- ============================================================================ +-- PLUGIN: Treesitter +-- ============================================================================ +local ts_ok, ts_configs = pcall(require, 'nvim-treesitter.configs') +if ts_ok then + ts_configs.setup { + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'terraform', + 'vim', + 'vimdoc', + 'python', + 'go', }, - }, - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + } +end - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- 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 } +-- ============================================================================ +-- PLUGIN: Supermaven (AI Completion) +-- ============================================================================ +pcall(function() + require('supermaven-nvim').setup {} +end) - -- 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() +-- ============================================================================ +-- PLUGIN: Neorg (Note taking) +-- ============================================================================ +pcall(function() + -- Ensure norg parser is discoverable on runtimepath. + -- With vim.pack, an older parser may exist under lazy.nvim's path from prior installs. + local data = vim.fn.stdpath 'data' + local parser_dir = data .. '/site/parser' + local function ensure_parser(name) + if #vim.api.nvim_get_runtime_file('parser/' .. name .. '.so', false) > 0 then + return + end - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + local candidates = { + data .. '/site/pack/core/opt/nvim-treesitter/parser/' .. name .. '.so', + data .. '/lazy/nvim-treesitter/parser/' .. name .. '.so', + } - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' + for _, src in ipairs(candidates) do + if vim.fn.filereadable(src) == 1 then + vim.fn.mkdir(parser_dir, 'p') + vim.uv.fs_copyfile(src, parser_dir .. '/' .. name .. '.so') + return end + end + end - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { - 'bash', - 'c', - 'diff', - 'html', - 'lua', - 'luadoc', - 'markdown', - 'markdown_inline', - 'query', - 'terraform', - 'vim', - 'vimdoc', - 'python', - 'go', + ensure_parser 'norg' + ensure_parser 'norg_meta' + + require('neorg').setup { + load = { + ['core.defaults'] = {}, + ['core.concealer'] = {}, + ['core.integrations.treesitter'] = { + config = { + install_parsers = false, + }, }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, + ['core.dirman'] = { + config = { + workspaces = { + notes = '~/notes', + work = '~/work', + }, + default_workspace = 'notes', + }, }, - indent = { enable = true, disable = { 'ruby' } }, }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - }, + } +end) + +-- ============================================================================ +-- PLUGIN: Flash (Navigation) +-- ============================================================================ +pcall(function() + require('flash').setup {} + vim.keymap.set({ 'n', 'x', 'o' }, 's', function() + require('flash').jump() + end, { desc = 'Flash' }) + vim.keymap.set({ 'n', 'x', 'o' }, 'S', function() + require('flash').treesitter() + end, { desc = 'Flash Treesitter' }) + vim.keymap.set('o', 'r', function() + require('flash').remote() + end, { desc = 'Remote Flash' }) + vim.keymap.set({ 'o', 'x' }, 'R', function() + require('flash').treesitter_search() + end, { desc = 'Treesitter Search' }) + vim.keymap.set('c', '<c-s>', function() + require('flash').toggle() + end, { desc = 'Toggle Flash Search' }) +end) - -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. +-- ============================================================================ +-- PLUGIN: Harpoon (File marking) +-- ============================================================================ +pcall(function() + local harpoon = require 'harpoon' - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + -- Harpoon2 + harpoon:setup {} - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - { import = 'custom.plugins' }, - -- - -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! - -- In normal mode type `<space>sh` then write `lazy.nvim-plugin` - -- you can continue same window with `<space>sr` which resumes last telescope search -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', + vim.keymap.set('n', '<leader>a', function() + harpoon:list():add() + end, { desc = 'Harpoon: Add file' }) + vim.keymap.set('n', '<C-e>', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = 'Harpoon: Toggle menu' }) + vim.keymap.set('n', '<leader>1', function() + harpoon:list():select(1) + end, { desc = 'Harpoon: File 1' }) + vim.keymap.set('n', '<leader>2', function() + harpoon:list():select(2) + end, { desc = 'Harpoon: File 2' }) + vim.keymap.set('n', '<leader>3', function() + harpoon:list():select(3) + end, { desc = 'Harpoon: File 3' }) + vim.keymap.set('n', '<leader>4', function() + harpoon:list():select(4) + end, { desc = 'Harpoon: File 4' }) + vim.keymap.set('n', '<C-S-P>', function() + harpoon:list():prev() + end, { desc = 'Harpoon: Prev file' }) + vim.keymap.set('n', '<C-S-N>', function() + harpoon:list():next() + end, { desc = 'Harpoon: Next file' }) +end) + +-- ============================================================================ +-- PLUGIN: Toggleterm (Terminal) +-- ============================================================================ +pcall(function() + require('toggleterm').setup { + start_in_insert = true, + persistent_mode = false, + shell = vim.o.shell, + auto_scroll = true, + float_opts = { + border = 'single', + title_pos = 'center', }, - }, -}) + } + vim.keymap.set('n', '<leader>`', ':ToggleTerm direction=float<cr>', { desc = 'Open a floating terminal' }) +end) + +-- ============================================================================ +-- PLUGIN: Mini.nvim +-- ============================================================================ +pcall(function() + require('mini.ai').setup { n_lines = 500 } + require('mini.surround').setup() + require('mini.statusline').setup { use_icons = vim.g.have_nerd_font } +end) + +-- ============================================================================ +-- PLUGIN: Todo-comments +-- ============================================================================ +pcall(function() + require('todo-comments').setup { signs = false } +end) + +-- ============================================================================ +-- PLUGIN: Headlines (Markdown highlighting) +-- ============================================================================ +pcall(function() + require('headlines').setup { + norg = { + headline_highlights = { 'Headline1', 'Headline2', 'Headline3', 'Headline4', 'Headline5', 'Headline6' }, + codeblock_highlight = { 'NeorgCodeBlock' }, + }, + } +end) + +-- ============================================================================ +-- PLUGIN: Which-key (Keybinding hints) +-- ============================================================================ +pcall(function() + require('which-key').setup { + delay = 0, + icons = { + mappings = vim.g.have_nerd_font, + keys = vim.g.have_nerd_font and {} or { + Up = '<Up> ', + Down = '<Down> ', + Left = '<Left> ', + Right = '<Right> ', + C = '<C-…> ', + M = '<M-…> ', + D = '<D-…> ', + S = '<S-…> ', + CR = '<CR> ', + Esc = '<Esc> ', + ScrollWheelDown = '<ScrollWheelDown> ', + ScrollWheelUp = '<ScrollWheelUp> ', + NL = '<NL> ', + BS = '<BS> ', + Space = '<Space> ', + Tab = '<Tab> ', + F1 = '<F1>', + F2 = '<F2>', + F3 = '<F3>', + F4 = '<F4>', + F5 = '<F5>', + F6 = '<F6>', + F7 = '<F7>', + F8 = '<F8>', + F9 = '<F9>', + F10 = '<F10>', + F11 = '<F11>', + F12 = '<F12>', + }, + }, + spec = { + { '<leader>s', group = '[S]earch' }, + { '<leader>t', group = '[T]oggle' }, + { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + } +end) --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et +-- ============================================================================ +-- FILETYPE ADDITIONS +-- ============================================================================ +vim.filetype.add { + extension = { + yml = 'yaml.ansible', + jinja = 'jinja', + jinja2 = 'jinja', + j2 = 'jinja', + }, +} diff --git a/nvim/.config/nvim/markdownlint.yaml b/nvim/.config/nvim/markdownlint.yaml new file mode 100644 index 0000000..02ce390 --- /dev/null +++ b/nvim/.config/nvim/markdownlint.yaml @@ -0,0 +1,4 @@ +default: true + +MD013: false +MD033: false diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..6e83287 --- /dev/null +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,156 @@ +{ + "plugins": { + "LuaSnip": { + "rev": "642b0c595e11608b4c18219e93b88d7637af27bc", + "src": "https://github.com/L3MON4D3/LuaSnip" + }, + "blink.cmp": { + "rev": "ba9601b77e721d53d66e1486a30a05c6311cf535", + "src": "https://github.com/saghen/blink.cmp" + }, + "conform.nvim": { + "rev": "086a40dc7ed8242c03be9f47fbcee68699cc2395", + "src": "https://github.com/stevearc/conform.nvim" + }, + "doom-one-theme": { + "rev": "beae92173315c7282f6897e666cfd67fbf0f3ac9", + "src": "https://github.com/NTBBloodbath/doom-one.nvim" + }, + "doom-one.nvim": { + "rev": "beae92173315c7282f6897e666cfd67fbf0f3ac9", + "src": "https://github.com/NTBBloodbath/doom-one.nvim" + }, + "fidget.nvim": { + "rev": "889e2e96edef4e144965571d46f7a77bcc4d0ddf", + "src": "https://github.com/j-hui/fidget.nvim" + }, + "flash.nvim": { + "rev": "fcea7ff883235d9024dc41e638f164a450c14ca2", + "src": "https://github.com/folke/flash.nvim" + }, + "gitsigns": { + "rev": "0f00d07c2c3106ba6abd594ac1c17f211141b7b5", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "gitsigns.nvim": { + "rev": "e1b90b60fb7aa9c0ada8e983b460764b35a05e2e", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "harpoon": { + "rev": "87b1a3506211538f460786c23f98ec63ad9af4e5", + "src": "https://github.com/ThePrimeagen/harpoon" + }, + "headlines.nvim": { + "rev": "bf17c96a836ea27c0a7a2650ba385a7783ed322e", + "src": "https://github.com/lukas-reineke/headlines.nvim" + }, + "lazydev.nvim": { + "rev": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d", + "src": "https://github.com/folke/lazydev.nvim" + }, + "lua-utils.nvim": { + "rev": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd", + "src": "https://github.com/nvim-neorg/lua-utils.nvim" + }, + "lualine.nvim": { + "rev": "74114f0df664f14d7c228945693ba68a3b70a794", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, + "mason-lspconfig.nvim": { + "rev": "25f609e7fca78af7cede4f9fa3af8a94b1c4950b", + "src": "https://github.com/williamboman/mason-lspconfig.nvim" + }, + "mason-tool-installer.nvim": { + "rev": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc", + "src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" + }, + "mason.nvim": { + "rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65", + "src": "https://github.com/williamboman/mason.nvim" + }, + "mini.nvim": { + "rev": "3923662bf3d6ca49a9503f8d7196ea0450983e6a", + "src": "https://github.com/echasnovski/mini.nvim" + }, + "neo-tree.nvim": { + "rev": "08edbf0ca8b5a05086c14c824e139cc67020c718", + "src": "https://github.com/nvim-neo-tree/neo-tree.nvim" + }, + "neorg": { + "rev": "01b3b0d2d76f18c8fa18d3aaf25f08e30a872e97", + "src": "https://github.com/nvim-neorg/neorg" + }, + "nui.nvim": { + "rev": "de740991c12411b663994b2860f1a4fd0937c130", + "src": "https://github.com/MunifTanjim/nui.nvim" + }, + "nvim-lint": { + "rev": "4b03656c09c1561f89b6aa0665c15d292ba9499d", + "src": "https://github.com/mfussenegger/nvim-lint" + }, + "nvim-lspconfig": { + "rev": "8e2084bf5e40c79c1f42210a6ef96a0a4793a763", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-nio": { + "rev": "21f5324bfac14e22ba26553caf69ec76ae8a7662", + "src": "https://github.com/nvim-neotest/nvim-nio" + }, + "nvim-treesitter": { + "rev": "6878ae017d691a0df1c49d8a091c88a33e4c2d50", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "nvim-web-devicons": { + "rev": "40e9d5a6cc3db11b309e39593fc7ac03bb844e38", + "src": "https://github.com/nvim-tree/nvim-web-devicons" + }, + "pathlib.nvim": { + "rev": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1", + "src": "https://github.com/pysan3/pathlib.nvim" + }, + "plenary.nvim": { + "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "supermaven-nvim": { + "rev": "07d20fce48a5629686aefb0a7cd4b25e33947d50", + "src": "https://github.com/supermaven-inc/supermaven-nvim" + }, + "telescope-fzf-native.nvim": { + "rev": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c", + "src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + "telescope-ui-select.nvim": { + "rev": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2", + "src": "https://github.com/nvim-telescope/telescope-ui-select.nvim" + }, + "telescope.nvim": { + "rev": "cfb85dcf7f822b79224e9e6aef9e8c794211b20b", + "src": "https://github.com/nvim-telescope/telescope.nvim" + }, + "theme": { + "rev": "beae92173315c7282f6897e666cfd67fbf0f3ac9", + "src": "https://github.com/NTBBloodbath/doom-one.nvim" + }, + "todo-comments.nvim": { + "rev": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668", + "src": "https://github.com/folke/todo-comments.nvim" + }, + "toggleterm.nvim": { + "rev": "9a88eae817ef395952e08650b3283726786fb5fb", + "src": "https://github.com/akinsho/toggleterm.nvim" + }, + "vim-be-good": { + "rev": "0ae3de14eb8efc6effe7704b5e46495e91931cc5", + "src": "https://github.com/ThePrimeagen/vim-be-good" + }, + "vim-sleuth": { + "rev": "be69bff86754b1aa5adcbb527d7fcd1635a84080", + "src": "https://github.com/tpope/vim-sleuth" + }, + "which-key.nvim": { + "rev": "3aab2147e74890957785941f0c1ad87d0a44c15a", + "src": "https://github.com/folke/which-key.nvim" + } + } +} diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index 479dfb9..f158a30 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -1,47 +1,54 @@ -# Set terminal colors -set-option -sa terminal-overrides ",xterm*:Tc" +# Terminal colors +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",*:RGB" +set -g mouse on +set -g set-clipboard on +set -g allow-passthrough on -#set-option -g status-style bg=default -#set-option -g status-justify left -#set-option -g status-left-length 50 -#set-option -g status-interval 2 -#set-option -g status-left '[ #[fg=white,bright]#h ] #[default]' -#set-option -g status-right-length 80 -#set-option -g status-right '[ #($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load -a 1 --interval 2) | #{battery_percentage} #{battery_remain} | #[fg=white,bright]%m/%d %H:%M #[fg=default]]' -#set-window-option -g window-status-current-format '#[fg=red,bg=default]( #[fg=white,bright,bg=default]#I:#W#[fg=red,nobright,bg=default] )#[fg=default]' -set -as terminal-features ",alacritty*:RGB" -source /usr/share/powerline/bindings/tmux/powerline.conf +# --- Native replacement for tmux-sensible --- +set -g history-limit 50000 +set -g display-time 4000 +set -g status-interval 5 +set -s escape-time 10 +set -g focus-events on +set -g aggressive-resize on +set -g renumber-windows on +set -g detach-on-destroy off +set -g display-panes-time 800 -set -g mouse on set -g base-index 1 set -g pane-base-index 1 -# Map prefix to A +# Map prefix to C-a unbind C-b set-option -g prefix C-a bind-key C-a send-prefix unbind % -bind | split-window -h +bind \\ split-window -h unbind '"' bind - split-window -v +unbind r +bind r source-file ~/.config/tmux/tmux.conf + 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-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 +unbind -T copy-mode-vi MouseDragEnd1Pane # vim-like pane switching -bind -r ^ last-window -bind -r k select-pane -U -bind -r j select-pane -D bind -r h select-pane -L +bind -r j select-pane -D +bind -r k select-pane -U bind -r l select-pane -R -# vim-linke pane resizing -bind -r K resize-pane -U 5 -bind -r J resize-pane -D 5 +# vim-like pane resizing bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 bind -r m resize-pane -Z @@ -50,20 +57,60 @@ bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y" unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse -# List of plugins -set -g @tpm_plugins ' \ - tmux-plugins/tpm \ - tmux-plugins/tmux-sensible \ - tmux-plugins/tmux-resurrect \ - git@github.com:dracula/tmux \ - ' - # thewtex/tmux-mem-cpu-load \ - # tmux-plugins/tmux-battery \ -#' +# --- Native theme (replaces dracula/tmux) --- +%hidden one_bg="#222436" +%hidden one_fg="#c8d3f5" +%hidden one_cyan="#86e1fc" +%hidden one_black="#1b1d2b" +%hidden one_gray="#3a3f5a" +%hidden one_magenta="#c099ff" +%hidden one_pink="#ff757f" +%hidden one_red="#ff757f" +%hidden one_green="#c3e88d" +%hidden one_yellow="#ffc777" +%hidden one_blue="#82aaff" +%hidden one_orange="#ff9e64" +%hidden one_black4="#444a73" + +set -g status on +set -g status-position bottom +set -g status-justify left +set -g status-left-length 100 +set -g status-right-length 100 +set -g status-style "bg=$one_black,fg=$one_fg" + +# Left: session +set -g status-left "#[bg=$one_blue,fg=$one_black,bold] #S #[bg=$one_black,fg=$one_blue]" + +# Windows +set -g window-status-separator "" +set -g window-status-style "bg=$one_black,fg=$one_fg" +set -g window-status-format " #I:#W " +set -g window-status-current-style "bg=$one_blue,fg=$one_black,bold" +set -g window-status-current-format "#[bg=$one_black,fg=$one_blue]#[bold] [#I]#W #[nobold]#[bg=$one_black,fg=$one_blue]" +set -g window-status-activity-style "bg=$one_black,fg=$one_yellow" +set -g window-status-bell-style "bg=$one_black,fg=$one_red,bold" +set -g monitor-activity on + +# Right: date/time + host. Add CPU/battery via #() only if needed. +set -g status-right "#[bg=$one_black,fg=$one_black4] #[bg=$one_black,fg=$one_blue]#[bg=$one_blue,fg=$one_black,bold] #h " +# Optional (uncomment if you have acpi/upower and want dracula-like segments): +# set -g status-right "#[bg=$one_black,fg=$one_black4]#[bg=$one_black4,fg=$one_fg] #(cut -d' ' -f1-3 /proc/loadavg) #[bg=$one_black4,fg=$one_magenta]#[bg=$one_magenta,fg=$one_black,bold] #(cat /sys/class/power_supply/BAT0/capacity 2>/dev/null || echo '--')% #[bg=$one_magenta,fg=$one_blue]#[bg=$one_blue,fg=$one_black,bold] %Y-%m-%d %H:%M #h " + +# Panes +set -g pane-border-style "fg=$one_gray" +set -g pane-active-border-style "fg=$one_blue" +set -g display-panes-colour "$one_orange" +set -g display-panes-active-colour "$one_blue" + +# Messages / prompts +set -g message-style "bg=$one_gray,fg=$one_fg" +set -g message-command-style "bg=$one_gray,fg=$one_fg" -set -g @dracula-plugins "cpu-usage battery time" -set -g @dracula-show-powerline true -set -g @dracula-battery-label " " -set -g @dracula-refresh-rate 1 +# Copy mode / selection +set -g mode-style "bg=$one_blue,fg=$one_black,bold" +set -g copy-mode-match-style "bg=$one_yellow,fg=$one_black" +set -g copy-mode-current-match-style "bg=$one_orange,fg=$one_black,bold" +set -g copy-mode-mark-style "bg=$one_magenta,fg=$one_black" -run '$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm' +set -g clock-mode-colour "$one_blue" |
