diff --git a/.config/cava/shaders/bar_spectrum.frag b/.config/cava/shaders/bar_spectrum.frag new file mode 100644 index 0000000..b078913 --- /dev/null +++ b/.config/cava/shaders/bar_spectrum.frag @@ -0,0 +1,79 @@ +#version 330 + +in vec2 fragCoord; +out vec4 fragColor; + +// bar values. defaults to left channels first (low to high), then right (high to low). +uniform float bars[512]; + +uniform int bars_count; // number of bars (left + right) (configurable) +uniform int bar_width; // bar width (configurable), not used here +uniform int bar_spacing; // space bewteen bars (configurable) + +uniform vec3 u_resolution; // window resolution + +//colors, configurable in cava config file (r,g,b) (0.0 - 1.0) +uniform vec3 bg_color; // background color +uniform vec3 fg_color; // foreground color + +uniform int gradient_count; +uniform vec3 gradient_colors[8]; // gradient colors + +vec3 normalize_C(float y,vec3 col_1, vec3 col_2, float y_min, float y_max) +{ + //create color based on fraction of this color and next color + float yr = (y - y_min) / (y_max - y_min); + return col_1 * (1.0 - yr) + col_2 * yr; +} + +void main() +{ + // find which bar to use based on where we are on the x axis + float x = u_resolution.x * fragCoord.x; + int bar = int(bars_count * fragCoord.x); + + //calculate a bar size + float bar_size = u_resolution.x / bars_count; + + //the y coordinate and bar values are the same + float y = bars[bar]; + + // make sure there is a thin line at bottom + if (y * u_resolution.y < 1.0) + { + y = 1.0 / u_resolution.y; + } + + //draw the bar up to current height + if (y > fragCoord.y) + { + //make some space between bars basen on settings + if (x > (bar + 1) * (bar_size) - bar_spacing) + { + fragColor = vec4(bg_color,1.0); + } + else + { + if (gradient_count == 0) + { + fragColor = vec4(fg_color,1.0); + } + else + { + //find which color in the configured gradient we are at + int color = int((gradient_count - 1) * fragCoord.y); + + //find where on y this and next color is supposed to be + float y_min = color / (gradient_count - 1.0); + float y_max = (color + 1.0) / (gradient_count - 1.0); + + //make color + fragColor = vec4(normalize_C(fragCoord.y, gradient_colors[color], gradient_colors[color + 1], y_min, y_max), 1.0); + } + } + } + else + { + fragColor = vec4(bg_color,1.0); + } +} \ No newline at end of file diff --git a/.config/cava/shaders/northern_lights.frag b/.config/cava/shaders/northern_lights.frag new file mode 100644 index 0000000..ecd859a --- /dev/null +++ b/.config/cava/shaders/northern_lights.frag @@ -0,0 +1,34 @@ +#version 330 + +in vec2 fragCoord; +out vec4 fragColor; + +// bar values. defaults to left channels first (low to high), then right (high to low). +uniform float bars[512]; + +uniform int bars_count; // number of bars (left + right) (configurable) + +uniform vec3 u_resolution; // window resolution, not used here + +//colors, configurable in cava config file +uniform vec3 bg_color; // background color(r,g,b) (0.0 - 1.0), not used here +uniform vec3 fg_color; // foreground color, not used here + +void main() +{ + // find which bar to use based on where we are on the x axis + int bar = int(bars_count * fragCoord.x); + + float bar_y = 1.0 - abs((fragCoord.y - 0.5)) * 2.0; + float y = (bars[bar]) * bar_y; + + float bar_x = (fragCoord.x - float(bar) / float(bars_count)) * bars_count; + float bar_r = 1.0 - abs((bar_x - 0.5)) * 2; + + bar_r = bar_r * bar_r * 2; + + // set color + fragColor.r = fg_color.x * y * bar_r; + fragColor.g = fg_color.y * y * bar_r; + fragColor.b = fg_color.z * y * bar_r; +} diff --git a/.config/cava/shaders/pass_through.vert b/.config/cava/shaders/pass_through.vert new file mode 100644 index 0000000..a4f20e5 --- /dev/null +++ b/.config/cava/shaders/pass_through.vert @@ -0,0 +1,14 @@ +#version 330 + + +// Input vertex data, different for all executions of this shader. +layout(location = 0) in vec3 vertexPosition_modelspace; + +// Output data ; will be interpolated for each fragment. +out vec2 fragCoord; + +void main() +{ + gl_Position = vec4(vertexPosition_modelspace,1); + fragCoord = (vertexPosition_modelspace.xy+vec2(1,1))/2.0; +} diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 1eb6ccc..4aaaa95 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,37 +1,40 @@ { - "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, - "avante.nvim": { "branch": "main", "commit": "6206998f240da6734bd49d830d76b2035d173f1d" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "02fd64fb3d4b18ec029c0e0683c3dc3ec6d2c5b8" }, - "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, + "avante.nvim": { "branch": "main", "commit": "be92be6124f743c30ba4b52ded908d02cfb80a1b" }, + "blink.cmp": { "branch": "main", "commit": "5f442681df24fe705d1ee7ce5b4d435aa4b4dee4" }, + "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, + "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "img-clip.nvim": { "branch": "main", "commit": "5ff183655ad98b5fc50c55c66540375bbd62438c" }, - "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, - "lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, - "lspsaga.nvim": { "branch": "main", "commit": "d027f8b9c7c55e26cf4030c8657a2fc8222ed762" }, + "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" }, + "lspsaga.nvim": { "branch": "main", "commit": "5fce15331ac6c3a3ec3ac91ab0e85ed82f5cbba0" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "nightfox.nvim": { "branch": "main", "commit": "7557f26defd093c4e9bc17f28b08403f706f5a44" }, - "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "0a0daa796a5919a51e5e5019ffa91219c94c4fef" }, + "nvim-dap": { "branch": "master", "commit": "665d3569a86395fe0dab85efbdb26d7d2ee57e49" }, "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, - "nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" }, - "nvim-lspconfig": { "branch": "master", "commit": "6e385d2fe5da6714f00142afbd8d3591d330ffd7" }, - "nvim-tree.lua": { "branch": "master", "commit": "ca7c4c33cac2ad66ec69d45e465379716ef0cc97" }, - "nvim-treesitter": { "branch": "master", "commit": "0aaf146590f3edd1dfa64fbfa2ad1cdca65afa6f" }, - "nvim-web-devicons": { "branch": "master", "commit": "203da76ecfbb4b192cf830665b03eb651b635c94" }, + "nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" }, + "nvim-lspconfig": { "branch": "master", "commit": "ff2b85abaa810f6611233dbe6d31c07510ebf43d" }, + "nvim-treesitter": { "branch": "master", "commit": "eb3e850acff4d9f2f2dd8dacd75353043c899753" }, + "nvim-web-devicons": { "branch": "master", "commit": "63f552a7f59badc6e6b6d22e603150f0d5abebb7" }, + "oil.nvim": { "branch": "master", "commit": "ba858b662599eab8ef1cba9ab745afded99cb180" }, + "org-bullets.nvim": { "branch": "main", "commit": "46ae687e22192fb806b5977d664ec98af9cf74f6" }, + "org-roam.nvim": { "branch": "main", "commit": "cf00a0b3797ee3370c2ca2bdedbc04b2f5309a1e" }, + "orgmode": { "branch": "master", "commit": "ac6e02ab638ee324b3e3894e2a05488aad0b467c" }, "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "render-markdown.nvim": { "branch": "main", "commit": "7674543331701d05dc9f878e1fe62d1107dc2f5e" }, - "rustaceanvim": { "branch": "master", "commit": "bf3d8c7bcbf20a7e7f4af36c2d5390ca6ad43281" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "render-markdown.nvim": { "branch": "main", "commit": "ba6253d9673daf0cf394b87b2c2ecb7630944c7d" }, + "rustaceanvim": { "branch": "master", "commit": "6db1fe9e3f005b2e0921c7302d2c195eeb90a451" }, + "sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" }, + "statuscol.nvim": { "branch": "main", "commit": "81d1cfb47e91780f72a8d9a3529f146731864313" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "venv-selector.nvim": { "branch": "main", "commit": "f212a424fb29949cb5e683928bdd4038bbe0062d" }, - "which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" } + "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } } diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index a54b9b5..ca7cdc5 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -12,8 +12,13 @@ end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ + change_detection = { + notify = false, + }, spec = { { import = "plugins" }, + { import = "plugins.lsp" }, + { import = "plugins.org" }, }, checker = { enabled = true }, defaults = { diff --git a/.config/nvim/lua/core/helpers.lua b/.config/nvim/lua/core/helpers.lua index e053066..d8df0b6 100644 --- a/.config/nvim/lua/core/helpers.lua +++ b/.config/nvim/lua/core/helpers.lua @@ -1,82 +1,75 @@ ----@alias RHS ----| string ----| function +---@alias KeyCommand string | function +---@alias KeyOpts { desc?: string, silent?: boolean, noremap?: boolean } local M = {} ----@module "vim" ----@alias MapOpts string | vim.keymap.set.Opts options or description - ---- Simple keymap helper +--- Create a keymap with sensible defaults ---@param mode string | string[] ----@param keys "n" | "i" | "t" ----@param command RHS ----@param opts? MapOpts +---@param keys string +---@param command KeyCommand +---@param opts? string | KeyOpts local function keymap(mode, keys, command, opts) - local options = (type(opts) == "table" and opts) - or { noremap = true, silent = true, desc = opts } + local options = type(opts) == "table" and opts or { desc = opts } + options.noremap = options.noremap ~= false + options.silent = options.silent ~= false vim.keymap.set(mode, keys, command, options) end ---- Simple `n` keymap shorthand basically a shorter version of: ---- `vim.keymap.set('n', keys, command, { noremap = true, silent = true, desc = desc })` +--- Map keys in normal mode ---@param keys string ----@param command RHS ----@param opts? MapOpts +---@param command KeyCommand +---@param opts? string | KeyOpts function M.nmap(keys, command, opts) keymap("n", keys, command, opts) end ---- Simple `i` keymap shorthand basically a shorter version of: ---- `vim.keymap.set('i', keys, command, { noremap = true, silent = true, desc = desc })` +--- Map keys in insert mode ---@param keys string ----@param command RHS ----@param opts? MapOpts +---@param command KeyCommand +---@param opts? string | KeyOpts function M.imap(keys, command, opts) keymap("i", keys, command, opts) end ---- Simple `t` keymap shorthand basically a shorter version of: ---- `vim.keymap.set('t', keys, command, { noremap = true, silent = true, desc = desc })` +--- Map keys in terminal mode ---@param keys string ----@param command RHS ----@param opts? MapOpts +---@param command KeyCommand +---@param opts? string | KeyOpts function M.tmap(keys, command, opts) keymap("t", keys, command, opts) end ---- Simple way to create augroups ----@param defintions table> -function M.augroups(defintions) - for group_name, definition in pairs(defintions) do - vim.api.nvim_command("augroup " .. group_name) - vim.api.nvim_command("autocmd!") +--- Map keys in visual mode +---@param keys string +---@param command KeyCommand +---@param opts? string | KeyOpts +function M.vmap(keys, command, opts) + keymap("v", keys, command, opts) +end + +--- Create autocommand groups +---@param definitions table +function M.augroups(definitions) + for group_name, definition in pairs(definitions) do + local group = vim.api.nvim_create_augroup(group_name, { clear = true }) for _, def in ipairs(definition) do - local command = table.concat( - vim.iter({ "autocmd", def }):flatten():totable(), - " " - ) - vim.api.nvim_command(command) + vim.api.nvim_create_autocmd(def[1], { + group = group, + pattern = def[2], + command = def[3], + }) end - - vim.api.nvim_command("augroup END") end end ---- Shallowly merge two tables ----@param a? table ----@param b? table -function M.merge(a, b) - local first_table = a or {} - local second_table = b or {} - - for k, v in pairs(second_table) do - first_table[k] = v - end - - return first_table +--- Merge two tables +---@param target? table +---@param source? table +---@return table +function M.merge(target, source) + return vim.tbl_extend("force", target or {}, source or {}) end return M diff --git a/.config/nvim/lua/core/lsp.lua b/.config/nvim/lua/core/lsp.lua index bccbce7..470cacd 100644 --- a/.config/nvim/lua/core/lsp.lua +++ b/.config/nvim/lua/core/lsp.lua @@ -7,10 +7,10 @@ end --- @module "vim" --- @type vim.diagnostic.Opts.Signs local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, + { name = "DiagnosticSignError", text = " " }, + { name = "DiagnosticSignWarn", text = " " }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = " " }, } for _, sign in ipairs(signs) do @@ -23,10 +23,12 @@ end --- @module "vim" --- @type vim.diagnostic.Opts local config = { - virtual_text = { - source = "if_many", - }, + -- virtual_text = { + -- hl_mode = "combine", + -- source = "if_many", + -- }, -- show signs + virtual_text = false, signs = { active = signs, }, @@ -66,6 +68,10 @@ helpers.nmap( "LSP - Add buffer diagnostics to location list" ) +helpers.nmap("td", function() + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) +end, "LSP - Toggle Diagnostics") + -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer vim.api.nvim_create_autocmd("LspAttach", { diff --git a/.config/nvim/lua/core/settings.lua b/.config/nvim/lua/core/settings.lua index 1500c47..a82f976 100644 --- a/.config/nvim/lua/core/settings.lua +++ b/.config/nvim/lua/core/settings.lua @@ -35,3 +35,10 @@ set.hidden = true -- yank to clipboard set.clipboard = "unnamed,unnamedplus" + +-- orgmode conceal +set.conceallevel = 2 +set.concealcursor = "nc" + +-- views can only be fully collapsed with the global statusline +vim.opt.laststatus = 3 diff --git a/.config/nvim/lua/plugins/alpha-nvim.lua b/.config/nvim/lua/plugins/alpha-nvim.lua index c55db91..aa4e5c2 100644 --- a/.config/nvim/lua/plugins/alpha-nvim.lua +++ b/.config/nvim/lua/plugins/alpha-nvim.lua @@ -47,8 +47,8 @@ return { local height = 25 -- two pixels per vertical space dashboard.section.terminal.command = "cat | " - .. os.getenv("HOME") - .. "/.config/art/thisisfine.sh" + .. os.getenv("XDG_CONFIG_HOME") + .. "/art/thisisfine.sh" dashboard.section.terminal.width = width dashboard.section.terminal.height = height dashboard.section.terminal.opts.redraw = true diff --git a/.config/nvim/lua/plugins/avante-nvim.lua b/.config/nvim/lua/plugins/avante-nvim.lua index 1254df7..cee60e1 100644 --- a/.config/nvim/lua/plugins/avante-nvim.lua +++ b/.config/nvim/lua/plugins/avante-nvim.lua @@ -13,7 +13,6 @@ return { "stevearc/dressing.nvim", "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions "nvim-tree/nvim-web-devicons", { -- support for image pasting @@ -32,13 +31,5 @@ return { }, }, }, - { - -- Make sure to set this up properly if you have lazy=true - "MeanderingProgrammer/render-markdown.nvim", - opts = { - file_types = { "markdown", "Avante" }, - }, - ft = { "markdown", "Avante" }, - }, }, } diff --git a/.config/nvim/lua/plugins/blink-cmp.lua b/.config/nvim/lua/plugins/blink-cmp.lua new file mode 100644 index 0000000..d634f50 --- /dev/null +++ b/.config/nvim/lua/plugins/blink-cmp.lua @@ -0,0 +1,143 @@ +return { + "saghen/blink.cmp", + dependencies = { + { "L3MON4D3/LuaSnip", version = "v2.*" }, + }, + event = "LspAttach", + + -- use a release tag to download pre-built binaries + version = "*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- see the "default configuration" section below for full documentation on how to define + -- your own keymap. + keymap = { + preset = "default", + -- [""] = { "accept", "fallback" }, + [""] = { "snippet_forward", "select_next", "fallback" }, + [""] = { "snippet_backward", "select_prev", "fallback" }, + [""] = {}, + [""] = {}, + }, + + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- will be removed in a future release + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + + kind_icons = { + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "", + }, + }, + + completion = { + accept = { auto_brackets = { enabled = false } }, + + menu = { + -- auto_show = function(ctx) + -- return ctx.mode ~= "cmdline" + -- or not vim.tbl_contains( + -- { "/", "?" }, + -- vim.fn.getcmdtype() + -- ) + -- end, + + draw = { + columns = { + { "kind_icon" }, + { + "label", + "label_description", + "source_name", + gap = 1, + }, + }, + }, + }, + + -- Display a preview of the selected item on the current line + ghost_text = { enabled = true }, + }, + + -- Add LuaSnip to completion suggestions + snippets = { + expand = function(snippet) + require("luasnip").lsp_expand(snippet) + end, + active = function(filter) + if filter and filter.direction then + return require("luasnip").jumpable(filter.direction) + end + return require("luasnip").in_snippet() + end, + jump = function(direction) + require("luasnip").jump(direction) + end, + }, + + -- default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, via `opts_extend` + sources = { + default = { "lsp", "path", "luasnip", "buffer" }, + -- optionally disable cmdline completions + -- cmdline = {}, + }, + + -- experimental signature help support + -- signature = { enabled = true } + + enabled = function() + return not vim.tbl_contains({ + "Avante", + "AvanteInput", + "DressingInput", + -- "NvimTree", + "Telescope", + "TelescopePrompt", + "markdown", + "oil", + "org", + }, vim.bo.filetype) and vim.bo.buftype ~= "prompt" and vim.b.completion ~= false + end, + }, + -- allows extending the providers array elsewhere in your config + -- without having to redefine it + opts_extend = { "sources.default" }, + + sigature = { enabled = true }, +} diff --git a/.config/nvim/lua/plugins/cmp/init.lua b/.config/nvim/lua/plugins/cmp/init.lua deleted file mode 100644 index aa8e257..0000000 --- a/.config/nvim/lua/plugins/cmp/init.lua +++ /dev/null @@ -1,61 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp - "hrsh7th/cmp-buffer", -- Buffer source for nvim-cmp - "onsails/lspkind.nvim", -- LSP icons - "saadparwaiz1/cmp_luasnip", - }, - opts = function() - local cmp = require("cmp") - - return { - completion = { - autocomplete = { cmp.TriggerEvent.TextChanged }, - }, - formatting = { - format = require("plugins.lspkind.utils").add_lspkind_icons(), - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [""] = vim.schedule_wrap(function(fallback) - if - cmp.visible() - and require("plugins.cmp.utils").has_words_before() - then - cmp.select_next_item({ - behavior = cmp.SelectBehavior.Select, - }) - else - fallback() - end - end), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp", group_index = 2 }, - { name = "path", group_index = 2 }, - { name = "buffer", keyword_length = 5, group_index = 2 }, - { name = "luasnip", group_index = 2 }, - { name = "nvim_lua", group_index = 2 }, - }, - } - end, -} diff --git a/.config/nvim/lua/plugins/cmp/utils.lua b/.config/nvim/lua/plugins/cmp/utils.lua deleted file mode 100644 index bf959da..0000000 --- a/.config/nvim/lua/plugins/cmp/utils.lua +++ /dev/null @@ -1,20 +0,0 @@ ----@class CMPUtils -local M = {} - ---- Checks if there are words before cursor ---- @return boolean -function M.has_words_before() - if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" then - return false - end - - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - - return col ~= 0 - and vim.api - .nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1] - :match("^%s*$") - == nil -end - -return M diff --git a/.config/nvim/lua/plugins/indent-blankline.lua b/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..8a3d600 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,73 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + indent = { char = "│", tab_char = "│", highlight = "IblIndent" }, + scope = { + char = "│", + enabled = true, + show_start = false, + show_end = false, + highlight = "IblScope", + }, + }, + config = function(_, opts) + local hooks = require("ibl.hooks") + + ---@param color number + ---@param shift number + ---@return number + local function get_color_component(color, shift) + return bit.band(bit.rshift(color, shift), 0xFF) + end + + ---@param fg number + ---@param bg number + ---@param alpha number + ---@return number? + local function blend_color(fg, bg, alpha) + if not fg or not bg then + return + end + + local function blend(fg_comp, bg_comp) + return math.floor(fg_comp * alpha + bg_comp * (1 - alpha)) + end + + local r = + blend(get_color_component(fg, 16), get_color_component(bg, 16)) + local g = + blend(get_color_component(fg, 8), get_color_component(bg, 8)) + local b = + blend(get_color_component(fg, 0), get_color_component(bg, 0)) + + return bit.bor(bit.lshift(r, 16), bit.lshift(g, 8), b) + end + + hooks.register(hooks.type.ACTIVE, function() + return not vim.tbl_contains({ "markdown", "org" }, vim.bo.filetype) + end) + + -- Setup highlights based on background/foreground colors + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + local normal_hl = vim.api.nvim_get_hl(0, { name = "Normal" }) + local bg = normal_hl.bg or 0 + local fg = normal_hl.fg or 0xFFFFFF + + -- Set indent and scope highlights with different intensities + local highlights = { + { name = "IblIndent", alpha = 0.25 }, + { name = "IblScope", alpha = 0.45 }, + } + + for _, hl in ipairs(highlights) do + vim.api.nvim_set_hl(0, hl.name, { + fg = blend_color(fg, bg, hl.alpha), + nocombine = true, + }) + end + end) + + require("ibl").setup(opts) + end, +} diff --git a/.config/nvim/lua/plugins/lspconfig/lang/eslint.lua b/.config/nvim/lua/plugins/lsp/lang/eslint.lua similarity index 100% rename from .config/nvim/lua/plugins/lspconfig/lang/eslint.lua rename to .config/nvim/lua/plugins/lsp/lang/eslint.lua diff --git a/.config/nvim/lua/plugins/lspconfig/lang/haskell.lua b/.config/nvim/lua/plugins/lsp/lang/haskell.lua similarity index 100% rename from .config/nvim/lua/plugins/lspconfig/lang/haskell.lua rename to .config/nvim/lua/plugins/lsp/lang/haskell.lua diff --git a/.config/nvim/lua/plugins/lspconfig/lang/lua.lua b/.config/nvim/lua/plugins/lsp/lang/lua.lua similarity index 100% rename from .config/nvim/lua/plugins/lspconfig/lang/lua.lua rename to .config/nvim/lua/plugins/lsp/lang/lua.lua diff --git a/.config/nvim/lua/plugins/lspconfig/lang/nix.lua b/.config/nvim/lua/plugins/lsp/lang/nix.lua similarity index 100% rename from .config/nvim/lua/plugins/lspconfig/lang/nix.lua rename to .config/nvim/lua/plugins/lsp/lang/nix.lua diff --git a/.config/nvim/lua/plugins/lspconfig/lang/typescript.lua b/.config/nvim/lua/plugins/lsp/lang/typescript.lua similarity index 100% rename from .config/nvim/lua/plugins/lspconfig/lang/typescript.lua rename to .config/nvim/lua/plugins/lsp/lang/typescript.lua diff --git a/.config/nvim/lua/plugins/lsp/lsp-progress.lua b/.config/nvim/lua/plugins/lsp/lsp-progress.lua new file mode 100644 index 0000000..0d7eb51 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp/lsp-progress.lua @@ -0,0 +1,63 @@ +return { + "linrongbin16/lsp-progress.nvim", + lazy = true, + config = function() + require("lsp-progress").setup({ + client_format = function(client_name, spinner, series_messages) + if #series_messages == 0 then + return nil + end + return { + name = client_name, + body = spinner + .. " " + .. table.concat(series_messages, ", "), + } + end, + + format = function(client_messages) + --- @param name string + --- @param msg string? + --- @return string + local function stringify(name, msg) + return msg and string.format("%s %s", name, msg) or name + end + + local sign = "" + local lsp_clients = vim.lsp.get_active_clients() + local messages_map = {} + + for _, climsg in ipairs(client_messages) do + messages_map[climsg.name] = climsg.body + end + + if #lsp_clients > 0 then + table.sort(lsp_clients, function(a, b) + return a.name < b.name + end) + local builder = {} + for _, cli in ipairs(lsp_clients) do + if + type(cli) == "table" + and type(cli.name) == "string" + and string.len(cli.name) > 0 + then + if messages_map[cli.name] then + table.insert( + builder, + stringify(cli.name, messages_map[cli.name]) + ) + else + table.insert(builder, stringify(cli.name)) + end + end + end + if #builder > 0 then + return sign .. " " .. table.concat(builder, ", ") + end + end + return "" + end, + }) + end, +} diff --git a/.config/nvim/lua/plugins/lspsaga.lua b/.config/nvim/lua/plugins/lsp/lspsaga.lua similarity index 92% rename from .config/nvim/lua/plugins/lspsaga.lua rename to .config/nvim/lua/plugins/lsp/lspsaga.lua index 8e93f85..141e40b 100644 --- a/.config/nvim/lua/plugins/lspsaga.lua +++ b/.config/nvim/lua/plugins/lsp/lspsaga.lua @@ -1,6 +1,10 @@ return { "nvimdev/lspsaga.nvim", event = "LspAttach", + lazy = true, + config = function(_, opts) + return require("lspsaga").setup(opts) + end, dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", diff --git a/.config/nvim/lua/plugins/lsp/nvim-lspconfig.lua b/.config/nvim/lua/plugins/lsp/nvim-lspconfig.lua new file mode 100644 index 0000000..885ba65 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp/nvim-lspconfig.lua @@ -0,0 +1,51 @@ +return { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "nvimdev/lspsaga.nvim", + "saghen/blink.cmp", + }, + config = function() + local capabilities = require("blink.cmp").get_lsp_capabilities() + + -- Simple servers with default config + local simple_servers = { + "bashls", + "dockerls", + "prismals", + "pyright", + } + + -- Servers with custom config + local custom_servers = { + hls = "haskell", + lua_ls = "lua", + nil_ls = "nix", + ts_ls = "typescript", + } + + local lspconfig = require("lspconfig") + local helpers = require("core.helpers") + + -- Setup servers with default config + for _, server in ipairs(simple_servers) do + lspconfig[server].setup({ capabilities = capabilities }) + end + + -- Setup servers with custom config + for server, config_name in pairs(custom_servers) do + local ok, custom_config = + pcall(require, "plugins.lsp.lang." .. config_name) + + if ok then + lspconfig[server].setup( + helpers.merge( + custom_config, + { capabilities = capabilities } + ) + ) + end + end + end, +} diff --git a/.config/nvim/lua/plugins/lspconfig/init.lua b/.config/nvim/lua/plugins/lspconfig/init.lua deleted file mode 100644 index 1576311..0000000 --- a/.config/nvim/lua/plugins/lspconfig/init.lua +++ /dev/null @@ -1,70 +0,0 @@ -return { - "neovim/nvim-lspconfig", -- Collection of configuration for LSP - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "mason.nvim", - { "williamboman/mason-lspconfig.nvim", config = function() end }, - }, - config = function() - local cmp_nvim_lsp = require("cmp_nvim_lsp") - local helpers = require("core.helpers") - local lspconfig = require("lspconfig") - - -- Add additional capabilities supported by nvim-cmp - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = cmp_nvim_lsp - and cmp_nvim_lsp.default_capabilities(capabilities) - or capabilities - - lspconfig.bashls.setup({ - capabilities = capabilities, - }) - - lspconfig.dockerls.setup({ - capabilities = capabilities, - }) - - lspconfig.eslint.setup( - helpers.merge( - require("plugins.lspconfig.lang.eslint"), - { capabilities = capabilities } - ) - ) - - lspconfig.hls.setup( - helpers.merge( - require("plugins.lspconfig.lang.haskell"), - { capabilities = capabilities } - ) - ) - - lspconfig.lua_ls.setup( - helpers.merge( - require("plugins.lspconfig.lang.lua"), - { capabilities = capabilities } - ) - ) - - lspconfig.nil_ls.setup( - helpers.merge( - require("plugins.lspconfig.lang.nix"), - { capabilities = capabilities } - ) - ) - - lspconfig.prismals.setup({ - capabilities = capabilities, - }) - - lspconfig.pyright.setup({ - capabilities = capabilities, - }) - - lspconfig.ts_ls.setup( - helpers.merge( - require("plugins.lspconfig.lang.typescript"), - { capabilities = capabilities } - ) - ) - end, -} diff --git a/.config/nvim/lua/plugins/lspkind/utils.lua b/.config/nvim/lua/plugins/lspkind/utils.lua deleted file mode 100644 index 276dd2e..0000000 --- a/.config/nvim/lua/plugins/lspkind/utils.lua +++ /dev/null @@ -1,61 +0,0 @@ -local ok, lspkind = pcall(require, "lspkind") - -if not ok then - return -end - ---- @alias key string ---- @alias SymbolsMap { [key]: string } --- ---- @class Utils -local M = {} - ---- @type SymbolsMap -local symbols = { - Text = "󰉿", - Method = "󰆧", - Function = "󰊕", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈙", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - TypeParameter = "", -} - ---- Format suggestions and add icons ---- ----@return nil | unknown -function M.add_lspkind_icons() - return lspkind.cmp_format({ - before = function(entry, vim_item) - vim_item.kind = string.format("%s", symbols[vim_item.kind]) - vim_item.menu = ({ - buffer = "[Buffer]", - luasnip = "[Snippet]", - nvim_lsp = "[LSP]", - path = "[path]", - })[entry.source.name] - - return vim_item - end, - }) -end - -return M diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index 8aabfdd..154f3b2 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -1,5 +1,138 @@ return { "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons", opt = true }, - opts = {}, + dependencies = { + { "linrongbin16/lsp-progress.nvim" }, + { "nvim-tree/nvim-web-devicons", opt = true }, + }, + event = { "VimEnter" }, + opts = function() + local lazy_status = require("lazy.status") + + --- From: https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets + --- @param trunc_width number trunctates component when screen width is less then trunc_width + --- @param trunc_len number truncates component to trunc_len number of chars + --- @param hide_width number hides component when window width is smaller then hide_width + --- @param no_ellipsis boolean whether to disable adding '...' at end after truncation + --- return function that can format the component accordingly + local function truncate(trunc_width, trunc_len, hide_width, no_ellipsis) + return function(str) + local win_width = vim.fn.winwidth(0) + if hide_width and win_width < hide_width then + return "" + elseif + trunc_width + and trunc_len + and win_width < trunc_width + and #str > trunc_len + then + return str:sub(1, trunc_len) + .. (no_ellipsis and "" or "…") + end + return str + end + end + + return { + options = { + component_separators = { left = "╲", right = "╱" }, + section_separators = { left = "", right = "" }, + globalstatus = true, + }, + sections = { + lualine_a = { + { + "mode", + fmt = truncate(130, 3, 0, true), + }, + }, + lualine_b = { + { + "branch", + fmt = truncate(70, 15, 65, true), + separator = "", + }, + + { + "diff", + symbols = { + added = " ", + modified = " ", + removed = " ", + }, + fmt = truncate(0, 0, 60, true), + }, + { + "diagnostics", + symbols = { + error = " ", + warn = " ", + info = " ", + hint = " ", + }, + }, + }, + lualine_c = { + "filename", + function() + return require("lsp-progress").progress() + end, + }, + lualine_x = { + { + function() + return "recording @" .. vim.fn.reg_recording() + end, + cond = function() + return vim.fn.reg_recording() ~= "" + end, + color = { fg = "Search" }, + separator = "", + }, + { + lazy_status.updates, + cond = lazy_status.has_updates, + fmt = truncate(0, 0, 160, true), + separator = "", + }, + { + "encoding", + fmt = truncate(0, 0, 140, true), + }, + { + "fileformat", + fmt = truncate(0, 0, 140, true), + }, + { "filetype" }, + }, + lualine_y = { + { "progress", fmt = truncate(0, 0, 40, true) }, + }, + lualine_z = { + { "location", fmt = truncate(0, 0, 80, true) }, + }, + }, + inactive_sections = { + lualine_c = { + { + "pretty_path", + -- 'filename', + symbols = { + modified = "+", -- Text to show when the file is modified. + readonly = "", -- Text to show when the file is non-modifiable or readonly. + }, + }, + }, + }, + } + end, + config = function(_, opts) + require("lualine").setup(opts) + + vim.api.nvim_create_augroup("lualine_augroup", { clear = true }) + vim.api.nvim_create_autocmd("User", { + group = "lualine_augroup", + pattern = "LspProgressStatusUpdated", + callback = require("lualine").refresh, + }) + end, } diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua index 5323470..f42a257 100644 --- a/.config/nvim/lua/plugins/luasnip.lua +++ b/.config/nvim/lua/plugins/luasnip.lua @@ -1,7 +1,9 @@ return { - "saadparwaiz1/cmp_luasnip", { "L3MON4D3/LuaSnip", - opts = { history = true, delete_check_events = "TextChanged" }, + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", }, } diff --git a/.config/nvim/lua/plugins/mason-lspconfig.lua b/.config/nvim/lua/plugins/mason-lspconfig.lua index cd34e65..d40d3f2 100644 --- a/.config/nvim/lua/plugins/mason-lspconfig.lua +++ b/.config/nvim/lua/plugins/mason-lspconfig.lua @@ -1,4 +1,5 @@ return { "williamboman/mason-lspconfig.nvim", dependencies = "williamboman/mason.nvim", + lazy = true, } diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua index c7e6cea..81545ae 100644 --- a/.config/nvim/lua/plugins/mason.lua +++ b/.config/nvim/lua/plugins/mason.lua @@ -9,4 +9,5 @@ return { }, }, }, + lazy = true, } diff --git a/.config/nvim/lua/plugins/nightfox/utils.lua b/.config/nvim/lua/plugins/nightfox/utils.lua index 6ddaa7a..4ceacbf 100644 --- a/.config/nvim/lua/plugins/nightfox/utils.lua +++ b/.config/nvim/lua/plugins/nightfox/utils.lua @@ -1,10 +1,9 @@ ----@alias ThemeOptions { dark_theme: string, default_theme: string, light_theme: string, themes: string[] } - ---@class EditorTheme ----@field dark_theme string default dark theme ----@field default_theme string default them ----@field light_theme string default light theme ----@field themes string[] full list of themes +---@field dark_theme string Default dark theme +---@field default_theme string Default theme +---@field light_theme string Default light theme +---@field themes string[] Available themes +---@field theme_index table Lookup table for theme positions local M = { dark_theme = "nordfox", default_theme = "nordfox", @@ -18,70 +17,65 @@ local M = { "terafox", "carbonfox", }, + -- Pre-compute theme indices for O(1) lookup + theme_index = {}, } ---- Sets up the default, dark and light themes, and the list of available themes we want ---- to toggle between. ----@param self EditorTheme ----@param options? ThemeOptions -function M.setup(self, options) - for k, v in pairs(options or {}) do - self[k] = v - end - - -- set default theme - self.set_theme(self.default_theme) +-- Initialize theme index table +for i, theme in ipairs(M.themes) do + M.theme_index[theme] = i end --- Safely set theme with error handling ---@param theme string function M.set_theme(theme) - ---@diagnostic disable-next-line: param-type-mismatch - local ok, _ = pcall(vim.cmd, "colorscheme " .. theme) + local ok = pcall(vim.cmd.colorscheme, theme) - if ok then - vim.notify_once("Theme set to: " .. theme, vim.log.levels.INFO) - else - vim.notify_once("Theme not found: " .. theme, vim.log.levels.ERROR) - end + vim.notify_once( + ok and ("Theme set to: " .. theme) or ("Theme not found: " .. theme), + ok and vim.log.levels.INFO or vim.log.levels.ERROR + ) end ---- Toggle between themes ---- @param self EditorTheme -function M.toggle_themes(self) - local current_theme = vim.api.nvim_get_var("colors_name") - local next_theme = "" - local length = 0 - local position = 0 +--- Set up theme configuration +---@param self EditorTheme +---@param options? { dark_theme?: string, default_theme?: string, light_theme?: string, themes?: string[] } +function M.setup(self, options) + if options then + for k, v in pairs(options) do + self[k] = v + end - -- Find current theme in themes table - -- unfortunately no built in way to do this withour iterating - for i, theme in ipairs(self.themes) do - length = length + 1 - if theme == current_theme then - position = i + -- Rebuild theme index if themes were updated + if options.themes then + self.theme_index = {} + + for i, theme in ipairs(self.themes) do + self.theme_index[theme] = i + end end end - if position >= 1 and position ~= length then - next_theme = self.themes[position + 1] - else - next_theme = self.themes[1] - end + self.set_theme(self.default_theme) +end + +--- Toggle between themes +---@param self EditorTheme +function M.toggle_themes(self) + local current_theme = vim.g.colors_name + local current_pos = self.theme_index[current_theme] or 0 + local next_theme = self.themes[current_pos + 1] or self.themes[1] self.set_theme(next_theme) end --- Toggle between light and dark theme ---- @param self EditorTheme +---@param self EditorTheme function M.toggle_lightning(self) - local current_theme = vim.api.nvim_get_var("colors_name") - - if current_theme == self.dark_theme then - self.set_theme(self.light_theme) - else - self.set_theme(self.dark_theme) - end + self.set_theme( + vim.g.colors_name == self.dark_theme and self.light_theme + or self.dark_theme + ) end return M diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua deleted file mode 100644 index ee04736..0000000 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - "nvim-tree/nvim-tree.lua", - event = "LspAttach", - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons", - }, - keys = { - { "ee", ":NvimTreeToggle", desc = "Toggle NvimTr[e][e]" }, - }, - opts = { diagnostics = { enable = true } }, -} diff --git a/.config/nvim/lua/plugins/oil-nvim.lua b/.config/nvim/lua/plugins/oil-nvim.lua new file mode 100644 index 0000000..b139f37 --- /dev/null +++ b/.config/nvim/lua/plugins/oil-nvim.lua @@ -0,0 +1,36 @@ +return { + "stevearc/oil.nvim", + keys = { + { + "", + function() + require("oil").toggle_float() + end, + desc = "Oil", + }, + }, + ---@module 'oil' + ---@type oil.SetupOpts + opts = { + default_file_explorer = true, + delete_to_trash = true, + skip_confirm_for_simple_edits = false, + view_options = { + show_hidden = true, + natural_order = true, + is_always_hidden = function(name, _) + return name == ".." or name == ".git" + end, + }, + float = { + padding = 2, + max_width = 90, + max_height = 0, + }, + win_options = { + wrap = true, + winblend = 0, + }, + }, + dependencies = { "nvim-tree/nvim-web-devicons" }, +} diff --git a/.config/nvim/lua/plugins/org/org-bullets.lua b/.config/nvim/lua/plugins/org/org-bullets.lua new file mode 100644 index 0000000..556ce5c --- /dev/null +++ b/.config/nvim/lua/plugins/org/org-bullets.lua @@ -0,0 +1,7 @@ +return { + "akinsho/org-bullets.nvim", + opts = {}, + -- config = function() + -- return require("org-bullets").setup() + -- end, +} diff --git a/.config/nvim/lua/plugins/org/org-roam.lua b/.config/nvim/lua/plugins/org/org-roam.lua new file mode 100644 index 0000000..36bd90f --- /dev/null +++ b/.config/nvim/lua/plugins/org/org-roam.lua @@ -0,0 +1,15 @@ +return { + "chipsenkbeil/org-roam.nvim", + tag = "0.1.1", + dependencies = { + { + "nvim-orgmode/orgmode", + tag = "0.3.7", + }, + }, + config = function() + require("org-roam").setup({ + directory = "~/orgfiles/org_roam_files", + }) + end, +} diff --git a/.config/nvim/lua/plugins/org/orgmode.lua b/.config/nvim/lua/plugins/org/orgmode.lua new file mode 100644 index 0000000..1939707 --- /dev/null +++ b/.config/nvim/lua/plugins/org/orgmode.lua @@ -0,0 +1,13 @@ +return { + "nvim-orgmode/orgmode", + event = "VeryLazy", + ft = { "org" }, + config = function() + require("orgmode").setup({ + org_agenda_files = "~/orgfiles/**/*", + mappings = { + org_return_uses_meta_return = true, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/render-markdown-nvim.lua b/.config/nvim/lua/plugins/render-markdown-nvim.lua index 0dfd539..a86fc70 100644 --- a/.config/nvim/lua/plugins/render-markdown-nvim.lua +++ b/.config/nvim/lua/plugins/render-markdown-nvim.lua @@ -4,5 +4,8 @@ return { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", }, - opts = {}, + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, } diff --git a/.config/nvim/lua/plugins/sniprun.lua b/.config/nvim/lua/plugins/sniprun.lua new file mode 100644 index 0000000..dda9602 --- /dev/null +++ b/.config/nvim/lua/plugins/sniprun.lua @@ -0,0 +1,19 @@ +return { + "michaelb/sniprun", + branch = "master", + + build = "sh install.sh", + -- do 'sh install.sh 1' if you want to force compile locally + -- (instead of fetching a binary from the github release). Requires Rust >= 1.65 + + config = function() + local helpers = require("core.helpers") + + require("sniprun").setup({ + -- your options + }) + + helpers.vmap("r", "SnipRun", "[r]un code") + helpers.nmap("r", "SnipRun", "[r]un code") + end, +} diff --git a/.config/nvim/lua/plugins/statuscol-nvim.lua b/.config/nvim/lua/plugins/statuscol-nvim.lua new file mode 100644 index 0000000..26c4317 --- /dev/null +++ b/.config/nvim/lua/plugins/statuscol-nvim.lua @@ -0,0 +1,72 @@ +return { + "luukvbaal/statuscol.nvim", + config = function() + local builtin = require("statuscol.builtin") + + -- Configure fold appearance + vim.api.nvim_set_hl(0, "FoldSeparator", { fg = "NONE", bg = "NONE" }) + vim.api.nvim_set_hl(0, "Folded", {}) + vim.api.nvim_set_hl(0, "FoldColumn", { link = "FoldSeparator" }) + + vim.opt.fillchars:append({ + foldopen = "", + foldclose = "", + foldsep = " ", + diff = "│", + eob = " ", + }) + + -- Common sign column settings + local sign_config = { + maxwidth = 1, + colwidth = 2, + auto = true, + fillcharhl = "LineNr", + } + + require("statuscol").setup({ + relculright = true, + foldfunc = "builtin", + setopt = true, + segments = { + -- Diagnostic signs + { + sign = vim.tbl_extend("force", sign_config, { + namespace = { "diagnostic" }, + fillchar = " ", + }), + click = "v:lua.ScSa", + }, + + -- Git signs + { + sign = vim.tbl_extend("force", sign_config, { + namespace = { "gitsigns" }, + }), + click = "v:lua.ScSa", + }, + + -- Fold column + { + text = { builtin.foldfunc }, + click = "v:lua.ScFa", + condition = { builtin.not_empty }, + }, + + -- Line numbers + { + text = { + function(args) + return string.format( + " %s ", + builtin.lnumfunc(args) + ) + end, + }, + click = "v:lua.ScLa", + hl = "LineNr", + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/treesitter/init.lua b/.config/nvim/lua/plugins/treesitter/init.lua index 0ca478e..9a4e085 100644 --- a/.config/nvim/lua/plugins/treesitter/init.lua +++ b/.config/nvim/lua/plugins/treesitter/init.lua @@ -11,10 +11,14 @@ return { parser_install_dir = nil, -- A list of parser names, or "all" ensure_installed = { + "bash", "c", "haskell", "lua", + "markdown", + "markdown_inline", "python", + "regex", "rust", "sql", "typescript", @@ -45,16 +49,17 @@ return { enable = true, disable = { "python" }, }, - incremental_selection = { - enable = true, - keymaps = { - -- mappings for incremental selection (visual mappings) - init_selection = "", - node_incremental = "", - scope_incremental = "", - node_decremental = "", - }, - }, + -- TODO: rethink these shortcust to not conflict with orgmode + -- incremental_selection = { + -- enable = true, + -- keymaps = { + -- -- mappings for incremental selection (visual mappings) + -- init_selection = "", + -- node_incremental = "", + -- scope_incremental = "", + -- node_decremental = "", + -- }, + -- }, install = { compilers = { "clang" }, }, diff --git a/.config/nvim/lua/plugins/treesitter/settings.lua b/.config/nvim/lua/plugins/treesitter/settings.lua index 9bd316d..7c6b5f6 100644 --- a/.config/nvim/lua/plugins/treesitter/settings.lua +++ b/.config/nvim/lua/plugins/treesitter/settings.lua @@ -1,3 +1,4 @@ +vim.opt.foldcolumn = "1" vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldlevelstart = 99 diff --git a/.config/posix-shell/environments b/.config/posix-shell/environments index a3c2625..11c536d 100644 --- a/.config/posix-shell/environments +++ b/.config/posix-shell/environments @@ -1,9 +1,9 @@ -FNM_PATH=`which fnm` +FNM_PATH=$(which fnm) GHCUP_ENV=$HOME/.ghcup/env NIX_PROFILE=$HOME/.nix-profile/etc/profile.d/nix.sh -NVIM_PATH=`which nvim` -PYENV_PATH=`which pyenv` -QT5CT_PATH=`which qt5ct` +NVIM_PATH=$(which nvim) +PYENV_PATH=$(which pyenv) +QT5CT_PATH=$(which qt5ct) if [[ -x $FNM_PATH ]]; then eval "$(fnm env --use-on-cd)" @@ -61,6 +61,6 @@ export XDG_RUNTIME_DIR="/run/user/$UID" export ACKRC="$XDG_CONFIG_HOME/ack/ackrc" export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" -export TERM=xterm-256color +export TERM="screen-256color" # vim: set ft=sh: diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 8559d5c..a9134d5 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -24,6 +24,8 @@ bind-key -n C-L send-keys -R bind-key -n C-l send-keys -R set -g default-terminal "screen-256color" +set-option -sg escape-time 10 +set-option -g focus-events on # Setup dawnfox theme