diff options
| author | philw <dscr@duck.com> | 2025-04-09 23:32:22 +0200 |
|---|---|---|
| committer | philw <dscr@duck.com> | 2025-04-09 23:32:22 +0200 |
| commit | 4136551996e9233ef410c682afcd48c99af551b6 (patch) | |
| tree | a8f55d68061534dc7e452d3cbd77493d5a841a4f /init.lua | |
| parent | 10b08936e4d2b14a1e4ab5c3443323fc73f4499a (diff) | |
| download | neovim-4136551996e9233ef410c682afcd48c99af551b6.tar.gz neovim-4136551996e9233ef410c682afcd48c99af551b6.zip | |
Format file
Signed-off-by: philw <dscr@duck.com>
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 200 |
1 files changed, 107 insertions, 93 deletions
| @@ -31,7 +31,7 @@ option.laststatus = 0 | |||
| 31 | option.signcolumn = "number" | 31 | option.signcolumn = "number" |
| 32 | option.autoindent = true | 32 | option.autoindent = true |
| 33 | option.clipboard = "unnamedplus" | 33 | option.clipboard = "unnamedplus" |
| 34 | option.termguicolors = true | 34 | option.termguicolors = true |
| 35 | option.fillchars = "eob: " | 35 | option.fillchars = "eob: " |
| 36 | option.autoindent = true | 36 | option.autoindent = true |
| 37 | option.lazyredraw = false | 37 | option.lazyredraw = false |
| @@ -100,63 +100,56 @@ function ToggleVExplorer() | |||
| 100 | end | 100 | end |
| 101 | end | 101 | end |
| 102 | 102 | ||
| 103 | |||
| 104 | local function setup_autopairs() | 103 | local 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 | ||
| 120 | end | 114 | end |
| 121 | 115 | ||
| 122 | function set_highlights() | 116 | function 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 | |||
| 156 | for _, 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 | ||
| 160 | end | 153 | end |
| 161 | 154 | ||
| 162 | vim.o.background = "dark" | 155 | vim.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 | 164 | end |
| 172 | 165 | ||
| 173 | setup_autopairs() | 166 | setup_autopairs() |
| 174 | 167 | ||
| @@ -188,26 +181,29 @@ end | |||
| 188 | 181 | ||
| 189 | vim.opt.rtp:prepend(lazypath) | 182 | vim.opt.rtp:prepend(lazypath) |
| 190 | 183 | ||
| 191 | require("lazy").setup({ | 184 | require("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 | ||
| 212 | require("colorizer").setup() | 208 | require("colorizer").setup() |
| 213 | 209 | ||
| @@ -222,18 +218,26 @@ vim.api.nvim_create_autocmd( | |||
| 222 | 218 | ||
| 223 | local lsp_servers = {} | 219 | local lsp_servers = {} |
| 224 | 220 | ||
| 225 | require('lspconfig').clangd.setup({ | 221 | require("lspconfig").clangd.setup( |
| 226 | filetypes = { "c", "cpp", "objc", "objcpp" }, | 222 | { |
| 227 | }) | 223 | filetypes = {"c", "cpp", "objc", "objcpp"} |
| 228 | require('lspconfig').svelte.setup({ | 224 | } |
| 229 | filetypes = { "svelte" }, | 225 | ) |
| 230 | }) | 226 | require("lspconfig").svelte.setup( |
| 231 | require('lspconfig').ts_ls.setup({ | 227 | { |
| 232 | filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, | 228 | filetypes = {"svelte"} |
| 233 | }) | 229 | } |
| 234 | require('lspconfig').rust_analyzer.setup({ | 230 | ) |
| 235 | filetypes = { "rust" }, | 231 | require("lspconfig").ts_ls.setup( |
| 236 | }) | 232 | { |
| 233 | filetypes = {"typescript", "typescriptreact", "javascript", "javascriptreact"} | ||
| 234 | } | ||
| 235 | ) | ||
| 236 | require("lspconfig").rust_analyzer.setup( | ||
| 237 | { | ||
| 238 | filetypes = {"rust"} | ||
| 239 | } | ||
| 240 | ) | ||
| 237 | 241 | ||
| 238 | local server_maps = function(opts) | 242 | local server_maps = function(opts) |
| 239 | end | 243 | end |
| @@ -267,17 +271,27 @@ vim.keymap.set("n", "j", "5j") | |||
| 267 | vim.keymap.set("n", "k", "5k") | 271 | vim.keymap.set("n", "k", "5k") |
| 268 | vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") | 272 | vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") |
| 269 | vim.keymap.set("n", "<leader>f", "<cmd>FzfLua files<cr>") | 273 | vim.keymap.set("n", "<leader>f", "<cmd>FzfLua files<cr>") |
| 270 | vim.keymap.set("n", "<leader>F", "<cmd>FzfLua live_grep<cr>", { noremap = true, silent = true }) | 274 | vim.keymap.set("n", "<leader>F", "<cmd>FzfLua live_grep<cr>", {noremap = true, silent = true}) |
| 271 | vim.keymap.set("n", "<leader>b", "<cmd>FzfLua buffers<cr>") | 275 | vim.keymap.set("n", "<leader>b", "<cmd>FzfLua buffers<cr>") |
| 272 | vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts) | 276 | vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts) |
| 273 | vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts) | 277 | vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts) |
| 274 | vim.keymap.set('n', '<leader>r', color_mode, {desc = "Change mode light/dark"}) | 278 | vim.keymap.set("n", "<leader>r", color_mode, {desc = "Change mode light/dark"}) |
| 275 | vim.keymap.set("n", "<leader>t", function() | 279 | vim.keymap.set( |
| 276 | vim.cmd("terminal") | 280 | "n", |
| 277 | vim.cmd("startinsert") | 281 | "<leader>t", |
| 278 | end, { 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 | ||
| 280 | vim.keymap.set('t', '<Esc>', function() | 289 | vim.keymap.set( |
| 281 | vim.cmd([[stopinsert]]) | 290 | "t", |
| 282 | vim.cmd([[b#]]) | 291 | "<Esc>", |
| 283 | end, { noremap = true, silent = true }) | 292 | function() |
| 293 | vim.cmd([[stopinsert]]) | ||
| 294 | vim.cmd([[b#]]) | ||
| 295 | end, | ||
| 296 | {noremap = true, silent = true} | ||
| 297 | ) | ||
