diff options
| author | Grace Yoder <grace_yoder@outlook.com> | 2026-09-03 15:36:32 -0400 |
|---|---|---|
| committer | Grace Yoder <grace_yoder@outlook.com> | 2026-09-03 15:37:10 -0400 |
| commit | 22b6712c240fea0643cfc01acfce1fda1f125b8a (patch) | |
| tree | fb8ac2302793c76d3640aab7d3f74f7a57c01933 /vim/.config/nvim/lua | |
nix init
Diffstat (limited to 'vim/.config/nvim/lua')
| -rw-r--r-- | vim/.config/nvim/lua/custom-lualine.lua | 4 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/diagnostics.lua | 7 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/godot.lua | 60 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/native-lsp.lua | 114 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/packed.lua | 127 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/plugins.lua | 421 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/remap.lua | 74 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/standard-lint.lua | 11 | ||||
| -rw-r--r-- | vim/.config/nvim/lua/westwood-lint.lua | 21 |
9 files changed, 839 insertions, 0 deletions
diff --git a/vim/.config/nvim/lua/custom-lualine.lua b/vim/.config/nvim/lua/custom-lualine.lua new file mode 100644 index 0000000..9bed3a6 --- /dev/null +++ b/vim/.config/nvim/lua/custom-lualine.lua @@ -0,0 +1,4 @@ +require('lualine').setup { + options = { theme = "solarized_dark" } +} + diff --git a/vim/.config/nvim/lua/diagnostics.lua b/vim/.config/nvim/lua/diagnostics.lua new file mode 100644 index 0000000..52f747e --- /dev/null +++ b/vim/.config/nvim/lua/diagnostics.lua @@ -0,0 +1,7 @@ +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + update_in_insert = false, +}) + diff --git a/vim/.config/nvim/lua/godot.lua b/vim/.config/nvim/lua/godot.lua new file mode 100644 index 0000000..327ed33 --- /dev/null +++ b/vim/.config/nvim/lua/godot.lua @@ -0,0 +1,60 @@ +local function connect_to_godot_server() + -- Check if project.godot exists in current directory + local project_file = vim.fn.getcwd() .. "/project.godot" + if vim.fn.filereadable(project_file) == 1 then + local pipe_path = vim.fn.getcwd() .. "/nvim_server.pipe" + + -- Create the pipe if it doesn't exist, then connect + local success = vim.fn.serverstart(pipe_path) + if success then + print("Connected to Godot server via " .. pipe_path) + else + print("Failed to create/connect to Godot server pipe: " .. pipe_path) + end + + local dap = require("dap") + + dap.adapters.godot = { + type = 'server', + host = '127.0.0.1', + port = 6006, + } + + dap.configurations.gdscript = { + { + type = 'godot', + request = 'launch', + name = 'Launch scene', + project = '${workspaceFolder}', + launch_scene = true, + }, + } + + dap.configurations.cs = { + { + type = 'godot', + request = 'launch', + name = 'Launch scene', + project = '${workspaceFolder}', + launch_scene = true, + }, + } + end +end + +-- Auto-connect when Neovim starts +vim.api.nvim_create_autocmd("VimEnter", { + callback = connect_to_godot_server, + desc = "Auto-connect to Godot server if project.godot exists" +}) + +-- Optional: Also check when changing directories +vim.api.nvim_create_autocmd("DirChanged", { + callback = connect_to_godot_server, + desc = "Auto-connect to Godot server when changing to Godot project directory" +}) + +-- Optional: Command to manually connect +vim.api.nvim_create_user_command("GodotConnect", connect_to_godot_server, { + desc = "Manually connect to Godot server" +}) diff --git a/vim/.config/nvim/lua/native-lsp.lua b/vim/.config/nvim/lua/native-lsp.lua new file mode 100644 index 0000000..ee97f80 --- /dev/null +++ b/vim/.config/nvim/lua/native-lsp.lua @@ -0,0 +1,114 @@ +vim.lsp.config('luals', { + on_attach = function() + print('luals is now active in this file') + end, +}) +if not string.match(vim.g.hostname, "cs.purdue.edu") then + vim.lsp.enable("luals") +end + + +vim.lsp.config('pyright', { + on_attach = function() + print('pyright is now active in this file') + end, +}) + +vim.lsp.enable("pyright") +-- vim.lsp.enable("basedpyright") + +vim.lsp.config('ty', { + on_attach = function() + print('ty is now active in this file') + end, +}) + +-- vim.lsp.enable("ty") +vim.lsp.enable("ruff") + + + +vim.lsp.config('clangd', { + on_attach = function() + print('clangd is now active in this file') + end, +}) + +vim.lsp.enable("clangd") + +vim.lsp.config('tailwind-ls', { + on_attach = function() + print('tailwind-ls is now active in this file') + end, +}) + +vim.lsp.enable("tailwind-ls") + +vim.lsp.config('zls', { + on_attach = function() + print('zls is now active in this file') + end, +}) + +vim.lsp.enable("zls") +-- vim.lsp.enable("zigscient") + +vim.lsp.enable("gopls") + +vim.lsp.enable("tinymist") + +-- vim.lsp.enable("cspell-ls") + +vim.lsp.enable("astro") + +vim.lsp.config('rust_analyzer', { + on_attach = function() + print('rust-analyzer is now active in this file') + end, +}) + +vim.lsp.enable("rust-analyzer") +vim.lsp.enable("gdscript") +vim.lsp.config('csharp-ls', { + on_attach = function() + print('csharp-ls is now active in this file') + end, +}) + + +vim.lsp.enable("csharp-ls") + +vim.lsp.enable("asm-lsp") +vim.lsp.enable("codebook") +vim.lsp.enable("json") +vim.lsp.enable("eslint") +vim.lsp.enable("css") +vim.lsp.enable("html") +vim.lsp.enable("fish-lsp") + + + +vim.diagnostic.config({ + virtual_text = { priority = 100 }, +}) + +-- https://lsp-zero.netlify.app/blog/lsp-client-features.html + +vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } +vim.opt.shortmess:append('c') + + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp", { clear = true }), + callback = function(args) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + if vim.bo[args.buf].filetype == "typst" or vim.bo[args.buf].filetype == "c" then + return + end + vim.lsp.buf.format({ async = false, id = args.data.client_id }) + end, + }) + end +}) diff --git a/vim/.config/nvim/lua/packed.lua b/vim/.config/nvim/lua/packed.lua new file mode 100644 index 0000000..28a21cc --- /dev/null +++ b/vim/.config/nvim/lua/packed.lua @@ -0,0 +1,127 @@ +-- +-- Packed: a single file, somewhat compatible Packer replacement +-- Written by grace +-- + +local function resolve_src(s) + if s:match("^https?://") then + return s + end + if s:match("^[%w%-]+/[%w%-_.]+$") then + return "https://github.com/" .. s + end + return s +end + +local function normalize_plugin(p) + if type(p) == "string" then + return { + src = resolve_src(p), + name = p:match(".*/(.*)"), + } + end + + if type(p[1]) == "string" then + p.src = resolve_src(p[1]) + p[1] = nil + end + + if p.src then + p.src = resolve_src(p.src) + end + + if not p.name and p.as then + p.name = p.as + end + + if not p.version then + if p.commit then + p.version = p.commit + elseif p.tag then + p.version = p.tag + elseif p.branch then + p.version = p.branch + end + end + + + + local unsupported = { + 'disable', 'installer', 'updater', 'after', 'rtp', + 'opt', 'bufread', 'lock', 'run', 'requires', 'rocks', 'setup' + } + + for _, field in ipairs(unsupported) do + if p[field] then + vim.notify("Packed does not support `" .. field .. "`: " .. (p.name or p.src), vim.log.levels.WARN) + vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {}) + vim.fn.getchar() + end + end + + if p.cmd or p.ft or p.keys or p.event or p.fn or p.cond or p.module or p.module_pattern then + vim.notify("Packed does not support lazy loading: " .. (p.name or p.src), vim.log.levels.WARN) + vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {}) + vim.fn.getchar() + end + + + + return p +end + +local function setup_plugins(plugs) + local plugins = {} + + if type(plugs) == "function" then + local function use(p) + table.insert(plugins, p) + end + + plugs(use) + else + plugins = plugs + end + local specs = {} + + for _, p in ipairs(plugins) do + p = normalize_plugin(p) + + local spec = vim.deepcopy(p) + spec.config = nil + + table.insert(specs, spec) + end + + vim.pack.add(specs, { confirm = true, load = true }) + + + for _, p in ipairs(plugins) do + if type(p) ~= "string" and p.config then + local ok = pcall(p.config) + if not ok then + vim.notify("Config failed: " .. (p.name or p.src), vim.log.levels.ERROR) + vim.api.nvim_echo({ { "Press Enter to continue...", "MoreMsg" } }, false, {}) + vim.fn.getchar() + end + end + end + + + local unused = vim.iter(vim.pack.get()) + :filter(function(p) + return not p.active + end) + :map(function(p) + return p.spec.name + end) + :totable() + + vim.pack.del(unused) +end + + +local r = {} +r.setup = setup_plugins + +return r diff --git a/vim/.config/nvim/lua/plugins.lua b/vim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..303177d --- /dev/null +++ b/vim/.config/nvim/lua/plugins.lua @@ -0,0 +1,421 @@ +-- vim.pack.update(nil, { target = 'lockfile' }) + +return require("packed").setup(function(use) + use 'nvim-lua/plenary.nvim' + use { + 'nvim-telescope/telescope.nvim', + config = function() + require('telescope').setup({ + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--hidden", + "--glob=!.git/*", + "--glob=!node_modules/**", + "--glob=!build/**", + }, + file_ignore_patterns = { "node_modules", "^build/", "^.git/" }, + }, + pickers = { + find_files = { + hidden = true, + } + } + }) + end, + } + + -- https://tduyng.com/blog/neovim-highlight-syntax/ + use { + 'nvim-treesitter/nvim-treesitter', + branch = 'main', + config = function() + local parser_path = vim.fn.expand("~/.local/share/nvim/site/parser") + vim.opt.runtimepath:append(parser_path) + + require("nvim-treesitter").setup({}) + require("nvim-treesitter").install({ + "bash", + "blade", + "c", + "comment", + "css", + "diff", + "dockerfile", + "fish", + "gitcommit", + "gitignore", + "go", + "gomod", + "gosum", + "gowork", + "html", + "ini", + "javascript", + "jsdoc", + "json", + "lua", + "luadoc", + "luap", + "make", + "markdown", + "markdown_inline", + "nginx", + "nix", + "proto", + "python", + "query", + "regex", + "rust", + "scss", + "sql", + "terraform", + "toml", + "tsx", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + "zig", + }) + + vim.api.nvim_create_autocmd("PackChanged", { + desc = "Handle nvim-treesitter updates", + group = vim.api.nvim_create_augroup("nvim-treesitter-pack-changed-update-handler", { clear = true }), + callback = function(event) + if event.data.kind == "update" then + local ok = pcall(vim.cmd, "TSUpdate") + if ok then + vim.notify("TSUpdate completed successfully!", vim.log.levels.INFO) + else + vim.notify("TSUpdate command not available yet, skipping", vim.log.levels.WARN) + end + end + end, + }) + + vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + + vim.api.nvim_create_autocmd("FileType", { + pattern = { "*" }, + callback = function() + local filetype = vim.bo.filetype + if filetype and filetype ~= "" then + local success = pcall(function() + vim.treesitter.start() + end) + if not success then + return + end + end + end, + }) + end + } + + use { + src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", + version = "main", + config = function() + require("nvim-treesitter-textobjects").setup({ + select = { + enable = true, + lookahead = true, + selection_modes = { + ["@parameter.outer"] = "v", -- charwise + ["@function.outer"] = "V", -- linewise + ["@class.outer"] = "<c-v>", -- blockwise + }, + include_surrounding_whitespace = false, + }, + move = { + enable = true, + set_jumps = true, + }, + }) + + -- SELECT keymaps + local sel = require("nvim-treesitter-textobjects.select") + for _, map in ipairs({ + { { "x", "o" }, "af", "@function.outer" }, + { { "x", "o" }, "if", "@function.inner" }, + { { "x", "o" }, "ac", "@class.outer" }, + { { "x", "o" }, "ic", "@class.inner" }, + { { "x", "o" }, "aa", "@parameter.outer" }, + { { "x", "o" }, "ia", "@parameter.inner" }, + { { "x", "o" }, "ad", "@comment.outer" }, + { { "x", "o" }, "as", "@statement.outer" }, + }) do + vim.keymap.set(map[1], map[2], function() + sel.select_textobject(map[3], "textobjects") + end, { desc = "Select " .. map[3] }) + end + + -- MOVE keymaps + local mv = require("nvim-treesitter-textobjects.move") + for _, map in ipairs({ + { { "n", "x", "o" }, "]]", mv.goto_next_start, "@function.outer" }, + { { "n", "x", "o" }, "[[", mv.goto_previous_start, "@function.outer" }, + { { "n", "x", "o" }, "]f", mv.goto_next_start, "@function.outer" }, + { { "n", "x", "o" }, "[f", mv.goto_previous_start, "@function.outer" }, + { { "n", "x", "o" }, "]c", mv.goto_next_start, "@class.outer" }, + { { "n", "x", "o" }, "[c", mv.goto_previous_start, "@class.outer" }, + { { "n", "x", "o" }, "]F", mv.goto_next_end, "@function.outer" }, + { { "n", "x", "o" }, "[F", mv.goto_previous_end, "@function.outer" }, + { { "n", "x", "o" }, "]o", mv.goto_next_start, { "@loop.inner", "@loop.outer" } }, + { { "n", "x", "o" }, "[o", mv.goto_previous_start, { "@loop.inner", "@loop.outer" } }, + }) do + local modes, lhs, fn, query = map[1], map[2], map[3], map[4] + -- build a human-readable desc + local qstr = (type(query) == "table") and table.concat(query, ",") or query + vim.keymap.set(modes, lhs, function() + fn(query, "textobjects") + end, { desc = "Move to " .. qstr }) + end + end + } + + + + use 'mbbill/undotree' + use 'nvim-tree/nvim-web-devicons' + use 'mfussenegger/nvim-lint' + + -- grrr why does neovim not have this? + use { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end + } + + use { "akinsho/toggleterm.nvim", config = function() + require("toggleterm").setup { + size = 30 + } + vim.keymap.set({ "n", "t", "v" }, "<leader>tt", require("toggleterm").toggle, { desc = "Toggle terminal" }) + end } + use { 'nvim-telescope/telescope.nvim' } + if vim.g.hostname == "turing" then + use { + 'anurag3301/nvim-platformio.lua', + config = function() + require('platformio').setup({ + lsp = "ccls" --default: ccls, other option: clangd + -- If you pick clangd, it also creates compile_commands.json + }) + end + } + end + + use { + "chentoast/marks.nvim", + config = function() require('marks').setup() end + } + + -- use { "MunifTanjim/nui.nvim" } + + use { 'rafamadriz/friendly-snippets' } + use { + 'saghen/blink.cmp', + version = 'v1.10.1', + config = function() + require("blink.cmp").setup({ + fuzzy = { + implementation = "prefer_rust_with_warning", + prebuilt_binaries = { + download = true, + force_version = "v1.*" + }, + }, + keymap = { preset = "enter" }, + }) + end + } + + use { + 'f-person/git-blame.nvim', + config = function() + require("gitblame").setup { + gitblame_delay = 1 + } + end + } + + + use { + "mfussenegger/nvim-dap", + + config = function() + local dap = require("dap") + + -- require('dap.ext.vscode').load_launchjs(nil, { + -- node = { 'javascript', 'typescript' }, + -- python = { 'python' }, + -- go = { 'go' }, + -- codelldb = { 'c', 'cpp', 'rust' } + -- }) + + vim.keymap.set('n', '<M-u>', function() dap.continue() end, { desc = 'DAP: Continue' }) + vim.keymap.set('n', '<M-i>', function() dap.step_into() end, { desc = 'DAP: Step Into' }) + vim.keymap.set('n', '<M-o>', function() dap.step_out() end, { desc = 'DAP: Step Out' }) + vim.keymap.set('n', '<M-p>', function() dap.step_over() end, { desc = 'DAP: Step Over' }) + vim.keymap.set('n', '<M-b>', function() dap.toggle_breakpoint() end, { desc = 'DAP: Toggle Breakpoint' }) + vim.keymap.set('n', '<F5>', function() dap.continue() end) + vim.keymap.set('n', '<F10>', function() dap.step_over() end) + vim.keymap.set('n', '<F11>', function() dap.step_into() end) + vim.keymap.set('n', '<F12>', function() dap.step_out() end) + vim.keymap.set('n', '<Leader>b', function() dap.toggle_breakpoint() end) + vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end) + + dap.adapters.codelldb = { + type = "executable", + command = "codelldb" + } + dap.configurations.cpp = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + } + end + } + + + use { + 'stevearc/overseer.nvim', + config = function() require('overseer').setup() end + } + use 'theHamsta/nvim-dap-virtual-text' + use "nvim-neotest/nvim-nio" + use { + "rcarriga/nvim-dap-ui", + config = function() + local dap, dapui = require("dap"), require("dapui") + dapui.setup() + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end + } + + use { "geigerzaehler/tree-sitter-jinja2" } + + use { + "rose-pine/neovim", + as = "rose-pine", + config = function() + require("rose-pine").setup({ + variant = "moon" + }) + vim.cmd("colorscheme rose-pine") + end + } + + use { + 'chomosuke/typst-preview.nvim', + config = function() + require 'typst-preview'.setup {} + end, + } + + + use({ + "iamcco/markdown-preview.nvim", + config = function() + vim.api.nvim_create_user_command("MDPreviewInstall", function() + vim.vim.fn["mkdp#util#install"]() + end, {}) + end, + }) + + + use { + 'LukasPietzschmann/telescope-tabs', + config = function() + require 'telescope-tabs'.setup { + -- Your custom config :^) + } + end + } + use "HiPhish/rainbow-delimiters.nvim" + + use { + 'diogo464/hotreload.nvim', + config = function() + require('hotreload').setup({ + interval = 500, + }) + end + } + + use { + "lukas-reineke/indent-blankline.nvim", + config = function() + require("ibl").setup { + indent = { highlight = { "Comment" }, char = "▏" }, + scope = { highlight = { "@variable" }, show_start = false, show_end = false }, + } + end + } + + use { + "https://tangled.org/bpavuk.neocities.org/jj-log.nvim.git", + config = function() + require('jj-log').setup { + out_waiting = "...", + out_no_jj_repo = "~no_jj_repo~", + out_no_desc = "~no_desc~", + max_desc_length = 47, + full_desc = false, + } + end + } + + use { + 'nvim-lualine/lualine.nvim', + config = function() + require('lualine').setup { + options = { theme = "rose-pine" }, + sections = { + lualine_a = {'mode'}, + lualine_b = { + function() + return vim.b.jj_desc or "~no desc~" + end, + 'diff', + 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + } + end + } + + ------------------------ +end) diff --git a/vim/.config/nvim/lua/remap.lua b/vim/.config/nvim/lua/remap.lua new file mode 100644 index 0000000..0128949 --- /dev/null +++ b/vim/.config/nvim/lua/remap.lua @@ -0,0 +1,74 @@ +vim.g.mapleader = "\\" +vim.keymap.set("n", "<leader>\\", ":nohlsearch<CR>") + +vim.keymap.set("n", "<leader>vv", function() vim.cmd("vsplit") end) +vim.keymap.set("n", "<leader>vt", function() vim.cmd("tabnew") end) +vim.keymap.set("n", "<leader>vw", function() vim.cmd("tabclose") end) +vim.keymap.set("n", "<leader>vW", function() vim.cmd("tabonly") end) +vim.keymap.set("n", "<leader>vf", function() require('telescope-tabs').list_tabs() end) +vim.keymap.set("n", "<C-j>", function() vim.cmd("tabnext") end) +vim.keymap.set("n", "<C-k>", function() vim.cmd("tabNext") end) +vim.keymap.set("n", "<leader>v1", function() vim.cmd("tabnext 1") end) +vim.keymap.set("n", "<leader>v2", function() vim.cmd("tabnext 2") end) +vim.keymap.set("n", "<leader>v3", function() vim.cmd("tabnext 3") end) +vim.keymap.set("n", "<leader>v4", function() vim.cmd("tabnext 4") end) +vim.keymap.set("n", "<leader>v5", function() vim.cmd("tabnext 5") end) +vim.keymap.set("n", "<leader>v6", function() vim.cmd("tabnext 6") end) +vim.keymap.set("n", "<leader>v7", function() vim.cmd("tabnext 7") end) +vim.keymap.set("n", "<leader>v8", function() vim.cmd("tabnext 8") end) +vim.keymap.set("n", "<leader>v9", function() vim.cmd("tabnext 9") end) + + + +-- easier to move windows +vim.keymap.set("n", "`h", "<C-w>h") +vim.keymap.set("n", "`j", "<C-w>j") +vim.keymap.set("n", "`k", "<C-w>k") +vim.keymap.set("n", "`l", "<C-w>l") + +vim.keymap.set("n", "<leader>qr", vim.lsp.buf.rename) +vim.keymap.set("n", "<leader>qf", vim.lsp.buf.format) +vim.keymap.set("n", "<leader>dd", vim.diagnostic.open_float) + + +vim.keymap.set("n", "yf", function() + local view = vim.fn.winsaveview() + vim.cmd("%y") + vim.fn.winrestview(view) +end, { desc = "Yank entire file" }) + + +-------- PLUGINS ------- + +-- Telescope +local ts_builtins = require('telescope.builtin') +vim.keymap.set('n', '<leader>ff', ts_builtins.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', '<leader>fg', ts_builtins.git_files, { desc = 'Telescope find git files' }) +vim.keymap.set('n', '<leader>fb', ts_builtins.buffers, { desc = 'Telescope buffers' }) +vim.keymap.set('n', '<leader>fh', ts_builtins.help_tags, { desc = 'Telescope help tags' }) +vim.keymap.set('n', '<leader>fs', ts_builtins.lsp_workspace_symbols, { desc = 'Telescope find symbols' }) +vim.keymap.set('n', '<leader>fts', ts_builtins.treesitter, { desc = 'Telescope find treesitter' }) +vim.keymap.set('n', '<leader>fd', ts_builtins.lsp_definitions, { desc = 'Telescope find definition' }) +vim.keymap.set('n', '<leader>ftd', ts_builtins.lsp_type_definitions, { desc = 'Telescope find type definition' }) +vim.keymap.set('n', '<leader>fr', ts_builtins.lsp_references, { desc = 'Telescope find references' }) + +-- Undo Tree +vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle) + +-- Better Term + +-- local betterTerm = require('betterTerm') +-- -- toggle firts term +-- vim.keymap.set({ "n", "t" }, "<leader>tt", betterTerm.open, { desc = "Open terminal" }) +-- -- Select term focus +-- -- vim.keymap.set({"n"}, "<leader>tf", betterTerm.select, { desc = "Select terminal"}) +-- -- Create new term +-- local current = 2 +-- vim.keymap.set( +-- { "n" }, "<leader>tn", +-- function() +-- betterTerm.open(current) +-- current = current + 1 +-- end, +-- { desc = "New terminal" } +-- ) diff --git a/vim/.config/nvim/lua/standard-lint.lua b/vim/.config/nvim/lua/standard-lint.lua new file mode 100644 index 0000000..2f06ce5 --- /dev/null +++ b/vim/.config/nvim/lua/standard-lint.lua @@ -0,0 +1,11 @@ +vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { + callback = function() + -- try_lint without arguments runs the linters defined in `linters_by_ft` + -- for the current filetype + require("lint").try_lint(nil, { ignore_errors = true }) + + -- You can call `try_lint` with a linter name or a list of names to always + -- run specific linters, independent of the `linters_by_ft` configuration + -- require("lint").try_lint("cspell") + end, +}) diff --git a/vim/.config/nvim/lua/westwood-lint.lua b/vim/.config/nvim/lua/westwood-lint.lua new file mode 100644 index 0000000..04501b2 --- /dev/null +++ b/vim/.config/nvim/lua/westwood-lint.lua @@ -0,0 +1,21 @@ +local lint = require("lint") + +local errorformat = +"%WWARNING: %m,%Z%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\s%\\sat (stdin) from line %l column %c to line %e column %k" +lint.linters.westwood = { + cmd = '/homes/kkasad/share/westwood', + stdin = true, + args = { '-f', 'machine', '-' }, + stream = both, + ignore_exitcode = false, + env = nil, + parser = require('lint.parser').from_errorformat(errorformat) +} + +lint.linters_by_ft.c = { "westwood", "clangtidy" } +lint.linters_by_ft.cpp = { "westwood" } +vim.list_extend(lint.linters_by_ft.c, { "westwood", "clangtidy" }) +vim.list_extend(lint.linters_by_ft.cpp, { "westwood" }) + +local ns = lint.get_namespace("westwood") +vim.diagnostic.config({ virtual_text = true }, ns) |
