├── init.lua ├── lua └── dblechoc │ ├── lazy │ ├── netrw.lua │ ├── abolish.lua │ ├── surround.lua │ ├── vim-maximizer.lua │ ├── colors.lua │ ├── init.lua │ ├── copilot.lua │ ├── cloak.lua │ ├── format.lua │ ├── trouble.lua │ ├── telescope.lua │ ├── harpoon.lua │ ├── treesitter.lua │ └── lsp.lua │ ├── lazy_init.lua │ ├── set.lua │ ├── remap.lua │ └── init.lua └── lazy-lock.json /init.lua: -------------------------------------------------------------------------------- 1 | require("dblechoc") 2 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/netrw.lua: -------------------------------------------------------------------------------- 1 | return { "dzirtusss/netrw_keepdir_fix" } 2 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/abolish.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tpope/vim-abolish", 3 | } 4 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/surround.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "kylechui/nvim-surround", 3 | config = function() 4 | require("nvim-surround").setup({}) 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/vim-maximizer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "szw/vim-maximizer", 3 | cmd = { "MaximizerToggle" }, 4 | keys = { 5 | { "ms", "MaximizerToggle" }, 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/colors.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "catppuccin/nvim", 4 | name = "catppuccin", 5 | lazy = false, 6 | priority = 1000, 7 | config = function() 8 | vim.cmd([[colorscheme catppuccin-macchiato]]) 9 | end, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-lua/plenary.nvim", 4 | name = "plenary", 5 | }, 6 | { 7 | "tpope/vim-commentary", 8 | dependencies = { 9 | "JoosepAlviste/nvim-ts-context-commentstring", 10 | }, 11 | }, 12 | { 13 | "wakatime/vim-wakatime", 14 | lazy = false, 15 | setup = function() 16 | vim.cmd([[packadd wakatime/vim-wakatime]]) 17 | end, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/copilot.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "zbirenbaum/copilot.lua", 4 | dependencies = { 5 | "zbirenbaum/copilot-cmp", 6 | }, 7 | build = ":Copilot auth", 8 | config = function() 9 | require("copilot").setup({ 10 | suggestion = { enabled = false }, 11 | panel = { enabled = false }, 12 | -- copilot_model = "gpt-4o-copilot", 13 | }) 14 | require("copilot_cmp").setup() 15 | end, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy_init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not vim.loop.fs_stat(lazypath) then 3 | vim.fn.system({ 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "https://github.com/folke/lazy.nvim.git", 8 | "--branch=stable", -- latest stable release 9 | lazypath, 10 | }) 11 | end 12 | vim.opt.rtp:prepend(lazypath) 13 | 14 | require("lazy").setup({ 15 | spec = "dblechoc.lazy", 16 | change_detection = { notify = false }, 17 | install = { 18 | colorscheme = { "catppuccin-macchiato" }, 19 | }, 20 | checker = { 21 | enabled = true, 22 | }, 23 | }) 24 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/cloak.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "laytan/cloak.nvim", 3 | config = function() 4 | require("cloak").setup({ 5 | enabled = true, 6 | cloak_character = "*", 7 | -- The applied highlight group (colors) on the cloaking, see `:h highlight`. 8 | highlight_group = "Comment", 9 | patterns = { 10 | { 11 | -- Match any file starting with ".env". 12 | -- This can be a table to match multiple file patterns. 13 | file_pattern = { 14 | ".env*", 15 | "wrangler.toml", 16 | ".dev.vars", 17 | }, 18 | -- Match an equals sign and any character after it. 19 | -- This can also be a table of patterns to cloak, 20 | -- example: cloak_pattern = { ":.+", "-.+" } for yaml files. 21 | cloak_pattern = "=.+", 22 | }, 23 | }, 24 | }) 25 | end, 26 | } 27 | -------------------------------------------------------------------------------- /lua/dblechoc/set.lua: -------------------------------------------------------------------------------- 1 | vim.opt.guicursor = "" 2 | 3 | vim.opt.nu = true 4 | vim.opt.relativenumber = true 5 | 6 | vim.opt.tabstop = 4 7 | vim.opt.softtabstop = 4 8 | vim.opt.shiftwidth = 4 9 | vim.opt.expandtab = true 10 | 11 | vim.opt.smartindent = true 12 | 13 | vim.opt.wrap = false 14 | 15 | vim.opt.swapfile = false 16 | vim.opt.backup = false 17 | 18 | vim.opt.hlsearch = false 19 | vim.opt.incsearch = true 20 | 21 | vim.opt.termguicolors = true 22 | 23 | vim.opt.scrolloff = 8 24 | vim.opt.signcolumn = "yes" 25 | vim.opt.isfname:append("@-@") 26 | 27 | vim.opt.updatetime = 50 28 | 29 | vim.opt.colorcolumn = "120" 30 | 31 | vim.opt.clipboard:append({ "unnamed", "unnamedplus" }) 32 | 33 | -- Open splits more naturally 34 | vim.opt.splitbelow = true 35 | vim.opt.splitright = true 36 | 37 | -- ignore case in Vim search 38 | vim.opt.ignorecase = true 39 | vim.opt.smartcase = true 40 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/format.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/conform.nvim", 3 | config = function() 4 | local conform = require("conform") 5 | 6 | conform.setup({ 7 | formatters_by_ft = { 8 | javascript = { "prettier" }, 9 | javascriptreact = { "prettier" }, 10 | typescript = { "prettier" }, 11 | typescriptreact = { "prettier" }, 12 | svelte = { "prettier" }, 13 | vue = { "prettier" }, 14 | css = { "prettier" }, 15 | scss = { "prettier" }, 16 | less = { "prettier" }, 17 | html = { "prettier" }, 18 | json = { "prettier" }, 19 | jsonc = { "prettier" }, 20 | yaml = { "prettier" }, 21 | markdown = { "prettier" }, 22 | ["markdown.mdxv"] = { "prettier" }, 23 | graphql = { "prettier" }, 24 | handlebars = { "prettier" }, 25 | lua = { "stylua" }, 26 | go = { "goimports", "gofmt" }, 27 | }, 28 | format_on_save = { 29 | lsp_fallback = true, 30 | async = false, 31 | timeout_ms = 1000, 32 | }, 33 | }) 34 | 35 | vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" 36 | 37 | vim.keymap.set("n", "f", function() 38 | conform.format({ 39 | lsp_fallback = true, 40 | async = false, 41 | timeout_ms = 1000, 42 | }) 43 | end) 44 | end, 45 | } 46 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/trouble.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/trouble.nvim", 3 | dependencies = { "nvim-tree/nvim-web-devicons" }, 4 | keys = { 5 | { 6 | "tt", 7 | "Trouble diagnostics toggle", 8 | desc = "Diagnostics (Trouble)", 9 | }, 10 | { 11 | "tT", 12 | "Trouble diagnostics toggle filter.buf=0", 13 | desc = "Buffer Diagnostics (Trouble)", 14 | }, 15 | { 16 | "ts", 17 | "Trouble symbols toggle focus=false", 18 | desc = "Symbols (Trouble)", 19 | }, 20 | { 21 | "tl", 22 | "Trouble lsp toggle focus=false win.position=right", 23 | desc = "LSP Definitions / references / ... (Trouble)", 24 | }, 25 | { 26 | "tL", 27 | "Trouble loclist toggle", 28 | desc = "Location List (Trouble)", 29 | }, 30 | { 31 | "tQ", 32 | "Trouble qflist toggle", 33 | desc = "Quickfix List (Trouble)", 34 | }, 35 | }, 36 | config = function() 37 | require("trouble").setup({}) 38 | 39 | vim.keymap.set("n", "[t", function() 40 | require("trouble").next({ skip_groups = true, jump = true }) 41 | end) 42 | 43 | vim.keymap.set("n", "]t", function() 44 | require("trouble").prev({ skip_groups = true, jump = true }) 45 | end) 46 | end, 47 | } 48 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-telescope/telescope.nvim", 3 | dependencies = { 4 | "plenary", 5 | { 6 | "nvim-telescope/telescope-fzf-native.nvim", 7 | build = "make", 8 | config = function() 9 | require("telescope").load_extension("fzf") 10 | end, 11 | }, 12 | }, 13 | config = function() 14 | require("telescope").setup({ 15 | path_display = { "filename_first" }, 16 | pickers = { 17 | find_files = { 18 | find_command = { "rg", "--files", "--iglob", "!.git", "--hidden" }, 19 | }, 20 | live_grep = { 21 | additional_args = function() 22 | return { "--hidden", "--glob", "!**/.git/*" } 23 | end, 24 | }, 25 | grep_string = { 26 | additional_args = function() 27 | return { "--hidden", "--glob", "!**/.git/*" } 28 | end, 29 | }, 30 | }, 31 | extensions = { 32 | fzf = {}, 33 | }, 34 | }) 35 | 36 | local builtin = require("telescope.builtin") 37 | vim.keymap.set("n", "pf", builtin.find_files, {}) 38 | vim.keymap.set("n", "", builtin.git_files, {}) 39 | vim.keymap.set("n", "pws", function() 40 | local word = vim.fn.expand("") 41 | builtin.grep_string({ search = word }) 42 | end) 43 | vim.keymap.set("n", "pWs", function() 44 | local word = vim.fn.expand("") 45 | builtin.grep_string({ search = word }) 46 | end) 47 | vim.keymap.set("n", "ps", function() 48 | builtin.live_grep({}) 49 | end) 50 | vim.keymap.set("n", "vh", builtin.help_tags, {}) 51 | end, 52 | } 53 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/harpoon.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "ThePrimeagen/harpoon", 3 | branch = "harpoon2", 4 | dependencies = { 5 | "plenary", 6 | }, 7 | config = function() 8 | local harpoon = require("harpoon") 9 | 10 | harpoon:setup() 11 | 12 | vim.keymap.set("n", "a", function() 13 | harpoon:list():add() 14 | end) 15 | vim.keymap.set("n", "", function() 16 | harpoon.ui:toggle_quick_menu(harpoon:list()) 17 | end) 18 | 19 | vim.keymap.set("n", "", function() 20 | harpoon:list():select(1) 21 | end) 22 | vim.keymap.set("n", "", function() 23 | harpoon:list():select(2) 24 | end) 25 | vim.keymap.set("n", "", function() 26 | harpoon:list():select(3) 27 | end) 28 | vim.keymap.set("n", "", function() 29 | harpoon:list():select(4) 30 | end) 31 | 32 | -- Toggle previous & next buffers stored within Harpoon list 33 | vim.keymap.set("n", "", function() 34 | harpoon:list():prev() 35 | end) 36 | vim.keymap.set("n", "", function() 37 | harpoon:list():next() 38 | end) 39 | 40 | harpoon:extend({ 41 | UI_CREATE = function(cx) 42 | vim.keymap.set("n", "", function() 43 | harpoon.ui:select_menu_item({ vsplit = true }) 44 | end, { buffer = cx.bufnr }) 45 | 46 | vim.keymap.set("n", "", function() 47 | harpoon.ui:select_menu_item({ split = true }) 48 | end, { buffer = cx.bufnr }) 49 | 50 | vim.keymap.set("n", "", function() 51 | harpoon.ui:select_menu_item({ tabedit = true }) 52 | end, { buffer = cx.bufnr }) 53 | end, 54 | }) 55 | end, 56 | } 57 | -------------------------------------------------------------------------------- /lua/dblechoc/remap.lua: -------------------------------------------------------------------------------- 1 | vim.g.mapleader = " " 2 | vim.keymap.set("n", "pv", vim.cmd.Ex) 3 | 4 | vim.keymap.set("v", "J", ":m '>+1gv=gv") 5 | vim.keymap.set("v", "K", ":m '<-2gv=gv") 6 | 7 | vim.keymap.set("n", "J", "mzJ`z") 8 | vim.keymap.set("n", "", "zz") 9 | vim.keymap.set("n", "", "zz") 10 | vim.keymap.set("n", "n", "nzzzv") 11 | vim.keymap.set("n", "N", "Nzzzv") 12 | 13 | -- greatest remap ever 14 | vim.keymap.set("x", "p", [["_dP]]) 15 | 16 | -- next greatest remap ever : asbjornHaland 17 | vim.keymap.set({ "n", "v" }, "y", [["+y]]) 18 | vim.keymap.set("n", "Y", [["+Y]]) 19 | 20 | vim.keymap.set({ "n", "v" }, "d", [["_d]]) 21 | 22 | -- This is going to get me cancelled 23 | vim.keymap.set("i", "", "") 24 | 25 | vim.keymap.set("n", "Q", "") 26 | vim.keymap.set("n", "f", vim.lsp.buf.format) 27 | 28 | vim.keymap.set("n", "", "cnextzz") 29 | vim.keymap.set("n", "", "cprevzz") 30 | vim.keymap.set("n", "k", "lnextzz") 31 | vim.keymap.set("n", "j", "lprevzz") 32 | 33 | vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) 34 | vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) 35 | 36 | vim.keymap.set("n", "ee", "oif err != nil {}Oreturn err") 37 | 38 | vim.keymap.set("n", "cp", [[:let @+ = expand("%")]]) 39 | 40 | -- lazy 41 | vim.keymap.set("n", "l", "Lazy") 42 | 43 | -- hardmode 44 | for _, mode in pairs({ "n", "i", "v", "x" }) do 45 | for _, key in pairs({ "", "", "", "" }) do 46 | vim.keymap.set(mode, key, "") 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-treesitter/nvim-treesitter", 3 | build = ":TSUpdate", 4 | config = function() 5 | require("nvim-treesitter.configs").setup({ 6 | -- A list of parser names, or "all" 7 | ensure_installed = { 8 | "vimdoc", 9 | "javascript", 10 | "typescript", 11 | "c", 12 | "lua", 13 | "rust", 14 | "go", 15 | "jsdoc", 16 | "bash", 17 | "markdown", 18 | "markdown_inline", 19 | "swift", 20 | "kotlin", 21 | }, 22 | 23 | -- Install parsers synchronously (only applied to `ensure_installed`) 24 | sync_install = false, 25 | 26 | -- Automatically install missing parsers when entering buffer 27 | -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally 28 | auto_install = true, 29 | 30 | indent = { 31 | enable = true, 32 | }, 33 | 34 | highlight = { 35 | -- `false` will disable the whole extension 36 | enable = true, 37 | 38 | -- Setting this to true will run `:h syntax` and tree-sitter at the same time. 39 | -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). 40 | -- Using this option may slow down your editor, and you may see some duplicate highlights. 41 | -- Instead of true it can also be a list of languages 42 | additional_vim_regex_highlighting = { "markdown" }, 43 | }, 44 | }) 45 | 46 | local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs() 47 | treesitter_parser_config.templ = { 48 | install_info = { 49 | url = "https://github.com/vrischmann/tree-sitter-templ.git", 50 | files = { "src/parser.c", "src/scanner.c" }, 51 | branch = "master", 52 | }, 53 | } 54 | 55 | vim.treesitter.language.register("templ", "templ") 56 | end, 57 | } 58 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" }, 3 | "catppuccin": { "branch": "main", "commit": "da33755d00e09bff2473978910168ff9ea5dc453" }, 4 | "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, 5 | "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, 6 | "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, 7 | "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, 8 | "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, 9 | "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, 10 | "conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" }, 11 | "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, 12 | "copilot.lua": { "branch": "master", "commit": "e919876a5523b06406f0bc7285477da87a338a61" }, 13 | "fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, 14 | "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, 15 | "hererocks": { "branch": "master", "commit": "bcab2cb579cc3d374a0fc4f602e29912d3674965" }, 16 | "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, 17 | "lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" }, 18 | "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, 19 | "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, 20 | "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, 21 | "netrw_keepdir_fix": { "branch": "main", "commit": "4dd42b32664bdb8d6f35120230e3508368a76054" }, 22 | "nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" }, 23 | "nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, 24 | "nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" }, 25 | "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, 26 | "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, 27 | "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, 28 | "plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, 29 | "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, 30 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, 31 | "telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" }, 32 | "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, 33 | "vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" }, 34 | "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, 35 | "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, 36 | "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" } 37 | } 38 | -------------------------------------------------------------------------------- /lua/dblechoc/init.lua: -------------------------------------------------------------------------------- 1 | require("dblechoc.set") 2 | require("dblechoc.remap") 3 | 4 | require("dblechoc.lazy_init") 5 | 6 | local augroup = vim.api.nvim_create_augroup 7 | local dblechocGroup = augroup("dblechoc", {}) 8 | 9 | local autocmd = vim.api.nvim_create_autocmd 10 | local yank_group = augroup("HighlightYank", {}) 11 | 12 | function R(name) 13 | require("plenary.reload").reload_module(name) 14 | end 15 | 16 | vim.o.exrc = true 17 | 18 | vim.filetype.add({ 19 | extension = { 20 | templ = "templ", 21 | }, 22 | }) 23 | 24 | autocmd("TextYankPost", { 25 | group = yank_group, 26 | pattern = "*", 27 | callback = function() 28 | vim.highlight.on_yank({ 29 | higroup = "IncSearch", 30 | timeout = 40, 31 | }) 32 | end, 33 | }) 34 | 35 | autocmd({ "BufWritePre" }, { 36 | group = dblechocGroup, 37 | pattern = "*", 38 | command = [[%s/\s\+$//e]], 39 | }) 40 | 41 | local function filter(arr, fn) 42 | if type(arr) ~= "table" then 43 | return arr 44 | end 45 | local filtered = {} 46 | for k, v in pairs(arr) do 47 | if fn(v, k, arr) then 48 | table.insert(filtered, v) 49 | end 50 | end 51 | return filtered 52 | end 53 | 54 | local function typescript_on_definition_list(options) 55 | local items = options.items 56 | if #items > 1 then 57 | items = filter(items, function(definition) 58 | return string.match(definition.filename, "node_modules/@types/react/index.d.ts") == nil 59 | end) 60 | end 61 | vim.fn.setqflist({}, " ", { title = options.title, items = items, context = options.context }) 62 | vim.api.nvim_command("cfirst") -- or maybe you want 'copen' instead of 'cfirst' 63 | end 64 | 65 | autocmd("LspAttach", { 66 | group = dblechocGroup, 67 | callback = function(e) 68 | local opts = { buffer = e.buf } 69 | 70 | vim.keymap.set("n", "gd", function() 71 | vim.lsp.buf.definition({ on_list = typescript_on_definition_list }) 72 | end, opts) 73 | vim.keymap.set("n", "K", function() 74 | vim.lsp.buf.hover() 75 | end, opts) 76 | vim.keymap.set("n", "vws", function() 77 | vim.lsp.buf.workspace_symbol() 78 | end, opts) 79 | vim.keymap.set("n", "vd", function() 80 | vim.diagnostic.open_float() 81 | end, opts) 82 | vim.keymap.set("n", "vca", function() 83 | vim.lsp.buf.code_action() 84 | end, opts) 85 | vim.keymap.set("n", "vrr", function() 86 | vim.lsp.buf.references() 87 | end, opts) 88 | vim.keymap.set("n", "vrn", function() 89 | vim.lsp.buf.rename() 90 | end, opts) 91 | vim.keymap.set("i", "", function() 92 | vim.lsp.buf.signature_help() 93 | end, opts) 94 | vim.keymap.set("n", "[d", function() 95 | vim.diagnostic.goto_next() 96 | end, opts) 97 | vim.keymap.set("n", "]d", function() 98 | vim.diagnostic.goto_prev() 99 | end, opts) 100 | end, 101 | }) 102 | 103 | -- close some filetypes with 104 | autocmd("FileType", { 105 | group = dblechocGroup, 106 | pattern = { 107 | "help", 108 | "lspinfo", 109 | "man", 110 | "notify", 111 | "qf", 112 | "query", 113 | "checkhealth", 114 | }, 115 | callback = function(event) 116 | vim.bo[event.buf].buflisted = false 117 | vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) 118 | end, 119 | }) 120 | 121 | vim.g.netrw_browse_split = 0 122 | vim.g.netrw_banner = 0 123 | vim.g.netrw_winsize = 25 124 | 125 | -- Builtin Packages 126 | -- cfilter plugin allows filtering down an existing quickfix list 127 | vim.cmd.packadd("cfilter") 128 | -------------------------------------------------------------------------------- /lua/dblechoc/lazy/lsp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mason-org/mason-lspconfig.nvim", 3 | dependencies = { 4 | "mason-org/mason.nvim", 5 | "neovim/nvim-lspconfig", 6 | "hrsh7th/cmp-nvim-lsp", 7 | "hrsh7th/cmp-buffer", 8 | "hrsh7th/cmp-path", 9 | "hrsh7th/cmp-cmdline", 10 | "hrsh7th/nvim-cmp", 11 | "L3MON4D3/LuaSnip", 12 | "saadparwaiz1/cmp_luasnip", 13 | "j-hui/fidget.nvim", 14 | "zbirenbaum/copilot-cmp", 15 | "WhoIsSethDaniel/mason-tool-installer.nvim", 16 | "onsails/lspkind.nvim", 17 | }, 18 | config = function() 19 | require("fidget").setup() 20 | 21 | vim.lsp.config("*", { 22 | capabilities = vim.tbl_deep_extend( 23 | "force", 24 | {}, 25 | vim.lsp.protocol.make_client_capabilities(), 26 | require("cmp_nvim_lsp").default_capabilities() 27 | ), 28 | }) 29 | 30 | vim.lsp.config("lua_ls", { 31 | settings = { 32 | Lua = { 33 | runtime = { 34 | version = "LuaJIT", 35 | }, 36 | diagnostics = { 37 | globals = { 38 | "vim", 39 | "require", 40 | }, 41 | }, 42 | }, 43 | }, 44 | }) 45 | 46 | vim.lsp.config("tailwindcssls", { 47 | settings = { 48 | tailwindCSS = { 49 | classAttributes = { 50 | "class", 51 | "className", 52 | "class:list", 53 | "classList", 54 | "ngClass", 55 | }, 56 | }, 57 | }, 58 | }) 59 | 60 | vim.lsp.config("ts_ls", { 61 | init_options = { 62 | preferences = { 63 | includeInlayParameterNameHints = "none", 64 | includeInlayParameterNameHintsWhenArgumentMatchesName = false, 65 | includeInlayFunctionParameterTypeHints = false, 66 | includeInlayVariableTypeHints = false, 67 | includeInlayVariableTypeHintsWhenTypeMatchesName = false, 68 | includeInlayPropertyDeclarationTypeHints = false, 69 | includeInlayFunctionLikeReturnTypeHints = true, 70 | includeInlayEnumMemberValueHints = true, 71 | }, 72 | }, 73 | on_attach = function(client, bufnr) 74 | vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) 75 | end, 76 | handlers = { 77 | ["textDocument/publishDiagnostics"] = function(err, result, ctx, config) 78 | if err then 79 | vim.notify("[lsp] Error on publishDiagnostics: " .. vim.inspect(err), vim.log.levels.ERROR) 80 | return 81 | end 82 | if result == nil or result.diagnostics == nil then 83 | return 84 | end 85 | 86 | -- Filter out diagnostics matching the pattern by removing them in place 87 | for i = #result.diagnostics, 1, -1 do 88 | if string.find(result.diagnostics[i].message, "navigateDeprecated", 1, true) then 89 | table.remove(result.diagnostics, i) 90 | end 91 | end 92 | 93 | -- Call the default handler with filtered diagnostics 94 | vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config) 95 | end, 96 | }, 97 | }) 98 | 99 | local base_eslint_on_attach = vim.lsp.config.eslint.on_attach 100 | vim.lsp.config("eslint", { 101 | settings = { 102 | workingDirectories = { mode = "auto" }, 103 | experimental = { 104 | useFlatConfig = false, 105 | }, 106 | }, 107 | on_attach = function(client, bufnr) 108 | if base_eslint_on_attach then 109 | base_eslint_on_attach(client, bufnr) 110 | end 111 | 112 | vim.api.nvim_create_autocmd("BufWritePre", { 113 | buffer = bufnr, 114 | command = "LspEslintFixAll", 115 | }) 116 | end, 117 | }) 118 | 119 | require("mason").setup() 120 | require("mason-tool-installer").setup({ 121 | ensure_installed = { 122 | "eslint", 123 | "lua_ls", 124 | "tailwindcss", 125 | "ts_ls", 126 | "yamlls", 127 | -- formatter 128 | "prettier", 129 | "stylua", 130 | }, 131 | auto_update = false, 132 | }) 133 | 134 | require("mason-lspconfig").setup({ 135 | ensure_installed = {}, 136 | automatic_installation = false, 137 | }) 138 | 139 | local lspkind = require("lspkind") 140 | local cmp = require("cmp") 141 | local cmp_select = { behavior = cmp.SelectBehavior.Select } 142 | 143 | cmp.setup({ 144 | formatting = { 145 | format = lspkind.cmp_format({ 146 | mode = "symbol", 147 | maxwidth = { 148 | -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) 149 | -- can also be a function to dynamically calculate max width such as 150 | -- menu = function() return math.floor(0.45 * vim.o.columns) end, 151 | menu = 50, -- leading text (labelDetails) 152 | abbr = 50, -- actual suggestion item 153 | }, 154 | symbol_map = { Copilot = "" }, 155 | ellipsis_char = "...", 156 | show_labelDetails = true, 157 | 158 | before = function(entry, vim_item) 159 | vim_item.kind = "" -- remove kind text 160 | local labels = { nvim_lsp = "λ", copilot = "", luasnip = "✂", buffer = "▤" } 161 | vim_item.menu = labels[entry.source.name] or "" 162 | return vim_item 163 | end, 164 | }), 165 | }, 166 | snippet = { 167 | expand = function(args) 168 | require("luasnip").lsp_expand(args.body) 169 | end, 170 | }, 171 | window = { 172 | completion = cmp.config.window.bordered(), 173 | documentation = cmp.config.window.bordered(), 174 | }, 175 | mapping = cmp.mapping.preset.insert({ 176 | [""] = cmp.mapping.select_prev_item(cmp_select), 177 | [""] = cmp.mapping.select_next_item(cmp_select), 178 | [""] = cmp.mapping.confirm({ 179 | behavior = cmp.ConfirmBehavior.Replace, 180 | select = false, 181 | }), 182 | [""] = cmp.mapping.complete(), 183 | }), 184 | sources = cmp.config.sources({ 185 | { name = "nvim_lsp" }, 186 | { name = "copilot" }, 187 | { name = "luasnip" }, 188 | }, { 189 | { name = "buffer" }, 190 | }), 191 | }) 192 | 193 | local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } 194 | 195 | vim.diagnostic.config({ 196 | virtual_lines = true, 197 | update_in_insert = true, 198 | float = { 199 | focusable = false, 200 | border = "rounded", 201 | }, 202 | signs = { 203 | active = true, 204 | text = { 205 | [vim.diagnostic.severity.ERROR] = signs.Error, 206 | [vim.diagnostic.severity.WARN] = signs.Warm, 207 | [vim.diagnostic.severity.INFO] = signs.Info, 208 | [vim.diagnostic.severity.HINT] = signs.Hint, 209 | }, 210 | texthl = { 211 | [vim.diagnostic.severity.ERROR] = "DiagnosticSignError", 212 | [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn", 213 | [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo", 214 | [vim.diagnostic.severity.HINT] = "DiagnosticSignHint", 215 | }, 216 | }, 217 | }) 218 | end, 219 | } 220 | --------------------------------------------------------------------------------