diff --git a/tree/.config/nvim/init.lua b/tree/.config/nvim/init.lua index 408809f..4ef3043 100644 --- a/tree/.config/nvim/init.lua +++ b/tree/.config/nvim/init.lua @@ -5,60 +5,67 @@ vim.g.localleader = "\\" -- Install Lazy 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 - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + 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 + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) -- TODO: get colored renders working vim.g.rustaceanvim = { - -- Plugin configuration - tools = {}, + -- Plugin configuration + tools = { + float_win_config = { border = 'rounded' }, + }, - -- LSP configuration - server = { - on_attach = function(client, bufnr) - vim.keymap.set('n', 'lg', pick_rust_target, - { desc = "Pick Target (Rust)", buffer = bufnr }) - vim.keymap.set('n', "a", function() vim.cmd.RustLsp('codeAction') end, - { desc = "Code Action (Rust)", buffer = bufnr }) - vim.keymap.set('n', "e", function() vim.cmd.RustLsp('renderDiagnostic', 'current') end, - { desc = "Render Diagnostic", buffer = bufnr }) - end, - default_settings = { - ['rust-analyzer'] = { - checkOnSave = { overrideCommand = "cargo check --message-format=json-diagnostic-rendered-ansi" }, - }, - }, - settings = function(project_root) - local ra = require('rustaceanvim.config.server') - local settings = ra.load_rust_analyzer_settings(project_root, { - settings_file_pattern = 'rust-analyzer.json' - }) + -- LSP configuration + server = { + on_attach = function(client, bufnr) + vim.keymap.set('n', 'lg', pick_rust_target, + { desc = "Pick Target (Rust)", buffer = bufnr }) + vim.keymap.set('n', "a", function() vim.cmd.RustLsp('codeAction') end, + { desc = "Code Action (Rust)", buffer = bufnr }) + vim.keymap.set('n', "e", function() vim.cmd.RustLsp('renderDiagnostic', 'current') end, + { desc = "Render Diagnostic", buffer = bufnr }) + end, + default_settings = { + ['rust-analyzer'] = { + checkOnSave = true, + check = { + overrideCommand = { + "cargo", "check", "--message-format=json-diagnostic-rendered-ansi", + } + }, + }, + }, + settings = function(project_root) + local ra = require('rustaceanvim.config.server') + local settings = ra.load_rust_analyzer_settings(project_root, { + settings_file_pattern = 'rust-analyzer.json' + }) - -- override default target (if `set_rust_target` has been called) - local rust_target = vim.g["rust-analyzer-target"] - if rust_target then - settings["rust-analyzer"]["cargo"] = { target = rust_target } - end + -- override default target (if `set_rust_target` has been called) + local rust_target = vim.g["rust-analyzer-target"] + if rust_target then + settings["rust-analyzer"]["cargo"] = { target = rust_target } + end - vim.g["rust-analyzer-target-test"] = settings + vim.g["rust-analyzer-target-test"] = settings - return settings - end, - }, + return settings + end, + }, - -- DAP configuration - dap = {}, + -- DAP configuration + dap = {}, } @@ -82,116 +89,125 @@ local language_servers = { "wgsl_analyzer", } require("mason").setup({ - ui = { - icons = { - package_installed = "", - package_pending = "", - package_uninstalled = "", - }, - }, - ensure_installed = language_servers, + ui = { + icons = { + package_installed = "", + package_pending = "", + package_uninstalled = "", + }, + }, + ensure_installed = language_servers, }) -require("mason-lspconfig").setup() +require("mason-lspconfig").setup { + automatic_enable = { + exclude = { + -- rust_analyzer is managed by rustaceanvim + "rust_analyzer", + } + } +} local lspconfig = require("lspconfig") -for _,l in pairs(language_servers) do +for _, l in pairs(language_servers) do lspconfig[l].setup {} end +require('dapui').setup(); + local compare = require "cmp.config.compare" require('cmp').setup.filetype({ "rust" }, { - sorting = { - priority_weight = 2, - comparators = { - -- deprioritize `.box`, `.mut`, etc. - require("cmp-rust").deprioritize_postfix, - -- deprioritize `Borrow::borrow` and `BorrowMut::borrow_mut` - require("cmp-rust").deprioritize_borrow, - -- deprioritize `Deref::deref` and `DerefMut::deref_mut` - require("cmp-rust").deprioritize_deref, - -- deprioritize `Into::into`, `Clone::clone`, etc. - require("cmp-rust").deprioritize_common_traits, - compare.offset, - compare.exact, - compare.score, - --compare.recently_used, - compare.locality, - compare.sort_text, - compare.length, - compare.order, - }, - }, + sorting = { + priority_weight = 2, + comparators = { + -- deprioritize `.box`, `.mut`, etc. + require("cmp-rust").deprioritize_postfix, + -- deprioritize `Borrow::borrow` and `BorrowMut::borrow_mut` + require("cmp-rust").deprioritize_borrow, + -- deprioritize `Deref::deref` and `DerefMut::deref_mut` + require("cmp-rust").deprioritize_deref, + -- deprioritize `Into::into`, `Clone::clone`, etc. + require("cmp-rust").deprioritize_common_traits, + compare.offset, + compare.exact, + compare.score, + --compare.recently_used, + compare.locality, + compare.sort_text, + compare.length, + compare.order, + }, + }, }) -- Format file on save vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] -- Completion Plugin Setup -local cmp = require'cmp' +local cmp = require 'cmp' cmp.setup({ - -- Enable LSP snippets - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - -- Add tab support - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }) - }, - -- Installed sources: - sources = { - { name = 'path' }, -- file paths - { name = 'nvim_lsp', keyword_length = 3 }, -- from language server - { name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized - { name = 'nvim_lua', keyword_length = 2 }, -- complete neovim's Lua runtime API such vim.lsp.* - { name = 'buffer', keyword_length = 2 }, -- source current buffer - { name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip - { name = 'calc'}, -- source for math calculation - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - fields = {'menu', 'abbr', 'kind'}, - format = function(entry, item) - local menu_icon ={ - nvim_lsp = 'λ', - vsnip = '⋗', - buffer = 'Ω', - path = '🖫', - } - item.menu = menu_icon[entry.source.name] - return item - end, - }, + -- Enable LSP snippets + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + -- Add tab support + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }) + }, + -- Installed sources: + sources = { + { name = 'path' }, -- file paths + { name = 'nvim_lsp', keyword_length = 3 }, -- from language server + { name = 'nvim_lsp_signature_help' }, -- display function signatures with current parameter emphasized + { name = 'nvim_lua', keyword_length = 2 }, -- complete neovim's Lua runtime API such vim.lsp.* + { name = 'buffer', keyword_length = 2 }, -- source current buffer + { name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip + { name = 'calc' }, -- source for math calculation + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + formatting = { + fields = { 'menu', 'abbr', 'kind' }, + format = function(entry, item) + local menu_icon = { + nvim_lsp = 'λ', + vsnip = '⋗', + buffer = 'Ω', + path = '🖫', + } + item.menu = menu_icon[entry.source.name] + return item + end, + }, }) --- Treesitter Plugin Setup +-- Treesitter Plugin Setup require('nvim-treesitter.configs').setup { - ensure_installed = { "lua", "rust", "toml" }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting=false, - }, - ident = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - } + ensure_installed = { "lua", "rust", "toml" }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + ident = { enable = true }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = nil, + } } diff --git a/tree/.config/nvim/lua/debugger.lua b/tree/.config/nvim/lua/debugger.lua index 7b7c072..0ba322f 100644 --- a/tree/.config/nvim/lua/debugger.lua +++ b/tree/.config/nvim/lua/debugger.lua @@ -4,115 +4,115 @@ local codelldb_bin = "/usr/bin/codelldb" -- Rust, C++, C dap.adapters.codelldb = { - type = 'server', - port = "${port}", - executable = { - command = codelldb_bin, - args = {"--port", "${port}"}, - } + type = 'server', + port = "${port}", + executable = { + command = codelldb_bin, + args = { "--port", "${port}" }, + } } local function get_default_rust_program_path() - local workspace = vim.fn.getcwd() - local program_name = vim.fn.fnamemodify(workspace, ":t") - return workspace .. '/target/debug/' .. program_name + local workspace = vim.fn.getcwd() + local program_name = vim.fn.fnamemodify(workspace, ":t") + return workspace .. '/target/debug/' .. program_name end dap.configurations.cpp = { - { - port = 1234, - host = '127.0.0.1', - name = "Attach to name", - type = "codelldb", - request = "attach", - pid = function() - -- Lets user enter the name of a running process instead of looking up the pid themselves - local name = vim.fn.input('Enter pidof name: ') - local handle = io.popen("pidof " .. name) - local pid = handle:read("*a") - handle:close() + { + port = 1234, + host = '127.0.0.1', + name = "Attach to name", + type = "codelldb", + request = "attach", + pid = function() + -- Lets user enter the name of a running process instead of looking up the pid themselves + local name = vim.fn.input('Enter pidof name: ') + local handle = io.popen("pidof " .. name) + local pid = handle:read("*a") + handle:close() - -- Trim the result - pid = pid:match( "^%s*(.-)%s*$" ) - return pid - end, - stopOnEntry = true, - }, - { - port = 1234, - host = '127.0.0.1', - name = "Attach to PID", - type = "codelldb", - request = "attach", - pid = function() - return tonumber(vim.fn.input('Enter PID: ')) - end, - stopOnEntry = true, - }, - { - port = 1234, - host = '127.0.0.1', - name = "Manually launch file", - type = "codelldb", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}', - stopOnEntry = true, - }, - { - -- To debug programs that need to run as root you can run a remote lldb-server as root - -- sudo lldb-server platform --server --listen '*:1234' - name = "Remote attach to name", - type = "codelldb", - request = "attach", - pid = function() - -- Lets user enter the name of a running process instead of looking up the pid themselves - local name = vim.fn.input('Enter pidof name: ') - local handle = io.popen("pidof " .. name) - local pid = handle:read("*a") - handle:close() + -- Trim the result + pid = pid:match("^%s*(.-)%s*$") + return pid + end, + stopOnEntry = true, + }, + { + port = 1234, + host = '127.0.0.1', + name = "Attach to PID", + type = "codelldb", + request = "attach", + pid = function() + return tonumber(vim.fn.input('Enter PID: ')) + end, + stopOnEntry = true, + }, + { + port = 1234, + host = '127.0.0.1', + name = "Manually launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = true, + }, + { + -- To debug programs that need to run as root you can run a remote lldb-server as root + -- sudo lldb-server platform --server --listen '*:1234' + name = "Remote attach to name", + type = "codelldb", + request = "attach", + pid = function() + -- Lets user enter the name of a running process instead of looking up the pid themselves + local name = vim.fn.input('Enter pidof name: ') + local handle = io.popen("pidof " .. name) + local pid = handle:read("*a") + handle:close() - -- Trim the result - pid = pid:match( "^%s*(.-)%s*$" ) - return pid - end, - initCommands = { - "platform select remote-linux", - "platform connect connect://127.0.0.1:1234", - "settings set target.inherit-env false", - }, - }, - { - -- To debug programs that need to run as root you can run a remote lldb-server as root - -- sudo lldb-server platform --server --listen '*:1234' - name = "Remote launch", - type = "codelldb", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - initCommands = { - "platform select remote-linux", - "platform connect connect://127.0.0.1:1234", - "settings set target.inherit-env false", - }, - }, + -- Trim the result + pid = pid:match("^%s*(.-)%s*$") + return pid + end, + initCommands = { + "platform select remote-linux", + "platform connect connect://127.0.0.1:1234", + "settings set target.inherit-env false", + }, + }, + { + -- To debug programs that need to run as root you can run a remote lldb-server as root + -- sudo lldb-server platform --server --listen '*:1234' + name = "Remote launch", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + initCommands = { + "platform select remote-linux", + "platform connect connect://127.0.0.1:1234", + "settings set target.inherit-env false", + }, + }, } dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp -- Insert this config as a rust specific one before the C++ configs table.insert(dap.configurations.rust, 1, { - port = 1234, - host = '127.0.0.1', - name = "Launch Default Rust Program", - type = "codelldb", - request = "launch", - program = get_default_rust_program_path, - cwd = '${workspaceFolder}', - stopOnEntry = true, + port = 1234, + host = '127.0.0.1', + name = "Launch Default Rust Program", + type = "codelldb", + request = "launch", + program = get_default_rust_program_path, + cwd = '${workspaceFolder}', + stopOnEntry = true, }) -- Python diff --git a/tree/.config/nvim/lua/keys.lua b/tree/.config/nvim/lua/keys.lua index 88794c8..63fa99d 100644 --- a/tree/.config/nvim/lua/keys.lua +++ b/tree/.config/nvim/lua/keys.lua @@ -1,47 +1,132 @@ local telescope = require('telescope.builtin') local wk = require('which-key') +local harpoon = require("harpoon") +local telescope_conf = require("telescope.config").values +harpoon:setup() vim.keymap.set('n', 'f', telescope.find_files, { desc = "File picker" }) vim.keymap.set('n', 'g', telescope.live_grep, { desc = "Grep recursively" }) vim.keymap.set('n', 'b', telescope.buffers, { desc = "Buffer picker" }) vim.keymap.set('n', '?', telescope.help_tags, { desc = "Help tags picker" }) vim.keymap.set('n', 's', telescope.treesitter, { desc = "Treesitter symbol picker" }) +vim.keymap.set('n', 'j', telescope.jumplist, { desc = "Jumplist" }) vim.keymap.set('n', 'u', ":TodoTelescope", { desc = "Grep for TODOs" }) vim.keymap.set('n', 'U', ":redo", {}) vim.keymap.set('n', 'p', ":b#", { desc = "Go to last buffer" }) + + +local function toggle_telescope(harpoon_files) + local displayer = require("telescope.pickers.entry_display").create({ + separator = " | ", + items = { + --{ width = 0.1 }, + { width = 0.9 }, + } + }) + + local harpoons = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(harpoons, { + filepath = item.value, + col = item.context.col, + row = item.context.row, + }) + end + + require("telescope.pickers").new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = harpoons, + entry_maker = function(entry) + --vim.print("mapping entry") + --vim.print(entry) + local filepath_with_row = string.format("%s:%d", entry.filepath, entry.row) + return { + -- Value to display. Required. type=any + --value = { "foo", entry.filepath, }, + value = entry, + + -- Whether to display the entry. Optional. type=bool + valid = true, + + -- Optional. type=string|function + --display = entry.filepath, + display = function(entry) + return displayer({ + -- NOTE: the number of elements must match the + -- configuration passed to `displayer` above + --{ "foobar" }, + { filepath_with_row } + }) + end, + + -- Used for filtering. Optional. type=string + ordinal = filepath_with_row, + + -- File to open when pressing enter. Optional. type=string + filename = entry.filepath, + + -- Buffer to open when pressing enter. Optional. type=number + -- bufnr = 0, + + -- Line number of file/buffer to open. Optional. type=number + lnum = entry.row, + + -- Line number of file/buffer to open. Optional. type=number + col = entry.row, + } + end + }), + previewer = telescope_conf.grep_previewer({}), + sorter = telescope_conf.generic_sorter({}), + }):find() +end +vim.keymap.set("n", "h", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window" }) +vim.keymap.set("n", "H", function() harpoon:list():add() end, + { desc = "Launch harpoon" }) +-- Toggle previous & next buffers stored within Harpoon list +--vim.keymap.set("n", "", function() harpoon:list():prev() end) +--vim.keymap.set("n", "", function() harpoon:list():next() end) + + -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - vim.keymap.set('n', 'ld', telescope.lsp_definitions, { desc = "Show definitons", buffer = ev.buf }) - vim.keymap.set('n', 'lr', telescope.lsp_references, { desc = "Show references", buffer = ev.buf }) - vim.keymap.set('n', 'li', telescope.lsp_implementations, { desc = "Show implementations", buffer = ev.buf }) - vim.keymap.set('n', 'lt', telescope.lsp_type_definitions, { desc = "Show type definitions", buffer = ev.buf }) - vim.keymap.set('n', 'le', telescope.diagnostics, { desc = "Show diagnostics", buffer = ev.buf }) - vim.keymap.set('n', 'ls', telescope.lsp_workspace_symbols, { desc = "Show workspace symbols", buffer = ev.buf }) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = ev.buf }) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, { buffer = ev.buf }) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, { desc = "Add workspace folder", buffer = ev.buf }) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, { desc = "Remove workspace folder", buffer = ev.buf }) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, { desc = "List workspace folders", buffer = ev.buf }) - vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = "Rename symbol", buffer = ev.buf }) - vim.keymap.set('n', "a", vim.lsp.buf.code_action, { desc = "Code Action", buffer = ev.buf }) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.keymap.set('n', 'ld', telescope.lsp_definitions, { desc = "Show definitons", buffer = ev.buf }) + vim.keymap.set('n', 'lr', telescope.lsp_references, { desc = "Show references", buffer = ev.buf }) + vim.keymap.set('n', 'li', telescope.lsp_implementations, + { desc = "Show implementations", buffer = ev.buf }) + vim.keymap.set('n', 'lt', telescope.lsp_type_definitions, + { desc = "Show type definitions", buffer = ev.buf }) + vim.keymap.set('n', 'le', telescope.diagnostics, { desc = "Show diagnostics", buffer = ev.buf }) + vim.keymap.set('n', 'ls', telescope.lsp_workspace_symbols, + { desc = "Show workspace symbols", buffer = ev.buf }) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = ev.buf }) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, { buffer = ev.buf }) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, + { desc = "Add workspace folder", buffer = ev.buf }) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, + { desc = "Remove workspace folder", buffer = ev.buf }) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, { desc = "List workspace folders", buffer = ev.buf }) + vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = "Rename symbol", buffer = ev.buf }) + vim.keymap.set('n', "a", vim.lsp.buf.code_action, { desc = "Code Action", buffer = ev.buf }) - wk.add({ - { "l", desc = "Language server stuff" }, - { "w", desc = "Workspace stuff" }, - }) - - end, + wk.add({ + { "l", desc = "Language server stuff" }, + { "w", desc = "Workspace stuff" }, + }) + end, }) --local rust_tools = require("rust-tools") diff --git a/tree/.config/nvim/lua/lazy.lua b/tree/.config/nvim/lua/lazy.lua index 272c178..5c3d3e4 100644 --- a/tree/.config/nvim/lua/lazy.lua +++ b/tree/.config/nvim/lua/lazy.lua @@ -1,16 +1,16 @@ -- Bootstrap lazy.nvim 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 - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + 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 + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) diff --git a/tree/.config/nvim/lua/opts.lua b/tree/.config/nvim/lua/opts.lua index 9b3418c..2b45321 100644 --- a/tree/.config/nvim/lua/opts.lua +++ b/tree/.config/nvim/lua/opts.lua @@ -1,40 +1,40 @@ local opt = vim.opt -- Use system clipboard -vim.opt.clipboard="unnamedplus" +vim.opt.clipboard = "unnamedplus" -- [[ Context ]] -opt.colorcolumn = '100' -- str: Show col for max line length -opt.number = true -- bool: Show line numbers -opt.relativenumber = true -- bool: Show relative line numbers -opt.scrolloff = 10 -- int: Min num lines of context -opt.signcolumn = "yes" -- str: Show the sign column +opt.colorcolumn = '100' -- str: Show col for max line length +opt.number = true -- bool: Show line numbers +opt.relativenumber = true -- bool: Show relative line numbers +opt.scrolloff = 10 -- int: Min num lines of context +opt.signcolumn = "yes" -- str: Show the sign column -- [[ Filetypes ]] -opt.encoding = 'utf8' -- str: String encoding to use +opt.encoding = 'utf8' -- str: String encoding to use -- opt.fileencoding = 'utf8' -- str: File encoding to use -vim.filetype.add({extension = {wgsl = "wgsl"}}) +vim.filetype.add({ extension = { wgsl = "wgsl" } }) -- [[ Theme ]] -opt.syntax = "ON" -- str: Allow syntax highlighting -opt.termguicolors = true -- bool: If term supports ui color then enable +opt.syntax = "ON" -- str: Allow syntax highlighting +opt.termguicolors = true -- bool: If term supports ui color then enable -- [[ Search ]] -opt.ignorecase = true -- bool: Ignore case in search patterns -opt.smartcase = true -- bool: Override ignorecase if search contains capitals -opt.incsearch = true -- bool: Use incremental search -opt.hlsearch = false -- bool: Highlight search matches +opt.ignorecase = true -- bool: Ignore case in search patterns +opt.smartcase = true -- bool: Override ignorecase if search contains capitals +opt.incsearch = true -- bool: Use incremental search +opt.hlsearch = false -- bool: Highlight search matches -- [[ Whitespace ]] -- opt.expandtab = true -- bool: Use spaces instead of tabs -opt.shiftwidth = 4 -- num: Size of an indent -opt.softtabstop = 4 -- num: Number of spaces tabs count for in insert mode -opt.tabstop = 4 -- num: Number of spaces tabs count for -opt.list = true -- show some whitespace +opt.shiftwidth = 4 -- num: Size of an indent +opt.softtabstop = 4 -- num: Number of spaces tabs count for in insert mode +opt.tabstop = 4 -- num: Number of spaces tabs count for +opt.list = true -- show some whitespace -- [[ Splits ]] -opt.splitright = true -- bool: Place new window to right of current one -opt.splitbelow = true -- bool: Place new window below the current one +opt.splitright = true -- bool: Place new window to right of current one +opt.splitbelow = true -- bool: Place new window below the current one --Set completeopt to have a better completion experience -- :help completeopt @@ -43,11 +43,10 @@ opt.splitbelow = true -- bool: Place new window below the current one -- noselect: Do not select, force to select one from the menu -- shortness: avoid showing extra messages when using completion -- updatetime: set updatetime for CursorHold -vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'} -vim.opt.shortmess = vim.opt.shortmess + { c = true} +vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' } +vim.opt.shortmess = vim.opt.shortmess + { c = true } vim.api.nvim_set_option('updatetime', 300) -- Uncomment to enable treesitter folding by default --vim.wo.foldmethod = 'expr' --vim.wo.foldexpr = 'nvim_treesitter#foldexpr()' - diff --git a/tree/.config/nvim/lua/plugins.lua b/tree/.config/nvim/lua/plugins.lua index c4aec0f..9e2d3b1 100644 --- a/tree/.config/nvim/lua/plugins.lua +++ b/tree/.config/nvim/lua/plugins.lua @@ -1,98 +1,122 @@ require("lazy").setup({ - spec = { - -- install plugins - { 'nvim-treesitter/nvim-treesitter' }, - { 'ellisonleao/gruvbox.nvim' }, - { 'danilamihailov/beacon.nvim' }, - { 'nvim-lua/plenary.nvim' }, - { - 'folke/todo-comments.nvim', - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - keywords = { - SAFETY = { - icon = "☢", - color = "warning", - alt = { "SOUNDNESS", "UNSAFE", "UNSOUND" }, - }, - INVARIANT = { - icon = "🦑", - color = "hint", - }, - }, - }, - }, - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }, - }, - { 'rktjmp/fwatch.nvim' }, - { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - opts = { - bigfile = { enabled = true }, - notifier = { enabled = true }, - quickfile = { enabled = true }, - statuscolumn = { enabled = true }, - words = { enabled = true }, - }, - }, + spec = { + -- install plugins + { 'nvim-treesitter/nvim-treesitter' }, + { 'ellisonleao/gruvbox.nvim' }, + { 'danilamihailov/beacon.nvim' }, + { 'nvim-lua/plenary.nvim' }, + { + 'folke/todo-comments.nvim', + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + keywords = { + SAFETY = { + icon = "☢", + color = "warning", + alt = { "SOUNDNESS", "UNSAFE", "UNSOUND" }, + }, + INVARIANT = { + icon = "🦑", + color = "hint", + }, + }, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + }, + { 'rktjmp/fwatch.nvim' }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + bigfile = { enabled = true }, + notifier = { enabled = true }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + }, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + }, - -- -- language server stuff - { 'williamboman/mason.nvim' }, - { 'williamboman/mason-lspconfig.nvim' }, - { 'neovim/nvim-lspconfig' }, - { - 'mrcjkb/rustaceanvim', - version = '^4', - lazy = false, -- This plugin is already lazy - }, - { 'mfussenegger/nvim-dap' }, + -- -- language server stuff + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, + { 'neovim/nvim-lspconfig' }, + { + 'mrcjkb/rustaceanvim', + version = '^6', + lazy = false, -- This plugin is already lazy + }, + { 'mfussenegger/nvim-dap' }, + { 'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' } }, + { 'theHamsta/nvim-dap-virtual-text' }, + { 'jay-babu/mason-nvim-dap.nvim' }, - -- -- nushell support - -- --use { 'LhKipp/nvim-nu', run = function() vim.fn[':TSInstall nu'] end} } - { 'LhKipp/nvim-nu' }, + -- -- nushell support + -- --use { 'LhKipp/nvim-nu', run = function() vim.fn[':TSInstall nu'] end} } + { 'LhKipp/nvim-nu' }, - -- -- Completion framework: - { 'hrsh7th/nvim-cmp' }, + -- -- Completion framework: + { 'hrsh7th/nvim-cmp' }, - -- -- LSP completion source: - { 'hrsh7th/cmp-nvim-lsp' }, + -- -- LSP completion source: + { 'hrsh7th/cmp-nvim-lsp' }, - -- -- Useful completion sources: - { 'hrsh7th/cmp-nvim-lua' }, - { 'hrsh7th/cmp-nvim-lsp-signature-help' }, - { 'hrsh7th/cmp-vsnip' }, - { 'hrsh7th/cmp-path' }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/vim-vsnip' }, - { 'ryo33/nvim-cmp-rust' }, + -- -- Useful completion sources: + { 'hrsh7th/cmp-nvim-lua' }, + { 'hrsh7th/cmp-nvim-lsp-signature-help' }, + { 'hrsh7th/cmp-vsnip' }, + { 'hrsh7th/cmp-path' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/vim-vsnip' }, + { 'ryo33/nvim-cmp-rust' }, - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', - dependencies = { 'nvim-lua/plenary.nvim' } - }, + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" } + }, - -- -- status line - { 'linrongbin16/lsp-progress.nvim' }, - { 'nvim-lualine/lualine.nvim' }, - }, - -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "habamax" } }, - -- automatically check for plugin updates - checker = { - enabled = true, - notify=false, - }, + -- -- status line + { 'linrongbin16/lsp-progress.nvim' }, + { 'nvim-lualine/lualine.nvim' }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { + enabled = true, + notify = false, + }, }) diff --git a/tree/.config/nvim/lua/spinners.lua b/tree/.config/nvim/lua/spinners.lua index e62ff27..93353ba 100644 --- a/tree/.config/nvim/lua/spinners.lua +++ b/tree/.config/nvim/lua/spinners.lua @@ -1,139 +1,139 @@ return { - braille = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, - triangles = { "◢", "◣", "◤", "◥" }, - dwarf_fortress = { - " ██████£££ ", - "☺██████£££ ", - "☺██████£££ ", - "☺▓█████£££ ", - "☺▓█████£££ ", - "☺▒█████£££ ", - "☺▒█████£££ ", - "☺░█████£££ ", - "☺░█████£££ ", - "☺ █████£££ ", - " ☺█████£££ ", - " ☺█████£££ ", - " ☺▓████£££ ", - " ☺▓████£££ ", - " ☺▒████£££ ", - " ☺▒████£££ ", - " ☺░████£££ ", - " ☺░████£££ ", - " ☺ ████£££ ", - " ☺████£££ ", - " ☺████£££ ", - " ☺▓███£££ ", - " ☺▓███£££ ", - " ☺▒███£££ ", - " ☺▒███£££ ", - " ☺░███£££ ", - " ☺░███£££ ", - " ☺ ███£££ ", - " ☺███£££ ", - " ☺███£££ ", - " ☺▓██£££ ", - " ☺▓██£££ ", - " ☺▒██£££ ", - " ☺▒██£££ ", - " ☺░██£££ ", - " ☺░██£££ ", - " ☺ ██£££ ", - " ☺██£££ ", - " ☺██£££ ", - " ☺▓█£££ ", - " ☺▓█£££ ", - " ☺▒█£££ ", - " ☺▒█£££ ", - " ☺░█£££ ", - " ☺░█£££ ", - " ☺ █£££ ", - " ☺█£££ ", - " ☺█£££ ", - " ☺▓£££ ", - " ☺▓£££ ", - " ☺▒£££ ", - " ☺▒£££ ", - " ☺░£££ ", - " ☺░£££ ", - " ☺ £££ ", - " ☺£££ ", - " ☺£££ ", - " ☺▓££ ", - " ☺▓££ ", - " ☺▒££ ", - " ☺▒££ ", - " ☺░££ ", - " ☺░££ ", - " ☺ ££ ", - " ☺££ ", - " ☺££ ", - " ☺▓£ ", - " ☺▓£ ", - " ☺▒£ ", - " ☺▒£ ", - " ☺░£ ", - " ☺░£ ", - " ☺ £ ", - " ☺£ ", - " ☺£ ", - " ☺▓ ", - " ☺▓ ", - " ☺▒ ", - " ☺▒ ", - " ☺░ ", - " ☺░ ", - " ☺ ", - " ☺ &", - " ☺ ☼&", - " ☺ ☼ &", - " ☺☼ &", - " ☺☼ & ", - " ‼ & ", - " ☺ & ", - " ‼ & ", - " ☺ & ", - " ‼ & ", - " ☺ & ", - "‼ & ", - " & ", - " & ", - " & ░ ", - " & ▒ ", - " & ▓ ", - " & £ ", - " & ░£ ", - " & ▒£ ", - " & ▓£ ", - " & ££ ", - " & ░££ ", - " & ▒££ ", - "& ▓££ ", - "& £££ ", - " ░£££ ", - " ▒£££ ", - " ▓£££ ", - " █£££ ", - " ░█£££ ", - " ▒█£££ ", - " ▓█£££ ", - " ██£££ ", - " ░██£££ ", - " ▒██£££ ", - " ▓██£££ ", - " ███£££ ", - " ░███£££ ", - " ▒███£££ ", - " ▓███£££ ", - " ████£££ ", - " ░████£££ ", - " ▒████£££ ", - " ▓████£££ ", - " █████£££ ", - " ░█████£££ ", - " ▒█████£££ ", - " ▓█████£££ ", - " ██████£££ ", - " ██████£££ ", - }, + braille = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, + triangles = { "◢", "◣", "◤", "◥" }, + dwarf_fortress = { + " ██████£££ ", + "☺██████£££ ", + "☺██████£££ ", + "☺▓█████£££ ", + "☺▓█████£££ ", + "☺▒█████£££ ", + "☺▒█████£££ ", + "☺░█████£££ ", + "☺░█████£££ ", + "☺ █████£££ ", + " ☺█████£££ ", + " ☺█████£££ ", + " ☺▓████£££ ", + " ☺▓████£££ ", + " ☺▒████£££ ", + " ☺▒████£££ ", + " ☺░████£££ ", + " ☺░████£££ ", + " ☺ ████£££ ", + " ☺████£££ ", + " ☺████£££ ", + " ☺▓███£££ ", + " ☺▓███£££ ", + " ☺▒███£££ ", + " ☺▒███£££ ", + " ☺░███£££ ", + " ☺░███£££ ", + " ☺ ███£££ ", + " ☺███£££ ", + " ☺███£££ ", + " ☺▓██£££ ", + " ☺▓██£££ ", + " ☺▒██£££ ", + " ☺▒██£££ ", + " ☺░██£££ ", + " ☺░██£££ ", + " ☺ ██£££ ", + " ☺██£££ ", + " ☺██£££ ", + " ☺▓█£££ ", + " ☺▓█£££ ", + " ☺▒█£££ ", + " ☺▒█£££ ", + " ☺░█£££ ", + " ☺░█£££ ", + " ☺ █£££ ", + " ☺█£££ ", + " ☺█£££ ", + " ☺▓£££ ", + " ☺▓£££ ", + " ☺▒£££ ", + " ☺▒£££ ", + " ☺░£££ ", + " ☺░£££ ", + " ☺ £££ ", + " ☺£££ ", + " ☺£££ ", + " ☺▓££ ", + " ☺▓££ ", + " ☺▒££ ", + " ☺▒££ ", + " ☺░££ ", + " ☺░££ ", + " ☺ ££ ", + " ☺££ ", + " ☺££ ", + " ☺▓£ ", + " ☺▓£ ", + " ☺▒£ ", + " ☺▒£ ", + " ☺░£ ", + " ☺░£ ", + " ☺ £ ", + " ☺£ ", + " ☺£ ", + " ☺▓ ", + " ☺▓ ", + " ☺▒ ", + " ☺▒ ", + " ☺░ ", + " ☺░ ", + " ☺ ", + " ☺ &", + " ☺ ☼&", + " ☺ ☼ &", + " ☺☼ &", + " ☺☼ & ", + " ‼ & ", + " ☺ & ", + " ‼ & ", + " ☺ & ", + " ‼ & ", + " ☺ & ", + "‼ & ", + " & ", + " & ", + " & ░ ", + " & ▒ ", + " & ▓ ", + " & £ ", + " & ░£ ", + " & ▒£ ", + " & ▓£ ", + " & ££ ", + " & ░££ ", + " & ▒££ ", + "& ▓££ ", + "& £££ ", + " ░£££ ", + " ▒£££ ", + " ▓£££ ", + " █£££ ", + " ░█£££ ", + " ▒█£££ ", + " ▓█£££ ", + " ██£££ ", + " ░██£££ ", + " ▒██£££ ", + " ▓██£££ ", + " ███£££ ", + " ░███£££ ", + " ▒███£££ ", + " ▓███£££ ", + " ████£££ ", + " ░████£££ ", + " ▒████£££ ", + " ▓████£££ ", + " █████£££ ", + " ░█████£££ ", + " ▒█████£££ ", + " ▓█████£££ ", + " ██████£££ ", + " ██████£££ ", + }, } diff --git a/tree/.config/nvim/lua/statusline.lua b/tree/.config/nvim/lua/statusline.lua index 6e39bee..6ad0bd8 100644 --- a/tree/.config/nvim/lua/statusline.lua +++ b/tree/.config/nvim/lua/statusline.lua @@ -1,58 +1,58 @@ require('lsp-progress').setup({ - spinner = require('spinners').dwarf_fortress, - spin_update_time = 200, - client_format = function(client_name, spinner, series_messages) - return #series_messages > 0 - and ( - table.concat(series_messages, ", ") - .. " " .. spinner - .. " [" .. client_name .. "]" - ) - or nil - end, + spinner = require('spinners').dwarf_fortress, + spin_update_time = 200, + client_format = function(client_name, spinner, series_messages) + return #series_messages > 0 + and ( + table.concat(series_messages, ", ") + .. " " .. spinner + .. " [" .. client_name .. "]" + ) + or nil + end, }) require('lualine').setup { - options = { - icons_enabled = true, - theme = 'auto', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 200, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = { - function() - return require('lsp-progress').progress() - end - }, - lualine_y = {'encoding', 'fileformat', 'filetype'}, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 200, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { + function() + return require('lsp-progress').progress() + end + }, + lualine_y = { 'encoding', 'fileformat', 'filetype' }, + lualine_z = { 'location' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} }