- commit
- 20208a6
- parent
- ddaf810
- author
- Eric Bower
- date
- 2025-07-07 10:40:33 -0400 EDT
chore(nvim): combine files
2 files changed,
+177,
-178
+177,
-1
1@@ -42,4 +42,180 @@ autocmd('Filetype', {
2 command = 'setlocal wrap tw=79 formatoptions+=t tabstop=2 shiftwidth=2 softtabstop=2',
3 })
4
5-require 'plugins'
6+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
7+if not (vim.uv or vim.loop).fs_stat(lazypath) then
8+ local lazyrepo = "https://github.com/folke/lazy.nvim.git"
9+ local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
10+ if vim.v.shell_error ~= 0 then
11+ vim.api.nvim_echo({
12+ { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
13+ { out, "WarningMsg" },
14+ { "\nPress any key to exit..." },
15+ }, true, {})
16+ vim.fn.getchar()
17+ os.exit(1)
18+ end
19+end
20+vim.opt.rtp:prepend(lazypath)
21+
22+function setup_treesitter()
23+ require'nvim-treesitter.configs'.setup {
24+ highlight = {
25+ enable = true,
26+ },
27+ indent = {
28+ enable = true
29+ },
30+ ensure_installed = {
31+ "bash",
32+ "c",
33+ "cmake",
34+ "dockerfile",
35+ "fish",
36+ "git_config",
37+ "git_rebase",
38+ "gitattributes",
39+ "gitcommit",
40+ "gitignore",
41+ "go",
42+ "gomod",
43+ "gosum",
44+ "html",
45+ "javascript",
46+ "json",
47+ "json5",
48+ "lua",
49+ "make",
50+ "markdown",
51+ "python",
52+ "r",
53+ "rust",
54+ "sql",
55+ "terraform",
56+ "toml",
57+ "tsx",
58+ "typescript",
59+ "typst",
60+ "vim",
61+ "vimdoc",
62+ "yaml",
63+ "zig",
64+ },
65+ }
66+end
67+
68+function setup_lsp()
69+ local opts = { noremap=true, silent=true }
70+ vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
71+ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
72+ -- Use an on_attach function to only map the following keys
73+ -- after the language server attaches to the current buffer
74+ local on_attach = function(client, bufnr)
75+ vim.lsp.completion.enable(true, client.id, bufnr, {
76+ autotrigger = true,
77+ convert = function(item)
78+ return { abbr = item.label:gsub('%b()', '') }
79+ end,
80+ })
81+ local bufopts = { noremap=true, silent=true, buffer=bufnr }
82+
83+ -- See `:help vim.lsp.*` for documentation on any of the below functions
84+ vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, bufopts)
85+ vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
86+ vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, bufopts)
87+ vim.keymap.set('n', '<leader>r', vim.lsp.buf.references, bufopts)
88+ vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
89+ vim.keymap.set('i', '<c-k>', vim.lsp.completion.get, bufopts)
90+ end
91+
92+ local nvim_lsp = require('lspconfig')
93+
94+ function handler(server_name)
95+ local opts = {
96+ capabilities = capabilities,
97+ on_attach = on_attach,
98+ }
99+
100+ if server_name == "denols" then
101+ opts.root_dir = nvim_lsp.util.root_pattern("deno.json", "deno.jsonc")
102+ elseif server_name == "ts_ls" then
103+ opts.root_dir = nvim_lsp.util.root_pattern("package.json")
104+ -- https://github.com/neovim/nvim-lspconfig/issues/2507#issuecomment-1471438640
105+ opts.single_file_support = false
106+ end
107+
108+ nvim_lsp[server_name].setup(opts)
109+ end
110+
111+ -- npm i -g vscode-langservers-extracted
112+ handler("cssls")
113+ handler("denols")
114+ handler("gopls")
115+ handler("html")
116+ handler("jsonls")
117+ -- npm i -g pyright
118+ handler("pyright")
119+ -- npm i -g typescript typescript-language-server
120+ handler("ts_ls")
121+ handler("zls")
122+end
123+
124+require("lazy").setup({
125+ rocks = {
126+ enabled = false,
127+ },
128+ spec = {
129+ {
130+ 'neovim/nvim-lspconfig',
131+ config = setup_lsp,
132+ },
133+ {
134+ 'nvim-treesitter/nvim-treesitter',
135+ build = ':TSUpdate',
136+ config = setup_treesitter
137+ },
138+ {
139+ 'ruifm/gitlinker.nvim',
140+ dependencies = 'nvim-lua/plenary.nvim',
141+ config = function()
142+ require"gitlinker".setup()
143+ end,
144+ },
145+ {
146+ 'Mofiqul/dracula.nvim',
147+ lazy = false,
148+ priority = 1000,
149+ config = function()
150+ require('dracula').setup({})
151+ vim.cmd[[colorscheme dracula]]
152+ end
153+ },
154+ {
155+ "ibhagwan/fzf-lua",
156+ config = function()
157+ local fzf = require('fzf-lua')
158+ local fzfFiles = function()
159+ fzf.files({
160+ winopts = {
161+ preview = { hidden = "hidden" },
162+ },
163+ })
164+ end
165+ vim.keymap.set("n", "<leader>s", fzfFiles, { desc = "Fzf Files", noremap=true, silent=true })
166+ vim.keymap.set("n", "<leader>f", fzf.buffers, { desc = "Fzf Buffers", noremap=true, silent=true })
167+ vim.keymap.set("n", "<leader>S", fzf.live_grep, { desc = "Fzf Grep", noremap=true, silent=true })
168+ fzf.setup({'max-perf'})
169+ end
170+ },
171+ {
172+ "christoomey/vim-tmux-navigator",
173+ cmd = { "TmuxNavigateLeft", "TmuxNavigateDown", "TmuxNavigateUp", "TmuxNavigateRight" },
174+ keys = {
175+ { "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
176+ { "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
177+ { "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
178+ { "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
179+ },
180+ },
181+ },
182+})
+0,
-177
1@@ -1,177 +0,0 @@
2-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3-if not (vim.uv or vim.loop).fs_stat(lazypath) then
4- local lazyrepo = "https://github.com/folke/lazy.nvim.git"
5- local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
6- if vim.v.shell_error ~= 0 then
7- vim.api.nvim_echo({
8- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
9- { out, "WarningMsg" },
10- { "\nPress any key to exit..." },
11- }, true, {})
12- vim.fn.getchar()
13- os.exit(1)
14- end
15-end
16-vim.opt.rtp:prepend(lazypath)
17-
18-function setup_treesitter()
19- require'nvim-treesitter.configs'.setup {
20- highlight = {
21- enable = true,
22- },
23- indent = {
24- enable = true
25- },
26- ensure_installed = {
27- "bash",
28- "c",
29- "cmake",
30- "dockerfile",
31- "fish",
32- "git_config",
33- "git_rebase",
34- "gitattributes",
35- "gitcommit",
36- "gitignore",
37- "go",
38- "gomod",
39- "gosum",
40- "html",
41- "javascript",
42- "json",
43- "json5",
44- "lua",
45- "make",
46- "markdown",
47- "python",
48- "r",
49- "rust",
50- "sql",
51- "terraform",
52- "toml",
53- "tsx",
54- "typescript",
55- "typst",
56- "vim",
57- "vimdoc",
58- "yaml",
59- "zig",
60- },
61- }
62-end
63-
64-function setup_lsp()
65- local opts = { noremap=true, silent=true }
66- vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
67- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
68- -- Use an on_attach function to only map the following keys
69- -- after the language server attaches to the current buffer
70- local on_attach = function(client, bufnr)
71- vim.lsp.completion.enable(true, client.id, bufnr, {
72- autotrigger = true,
73- convert = function(item)
74- return { abbr = item.label:gsub('%b()', '') }
75- end,
76- })
77- local bufopts = { noremap=true, silent=true, buffer=bufnr }
78-
79- -- See `:help vim.lsp.*` for documentation on any of the below functions
80- vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, bufopts)
81- vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
82- vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, bufopts)
83- vim.keymap.set('n', '<leader>r', vim.lsp.buf.references, bufopts)
84- vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
85- vim.keymap.set('i', '<c-k>', vim.lsp.completion.get, bufopts)
86- end
87-
88- local nvim_lsp = require('lspconfig')
89-
90- function handler(server_name)
91- local opts = {
92- capabilities = capabilities,
93- on_attach = on_attach,
94- }
95-
96- if server_name == "denols" then
97- opts.root_dir = nvim_lsp.util.root_pattern("deno.json", "deno.jsonc")
98- elseif server_name == "ts_ls" then
99- opts.root_dir = nvim_lsp.util.root_pattern("package.json")
100- -- https://github.com/neovim/nvim-lspconfig/issues/2507#issuecomment-1471438640
101- opts.single_file_support = false
102- end
103-
104- nvim_lsp[server_name].setup(opts)
105- end
106-
107- -- npm i -g vscode-langservers-extracted
108- handler("cssls")
109- handler("denols")
110- handler("gopls")
111- handler("html")
112- handler("jsonls")
113- -- npm i -g pyright
114- handler("pyright")
115- -- npm i -g typescript typescript-language-server
116- handler("ts_ls")
117- handler("zls")
118-end
119-
120-require("lazy").setup({
121- rocks = {
122- enabled = false,
123- },
124- spec = {
125- {
126- 'neovim/nvim-lspconfig',
127- config = setup_lsp,
128- },
129- {
130- 'nvim-treesitter/nvim-treesitter',
131- build = ':TSUpdate',
132- config = setup_treesitter
133- },
134- {
135- 'ruifm/gitlinker.nvim',
136- dependencies = 'nvim-lua/plenary.nvim',
137- config = function()
138- require"gitlinker".setup()
139- end,
140- },
141- {
142- 'Mofiqul/dracula.nvim',
143- lazy = false,
144- priority = 1000,
145- config = function()
146- require('dracula').setup({})
147- vim.cmd[[colorscheme dracula]]
148- end
149- },
150- {
151- "ibhagwan/fzf-lua",
152- config = function()
153- local fzf = require('fzf-lua')
154- local fzfFiles = function()
155- fzf.files({
156- winopts = {
157- preview = { hidden = "hidden" },
158- },
159- })
160- end
161- vim.keymap.set("n", "<leader>s", fzfFiles, { desc = "Fzf Files", noremap=true, silent=true })
162- vim.keymap.set("n", "<leader>f", fzf.buffers, { desc = "Fzf Buffers", noremap=true, silent=true })
163- vim.keymap.set("n", "<leader>S", fzf.live_grep, { desc = "Fzf Grep", noremap=true, silent=true })
164- fzf.setup({'max-perf'})
165- end
166- },
167- {
168- "christoomey/vim-tmux-navigator",
169- cmd = { "TmuxNavigateLeft", "TmuxNavigateDown", "TmuxNavigateUp", "TmuxNavigateRight" },
170- keys = {
171- { "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
172- { "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
173- { "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
174- { "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
175- },
176- },
177- },
178-})