aboutsummaryrefslogtreecommitdiffstats
path: root/init.lua
diff options
context:
space:
mode:
authorphilw <dscr@duck.com>2025-04-09 23:32:22 +0200
committerphilw <dscr@duck.com>2025-04-09 23:32:22 +0200
commit4136551996e9233ef410c682afcd48c99af551b6 (patch)
treea8f55d68061534dc7e452d3cbd77493d5a841a4f /init.lua
parent10b08936e4d2b14a1e4ab5c3443323fc73f4499a (diff)
downloadneovim-4136551996e9233ef410c682afcd48c99af551b6.tar.gz
neovim-4136551996e9233ef410c682afcd48c99af551b6.zip
Format file
Signed-off-by: philw <dscr@duck.com>
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua200
1 files changed, 107 insertions, 93 deletions
diff --git a/init.lua b/init.lua
index f710136..43b7373 100644
--- a/init.lua
+++ b/init.lua
@@ -31,7 +31,7 @@ option.laststatus = 0
31option.signcolumn = "number" 31option.signcolumn = "number"
32option.autoindent = true 32option.autoindent = true
33option.clipboard = "unnamedplus" 33option.clipboard = "unnamedplus"
34option.termguicolors = true 34option.termguicolors = true
35option.fillchars = "eob: " 35option.fillchars = "eob: "
36option.autoindent = true 36option.autoindent = true
37option.lazyredraw = false 37option.lazyredraw = false
@@ -100,63 +100,56 @@ function ToggleVExplorer()
100 end 100 end
101end 101end
102 102
103
104local function setup_autopairs() 103local function setup_autopairs()
105 local autopairs = { 104 local autopairs = {
106 ["("] = ")", 105 ["("] = ")",
107 ["["] = "]", 106 ["["] = "]",
108 ["{"] = "}", 107 ["{"] = "}",
109 ["<"] = ">", 108 ["<"] = ">"
110 } 109 }
111 110
112 for open, close in pairs(autopairs) do 111 for open, close in pairs(autopairs) do
113 vim.api.nvim_set_keymap( 112 vim.api.nvim_set_keymap("i", open, open .. close .. "<Left>", {noremap = true, silent = true})
114 'i', 113 end
115 open,
116 open .. close .. "<Left>",
117 { noremap = true, silent = true }
118 )
119 end
120end 114end
121 115
122function set_highlights() 116function set_highlights()
123 local highlights = { 117 local highlights = {
124 {"GitGutterAdd", {bg = "none"}}, 118 {"GitGutterAdd", {bg = "none"}},
125 {"GitGutterDelete", {bg = "none"}}, 119 {"GitGutterDelete", {bg = "none"}},
126 {"GitGutterChange", {bg = "none"}}, 120 {"GitGutterChange", {bg = "none"}},
127 {"GitGutterChangeAdd", {bg = "none"}}, 121 {"GitGutterChangeAdd", {bg = "none"}},
128 {"GitGutterChangeDelete", {bg = "none"}}, 122 {"GitGutterChangeDelete", {bg = "none"}},
129 {"NonText", {fg = "none"}}, 123 {"NonText", {fg = "none"}},
130 {"EndOfBuffer", {fg = "none", bg = "none"}}, 124 {"EndOfBuffer", {fg = "none", bg = "none"}},
131 {"SignColumn", {bg = "none"}}, 125 {"SignColumn", {bg = "none"}},
132 {"StatusLine", {bg = "none", fg = "none"}}, 126 {"StatusLine", {bg = "none", fg = "none"}},
133 {"StatusLineNc", {bg = "none", fg = "none"}}, 127 {"StatusLineNc", {bg = "none", fg = "none"}},
134 {"NvimTreeWinSeparator", {fg = "none"}}, 128 {"NvimTreeWinSeparator", {fg = "none"}},
135 {"CursorColumn", {fg = "none"}}, 129 {"CursorColumn", {fg = "none"}},
136 {"CursorLine", {bg = "none"}}, 130 {"CursorLine", {bg = "none"}},
137 {"VertSplit", {bg = "none"}}, 131 {"VertSplit", {bg = "none"}},
138 {"DiagnosticError", {bg = "none"}}, 132 {"DiagnosticError", {bg = "none"}},
139 {"DiagnosticWarn", {bg = "none"}}, 133 {"DiagnosticWarn", {bg = "none"}},
140 {"DiagnosticInfo", {bg = "none"}}, 134 {"DiagnosticInfo", {bg = "none"}},
141 {"DiagnosticHint", {bg = "none"}}, 135 {"DiagnosticHint", {bg = "none"}},
142 {"Pmenu", {bg = "none"}}, 136 {"Pmenu", {bg = "none"}},
143 {"DiagnosticVirtualTextError", {bg = "none"}}, 137 {"DiagnosticVirtualTextError", {bg = "none"}},
144 {"DiagnosticVirtualTextWarn", {bg = "none"}}, 138 {"DiagnosticVirtualTextWarn", {bg = "none"}},
145 {"DiagnosticVirtualTextInfo", {bg = "none"}}, 139 {"DiagnosticVirtualTextInfo", {bg = "none"}},
146 {"DiagnosticVirtualTextHint", {bg = "none"}}, 140 {"DiagnosticVirtualTextHint", {bg = "none"}},
147 {"LspFloatWinNormal", {bg = "none"}}, 141 {"LspFloatWinNormal", {bg = "none"}},
148 {"NormalFloat", {bg = "none"}}, 142 {"NormalFloat", {bg = "none"}},
149 {"LineNr", {bg = "none"}}, 143 {"LineNr", {bg = "none"}},
150 {"DiagnosticVirtualError", {bg = "none"}}, 144 {"DiagnosticVirtualError", {bg = "none"}},
151 {"DiagnosticVirtualWarn", {bg = "none"}}, 145 {"DiagnosticVirtualWarn", {bg = "none"}},
152 {"DiagnosticVirtualInfo", {bg = "none"}}, 146 {"DiagnosticVirtualInfo", {bg = "none"}},
153 {"DiagnosticVirtualHint", {bg = "none"}} 147 {"DiagnosticVirtualHint", {bg = "none"}}
154} 148 }
155
156for _, hl in ipairs(highlights) do
157 vim.api.nvim_set_hl(0, hl[1], hl[2])
158 end
159 149
150 for _, hl in ipairs(highlights) do
151 vim.api.nvim_set_hl(0, hl[1], hl[2])
152 end
160end 153end
161 154
162vim.o.background = "dark" 155vim.o.background = "dark"
@@ -168,7 +161,7 @@ function color_mode()
168 vim.o.background = "dark" 161 vim.o.background = "dark"
169 end 162 end
170 set_highlights() 163 set_highlights()
171 end 164end
172 165
173setup_autopairs() 166setup_autopairs()
174 167
@@ -188,26 +181,29 @@ end
188 181
189vim.opt.rtp:prepend(lazypath) 182vim.opt.rtp:prepend(lazypath)
190 183
191require("lazy").setup({ 184require("lazy").setup(
192 {
193 "ibhagwan/fzf-lua",
194 opts = {}
195},
196 { "airblade/vim-gitgutter" },
197 { "norcalli/nvim-colorizer.lua" },
198 { 185 {
199 "neovim/nvim-lspconfig", 186 {
200 lazy = false, 187 "ibhagwan/fzf-lua",
201 dependencies = { 188 opts = {}
202 { "ms-jpq/coq_nvim", branch = "coq" },
203 { "ms-jpq/coq.artifacts", branch = "artifacts" },
204 }, 189 },
205 init = function() 190 {"airblade/vim-gitgutter"},
206 vim.g.coq_settings = { auto_start = "shut-up", 191 {"norcalli/nvim-colorizer.lua"},
207 } 192 {
208 end 193 "neovim/nvim-lspconfig",
209 }, 194 lazy = false,
210}) 195 dependencies = {
196 {"ms-jpq/coq_nvim", branch = "coq"},
197 {"ms-jpq/coq.artifacts", branch = "artifacts"}
198 },
199 init = function()
200 vim.g.coq_settings = {
201 auto_start = "shut-up"
202 }
203 end
204 }
205 }
206)
211 207
212require("colorizer").setup() 208require("colorizer").setup()
213 209
@@ -222,18 +218,26 @@ vim.api.nvim_create_autocmd(
222 218
223local lsp_servers = {} 219local lsp_servers = {}
224 220
225require('lspconfig').clangd.setup({ 221require("lspconfig").clangd.setup(
226 filetypes = { "c", "cpp", "objc", "objcpp" }, 222 {
227}) 223 filetypes = {"c", "cpp", "objc", "objcpp"}
228require('lspconfig').svelte.setup({ 224 }
229 filetypes = { "svelte" }, 225)
230}) 226require("lspconfig").svelte.setup(
231require('lspconfig').ts_ls.setup({ 227 {
232 filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, 228 filetypes = {"svelte"}
233}) 229 }
234require('lspconfig').rust_analyzer.setup({ 230)
235 filetypes = { "rust" }, 231require("lspconfig").ts_ls.setup(
236}) 232 {
233 filetypes = {"typescript", "typescriptreact", "javascript", "javascriptreact"}
234 }
235)
236require("lspconfig").rust_analyzer.setup(
237 {
238 filetypes = {"rust"}
239 }
240)
237 241
238local server_maps = function(opts) 242local server_maps = function(opts)
239end 243end
@@ -267,17 +271,27 @@ vim.keymap.set("n", "j", "5j")
267vim.keymap.set("n", "k", "5k") 271vim.keymap.set("n", "k", "5k")
268vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") 272vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
269vim.keymap.set("n", "<leader>f", "<cmd>FzfLua files<cr>") 273vim.keymap.set("n", "<leader>f", "<cmd>FzfLua files<cr>")
270vim.keymap.set("n", "<leader>F", "<cmd>FzfLua live_grep<cr>", { noremap = true, silent = true }) 274vim.keymap.set("n", "<leader>F", "<cmd>FzfLua live_grep<cr>", {noremap = true, silent = true})
271vim.keymap.set("n", "<leader>b", "<cmd>FzfLua buffers<cr>") 275vim.keymap.set("n", "<leader>b", "<cmd>FzfLua buffers<cr>")
272vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts) 276vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts)
273vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts) 277vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts)
274vim.keymap.set('n', '<leader>r', color_mode, {desc = "Change mode light/dark"}) 278vim.keymap.set("n", "<leader>r", color_mode, {desc = "Change mode light/dark"})
275vim.keymap.set("n", "<leader>t", function() 279vim.keymap.set(
276 vim.cmd("terminal") 280 "n",
277 vim.cmd("startinsert") 281 "<leader>t",
278end, { desc = "Open terminal in current window" }) 282 function()
283 vim.cmd("terminal")
284 vim.cmd("startinsert")
285 end,
286 {desc = "Open terminal in current window"}
287)
279 288
280vim.keymap.set('t', '<Esc>', function() 289vim.keymap.set(
281 vim.cmd([[stopinsert]]) 290 "t",
282 vim.cmd([[b#]]) 291 "<Esc>",
283end, { noremap = true, silent = true }) 292 function()
293 vim.cmd([[stopinsert]])
294 vim.cmd([[b#]])
295 end,
296 {noremap = true, silent = true}
297)