From 4136551996e9233ef410c682afcd48c99af551b6 Mon Sep 17 00:00:00 2001 From: philw Date: Wed, 9 Apr 2025 23:32:22 +0200 Subject: Format file Signed-off-by: philw --- init.lua | 200 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 107 insertions(+), 93 deletions(-) (limited to 'init.lua') 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 option.signcolumn = "number" option.autoindent = true option.clipboard = "unnamedplus" -option.termguicolors = true +option.termguicolors = true option.fillchars = "eob: " option.autoindent = true option.lazyredraw = false @@ -100,63 +100,56 @@ function ToggleVExplorer() end end - local function setup_autopairs() - local autopairs = { - ["("] = ")", - ["["] = "]", - ["{"] = "}", - ["<"] = ">", - } + local autopairs = { + ["("] = ")", + ["["] = "]", + ["{"] = "}", + ["<"] = ">" + } - for open, close in pairs(autopairs) do - vim.api.nvim_set_keymap( - 'i', - open, - open .. close .. "", - { noremap = true, silent = true } - ) - end + for open, close in pairs(autopairs) do + vim.api.nvim_set_keymap("i", open, open .. close .. "", {noremap = true, silent = true}) + end end function set_highlights() - local highlights = { - {"GitGutterAdd", {bg = "none"}}, - {"GitGutterDelete", {bg = "none"}}, - {"GitGutterChange", {bg = "none"}}, - {"GitGutterChangeAdd", {bg = "none"}}, - {"GitGutterChangeDelete", {bg = "none"}}, - {"NonText", {fg = "none"}}, - {"EndOfBuffer", {fg = "none", bg = "none"}}, - {"SignColumn", {bg = "none"}}, - {"StatusLine", {bg = "none", fg = "none"}}, - {"StatusLineNc", {bg = "none", fg = "none"}}, - {"NvimTreeWinSeparator", {fg = "none"}}, - {"CursorColumn", {fg = "none"}}, - {"CursorLine", {bg = "none"}}, - {"VertSplit", {bg = "none"}}, - {"DiagnosticError", {bg = "none"}}, - {"DiagnosticWarn", {bg = "none"}}, - {"DiagnosticInfo", {bg = "none"}}, - {"DiagnosticHint", {bg = "none"}}, - {"Pmenu", {bg = "none"}}, - {"DiagnosticVirtualTextError", {bg = "none"}}, - {"DiagnosticVirtualTextWarn", {bg = "none"}}, - {"DiagnosticVirtualTextInfo", {bg = "none"}}, - {"DiagnosticVirtualTextHint", {bg = "none"}}, - {"LspFloatWinNormal", {bg = "none"}}, - {"NormalFloat", {bg = "none"}}, - {"LineNr", {bg = "none"}}, - {"DiagnosticVirtualError", {bg = "none"}}, - {"DiagnosticVirtualWarn", {bg = "none"}}, - {"DiagnosticVirtualInfo", {bg = "none"}}, - {"DiagnosticVirtualHint", {bg = "none"}} -} - -for _, hl in ipairs(highlights) do - vim.api.nvim_set_hl(0, hl[1], hl[2]) - end + local highlights = { + {"GitGutterAdd", {bg = "none"}}, + {"GitGutterDelete", {bg = "none"}}, + {"GitGutterChange", {bg = "none"}}, + {"GitGutterChangeAdd", {bg = "none"}}, + {"GitGutterChangeDelete", {bg = "none"}}, + {"NonText", {fg = "none"}}, + {"EndOfBuffer", {fg = "none", bg = "none"}}, + {"SignColumn", {bg = "none"}}, + {"StatusLine", {bg = "none", fg = "none"}}, + {"StatusLineNc", {bg = "none", fg = "none"}}, + {"NvimTreeWinSeparator", {fg = "none"}}, + {"CursorColumn", {fg = "none"}}, + {"CursorLine", {bg = "none"}}, + {"VertSplit", {bg = "none"}}, + {"DiagnosticError", {bg = "none"}}, + {"DiagnosticWarn", {bg = "none"}}, + {"DiagnosticInfo", {bg = "none"}}, + {"DiagnosticHint", {bg = "none"}}, + {"Pmenu", {bg = "none"}}, + {"DiagnosticVirtualTextError", {bg = "none"}}, + {"DiagnosticVirtualTextWarn", {bg = "none"}}, + {"DiagnosticVirtualTextInfo", {bg = "none"}}, + {"DiagnosticVirtualTextHint", {bg = "none"}}, + {"LspFloatWinNormal", {bg = "none"}}, + {"NormalFloat", {bg = "none"}}, + {"LineNr", {bg = "none"}}, + {"DiagnosticVirtualError", {bg = "none"}}, + {"DiagnosticVirtualWarn", {bg = "none"}}, + {"DiagnosticVirtualInfo", {bg = "none"}}, + {"DiagnosticVirtualHint", {bg = "none"}} + } + for _, hl in ipairs(highlights) do + vim.api.nvim_set_hl(0, hl[1], hl[2]) + end end vim.o.background = "dark" @@ -168,7 +161,7 @@ function color_mode() vim.o.background = "dark" end set_highlights() - end +end setup_autopairs() @@ -188,26 +181,29 @@ end vim.opt.rtp:prepend(lazypath) -require("lazy").setup({ - { - "ibhagwan/fzf-lua", - opts = {} -}, - { "airblade/vim-gitgutter" }, - { "norcalli/nvim-colorizer.lua" }, +require("lazy").setup( { - "neovim/nvim-lspconfig", - lazy = false, - dependencies = { - { "ms-jpq/coq_nvim", branch = "coq" }, - { "ms-jpq/coq.artifacts", branch = "artifacts" }, + { + "ibhagwan/fzf-lua", + opts = {} }, - init = function() - vim.g.coq_settings = { auto_start = "shut-up", - } - end - }, -}) + {"airblade/vim-gitgutter"}, + {"norcalli/nvim-colorizer.lua"}, + { + "neovim/nvim-lspconfig", + lazy = false, + dependencies = { + {"ms-jpq/coq_nvim", branch = "coq"}, + {"ms-jpq/coq.artifacts", branch = "artifacts"} + }, + init = function() + vim.g.coq_settings = { + auto_start = "shut-up" + } + end + } + } +) require("colorizer").setup() @@ -222,18 +218,26 @@ vim.api.nvim_create_autocmd( local lsp_servers = {} -require('lspconfig').clangd.setup({ - filetypes = { "c", "cpp", "objc", "objcpp" }, -}) -require('lspconfig').svelte.setup({ - filetypes = { "svelte" }, -}) -require('lspconfig').ts_ls.setup({ - filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, -}) -require('lspconfig').rust_analyzer.setup({ - filetypes = { "rust" }, -}) +require("lspconfig").clangd.setup( + { + filetypes = {"c", "cpp", "objc", "objcpp"} + } +) +require("lspconfig").svelte.setup( + { + filetypes = {"svelte"} + } +) +require("lspconfig").ts_ls.setup( + { + filetypes = {"typescript", "typescriptreact", "javascript", "javascriptreact"} + } +) +require("lspconfig").rust_analyzer.setup( + { + filetypes = {"rust"} + } +) local server_maps = function(opts) end @@ -267,17 +271,27 @@ vim.keymap.set("n", "j", "5j") vim.keymap.set("n", "k", "5k") vim.keymap.set("v", "K", ":m '<-2gv=gv") vim.keymap.set("n", "f", "FzfLua files") -vim.keymap.set("n", "F", "FzfLua live_grep", { noremap = true, silent = true }) +vim.keymap.set("n", "F", "FzfLua live_grep", {noremap = true, silent = true}) vim.keymap.set("n", "b", "FzfLua buffers") vim.keymap.set("n", "d", vim.lsp.buf.definition, opts) vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) -vim.keymap.set('n', 'r', color_mode, {desc = "Change mode light/dark"}) -vim.keymap.set("n", "t", function() - vim.cmd("terminal") - vim.cmd("startinsert") -end, { desc = "Open terminal in current window" }) +vim.keymap.set("n", "r", color_mode, {desc = "Change mode light/dark"}) +vim.keymap.set( + "n", + "t", + function() + vim.cmd("terminal") + vim.cmd("startinsert") + end, + {desc = "Open terminal in current window"} +) -vim.keymap.set('t', '', function() - vim.cmd([[stopinsert]]) - vim.cmd([[b#]]) -end, { noremap = true, silent = true }) +vim.keymap.set( + "t", + "", + function() + vim.cmd([[stopinsert]]) + vim.cmd([[b#]]) + end, + {noremap = true, silent = true} +) -- cgit v1.2.3