diff --git a/.husky/pre-commit b/.husky/pre-commit index fda453f..b214b95 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -24,10 +24,14 @@ fi staged_lua=$(echo "$staged_files" | grep '.lua$' || true) num_staged_lua=$(echo "$staged_lua" | grep -vce '^$' || true) if [ "$num_staged_lua" -gt 0 ]; then - printf '\nFormatting %s staged Lua files with lua-format\n' "$num_staged_lua" - stylua "$staged_lua" + printf '\nFormatting %s staged Lua files with stylua\n' "$num_staged_lua" + + for file in $staged_lua;do + stylua "$file" + done + printf "Re-staging\n\n" - git add "$staged_lua" + git add $staged_lua fi # Run shfmt on staged shell scripts diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index 3763bcd..29c6b90 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -1,3 +1,3 @@ -require('keybinds') -require('settings') -require('plugins.init') +require("keybinds") +require("settings") +require("plugins.init") diff --git a/home/.config/nvim/lua/keybinds.lua b/home/.config/nvim/lua/keybinds.lua index 1aa69c2..07bc29d 100644 --- a/home/.config/nvim/lua/keybinds.lua +++ b/home/.config/nvim/lua/keybinds.lua @@ -1,11 +1,11 @@ local map = vim.keymap.set -- Navigate between buffers -map('n', '', vim.cmd.bn, {silent = true}) -map('n', '', vim.cmd.bp, {silent = true}) +map("n", "", vim.cmd.bn, { silent = true }) +map("n", "", vim.cmd.bp, { silent = true }) -- Run Neoformat -map('n', '', vim.cmd.Neoformat, {}) +map("n", "", vim.cmd.Neoformat, {}) -- Exit terminal insert mode with esc -map('t', '', '', {}) +map("t", "", "", {}) diff --git a/home/.config/nvim/lua/pager.lua b/home/.config/nvim/lua/pager.lua index 5641745..aea0b8d 100644 --- a/home/.config/nvim/lua/pager.lua +++ b/home/.config/nvim/lua/pager.lua @@ -1,2 +1,2 @@ -- Settings for pager mode -vim.keymap.set('n', 'q', vim.cmd.q) +vim.keymap.set("n", "q", vim.cmd.q) diff --git a/home/.config/nvim/lua/plugins/cmp.lua b/home/.config/nvim/lua/plugins/cmp.lua index 414d4f8..146f206 100644 --- a/home/.config/nvim/lua/plugins/cmp.lua +++ b/home/.config/nvim/lua/plugins/cmp.lua @@ -1,56 +1,65 @@ return function() - local cmp = require('cmp') - local luasnip = require('luasnip') + local cmp = require("cmp") + local luasnip = require("luasnip") - if not cmp then return end + if not cmp then + return + end - -- Setup git completion source - require("cmp_git").setup() + -- Setup git completion source + require("cmp_git").setup() - -- Set completeopt to have a better completion experience - vim.o.completeopt = 'menuone,noselect' + -- Set completeopt to have a better completion experience + vim.o.completeopt = "menuone,noselect" - cmp.setup { - snippet = {expand = function(args) luasnip.lsp_expand(args.body) end}, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end - }, - sources = { - {name = 'buffer'}, {name = 'git'}, {name = 'luasnip'}, - {name = 'nvim_lsp'}, {name = 'nvim_lua'}, {name = 'path'} - } - } - - -- Enable autopairs when enter is processed - -- on completion - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, + }, + sources = { + { name = "buffer" }, + { name = "git" }, + { name = "luasnip" }, + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "path" }, + }, + }) + -- Enable autopairs when enter is processed + -- on completion + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) end diff --git a/home/.config/nvim/lua/plugins/indent-blankline.lua b/home/.config/nvim/lua/plugins/indent-blankline.lua index f48e612..ca8dbf4 100644 --- a/home/.config/nvim/lua/plugins/indent-blankline.lua +++ b/home/.config/nvim/lua/plugins/indent-blankline.lua @@ -1,8 +1,8 @@ return function() - vim.opt.list = true - require('indent_blankline').setup { - space_char_blankline = ' ', - show_current_context = true, - show_current_context_start = true - } + vim.opt.list = true + require("indent_blankline").setup({ + space_char_blankline = " ", + show_current_context = true, + show_current_context_start = true, + }) end diff --git a/home/.config/nvim/lua/plugins/init.lua b/home/.config/nvim/lua/plugins/init.lua index aa949b3..de36bce 100644 --- a/home/.config/nvim/lua/plugins/init.lua +++ b/home/.config/nvim/lua/plugins/init.lua @@ -1,202 +1,219 @@ local fn = vim.fn -- Install packer if it's not yet installed -local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" if fn.empty(fn.glob(install_path)) > 0 then - print('Installing Packer') - Packer_bootstrap = fn.system({ - 'git', 'clone', '--depth', '1', - 'https://github.com/wbthomason/packer.nvim', install_path - }) - vim.cmd [[packadd packer.nvim]] - print('Installed Packer') + print("Installing Packer") + Packer_bootstrap = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) + vim.cmd([[packadd packer.nvim]]) + print("Installed Packer") end -- Configure packer -require('packer').startup(function() - local use = require('packer').use +require("packer").startup(function() + local use = require("packer").use - -- The plugin manager itself - use {'wbthomason/packer.nvim'} + -- The plugin manager itself + use({ "wbthomason/packer.nvim" }) - -- Colorscheme - use { - 'rebelot/kanagawa.nvim', - config = function() vim.cmd('colorscheme kanagawa') end - } + -- Colorscheme + use({ + "rebelot/kanagawa.nvim", + config = function() + vim.cmd("colorscheme kanagawa") + end, + }) - -- Statusline - use { - 'nvim-lualine/lualine.nvim', - requires = {'kyazdani42/nvim-web-devicons', opt = true}, - config = require('plugins.lualine') - } + -- Statusline + use({ + "nvim-lualine/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, + config = require("plugins.lualine"), + }) - -- Startup screen/dashboard - --use 'glepnir/dashboard-nvim' + -- Startup screen/dashboard + --use 'glepnir/dashboard-nvim' - -- Git in signcolumn - use 'airblade/vim-gitgutter' + -- Git in signcolumn + use("airblade/vim-gitgutter") - -- Tabline/bufferline - use { - 'akinsho/nvim-bufferline.lua', - tag = '*', - requires = 'kyazdani42/nvim-web-devicons', - config = function() require('bufferline').setup {} end - } + -- Tabline/bufferline + use({ + "akinsho/nvim-bufferline.lua", + tag = "*", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("bufferline").setup({}) + end, + }) - -- Git commands - use 'tpope/vim-fugitive' + -- Git commands + use("tpope/vim-fugitive") - -- Indent characters - use { - 'lukas-reineke/indent-blankline.nvim', - config = require('plugins.indent-blankline') - } + -- Indent characters + use({ + "lukas-reineke/indent-blankline.nvim", + config = require("plugins.indent-blankline"), + }) - -- Tree explorer - use { - 'kyazdani42/nvim-tree.lua', - requires = 'kyazdani42/nvim-web-devicons', - config = require('plugins.nvim-tree') - } + -- Tree explorer + use({ + "kyazdani42/nvim-tree.lua", + requires = "kyazdani42/nvim-web-devicons", + config = require("plugins.nvim-tree"), + }) - -- Telescope - use { - 'nvim-telescope/telescope.nvim', - config = require('plugins.telescope'), - requires = { - {'nvim-lua/plenary.nvim'}, -- Internal dep for telescope - {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}, -- Use fzf for fuzzy finder - {'nvim-telescope/telescope-ui-select.nvim'}, -- Replace vim built in select with telescope - {'zane-/cder.nvim'}, -- cd plugin for telescope - } - } + -- Telescope + use({ + "nvim-telescope/telescope.nvim", + config = require("plugins.telescope"), + requires = { + { "nvim-lua/plenary.nvim" }, -- Internal dep for telescope + { "nvim-telescope/telescope-fzf-native.nvim", run = "make" }, -- Use fzf for fuzzy finder + { "nvim-telescope/telescope-ui-select.nvim" }, -- Replace vim built in select with telescope + { "zane-/cder.nvim" }, -- cd plugin for telescope + }, + }) - -- Do stuff as sudo - use 'lambdalisue/suda.vim' + -- Do stuff as sudo + use("lambdalisue/suda.vim") - -- Display possible keybinds - use {'folke/which-key.nvim', config = require('plugins.which-key')} + -- Display possible keybinds + use({ "folke/which-key.nvim", config = require("plugins.which-key") }) - -- Read editorconfig settings - use 'editorconfig/editorconfig-vim' + -- Read editorconfig settings + use("editorconfig/editorconfig-vim") - -- Package manager for LSP servers, DAP servers etc. - use {'williamboman/mason.nvim', config = require('plugins.mason').setup} + -- Package manager for LSP servers, DAP servers etc. + use({ "williamboman/mason.nvim", config = require("plugins.mason").setup }) - -- Install LSP server executables with Mason - use { - 'williamboman/mason-lspconfig.nvim', - config = require('plugins.mason').lspconfig_setup - } + -- Install LSP server executables with Mason + use({ + "williamboman/mason-lspconfig.nvim", + config = require("plugins.mason").lspconfig_setup, + }) - -- Configs for built-in LSP - use {'neovim/nvim-lspconfig', config = require('plugins.lspconfig').setup} + -- Configs for built-in LSP + use({ "neovim/nvim-lspconfig", config = require("plugins.lspconfig").setup }) - -- Additional LSP features for Java - use 'mfussenegger/nvim-jdtls' + -- Additional LSP features for Java + use("mfussenegger/nvim-jdtls") - -- Display function signature - use 'ray-x/lsp_signature.nvim' + -- Display function signature + use("ray-x/lsp_signature.nvim") - -- Snippets plugin - use { - 'L3MON4D3/LuaSnip', - requires = {'rafamadriz/friendly-snippets'}, -- Snippets collection - config = require('plugins.luasnip') - } + -- Snippets plugin + use({ + "L3MON4D3/LuaSnip", + requires = { "rafamadriz/friendly-snippets" }, -- Snippets collection + config = require("plugins.luasnip"), + }) - -- vim api documentation for lua lsp - use {'ii14/emmylua-nvim'} + -- vim api documentation for lua lsp + use({ "ii14/emmylua-nvim" }) - -- Completion - use { - 'hrsh7th/nvim-cmp', - requires = { - {'hrsh7th/cmp-buffer'}, -- Buffer source - {'petertriho/cmp-git', requires = 'nvim-lua/plenary.nvim'}, -- Git source - {'hrsh7th/cmp-nvim-lsp'}, -- LSP source - {'hrsh7th/cmp-nvim-lua'}, -- Neovim Lua API documentation source - {'hrsh7th/cmp-path'}, -- Path source - {'saadparwaiz1/cmp_luasnip'} -- Snippets source - }, - config = require('plugins.cmp') - } + -- Completion + use({ + "hrsh7th/nvim-cmp", + requires = { + { "hrsh7th/cmp-buffer" }, -- Buffer source + { "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" }, -- Git source + { "hrsh7th/cmp-nvim-lsp" }, -- LSP source + { "hrsh7th/cmp-nvim-lua" }, -- Neovim Lua API documentation source + { "hrsh7th/cmp-path" }, -- Path source + { "saadparwaiz1/cmp_luasnip" }, -- Snippets source + }, + config = require("plugins.cmp"), + }) - -- Automatic brackets - use { - 'windwp/nvim-autopairs', - config = function() require('nvim-autopairs').setup {} end - } + -- Automatic brackets + use({ + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup({}) + end, + }) - -- treesitter - use { - 'nvim-treesitter/nvim-treesitter', - run = function() - require('nvim-treesitter.install').update({with_sync = true}) - end, - config = require('plugins.treesitter') - } + -- treesitter + use({ + "nvim-treesitter/nvim-treesitter", + run = function() + require("nvim-treesitter.install").update({ with_sync = true }) + end, + config = require("plugins.treesitter"), + }) - -- treesitter plugin for commentstring - use 'JoosepAlviste/nvim-ts-context-commentstring' + -- treesitter plugin for commentstring + use("JoosepAlviste/nvim-ts-context-commentstring") - -- Additional plugins for formats not supported - -- by treesitter - use 'jamespeapen/swayconfig.vim' + -- Additional plugins for formats not supported + -- by treesitter + use("jamespeapen/swayconfig.vim") - -- mappings for commenting in code - use 'tpope/vim-commentary' + -- mappings for commenting in code + use("tpope/vim-commentary") - -- we all know this one - use 'tpope/vim-surround' + -- we all know this one + use("tpope/vim-surround") - -- Formatter plugin - use 'sbdchd/neoformat' + -- Formatter plugin + use("sbdchd/neoformat") - -- Make editing passwords safer - use { - 'https://git.zx2c4.com/password-store', - rtp = 'contrib/vim/redact_pass.vim' - } + -- Make editing passwords safer + use({ + "https://git.zx2c4.com/password-store", + rtp = "contrib/vim/redact_pass.vim", + }) - -- Neovim inside Firefox - use { - 'glacambre/firenvim', - run = function() vim.fn['firenvim#install'](0) end - } + -- Neovim inside Firefox + use({ + "glacambre/firenvim", + run = function() + vim.fn["firenvim#install"](0) + end, + }) - -- Vim <3 Asciidoctor - use 'habamax/vim-asciidoctor' + -- Vim <3 Asciidoctor + use("habamax/vim-asciidoctor") - -- Markdown preview - use({ - 'iamcco/markdown-preview.nvim', - run = 'cd app && npm install', - setup = function() vim.g.mkdp_filetypes = {'markdown'} end, - ft = {'markdown'} - }) + -- Markdown preview + use({ + "iamcco/markdown-preview.nvim", + run = "cd app && npm install", + setup = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }) - -- Edit GPG encrypted files transparently - use 'jamessan/vim-gnupg' + -- Edit GPG encrypted files transparently + use("jamessan/vim-gnupg") - -- High performance color highlighter - use { - 'norcalli/nvim-colorizer.lua', - config = function() require('colorizer').setup() end - } - - -- If Packer was just installed, - -- sync plugins - if Packer_bootstrap then require('packer').sync() end + -- High performance color highlighter + use({ + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup() + end, + }) + -- If Packer was just installed, + -- sync plugins + if Packer_bootstrap then + require("packer").sync() + end end) -- Sync plugins if Packer was just -- installed if Packer_bootstrap then - print('Syncing plugins') - require('packer').sync() + print("Syncing plugins") + require("packer").sync() end diff --git a/home/.config/nvim/lua/plugins/lspconfig.lua b/home/.config/nvim/lua/plugins/lspconfig.lua index 65e3a7c..6dc0e36 100644 --- a/home/.config/nvim/lua/plugins/lspconfig.lua +++ b/home/.config/nvim/lua/plugins/lspconfig.lua @@ -2,95 +2,94 @@ -- This is iterated through and every -- server is setup with lspconfig Servers = { - bashls = {}, - html = {}, - jsonls = {}, - lemminx = {}, - marksman = {}, - yamlls = {}, - taplo = {}, - tsserver = {}, - sumneko_lua = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT' - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'} - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file('', true) - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = {enable = false} - } - } + bashls = {}, + html = {}, + jsonls = {}, + lemminx = {}, + marksman = {}, + yamlls = {}, + taplo = {}, + tsserver = {}, + sumneko_lua = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false }, + }, + }, } M = {} function M.map_keys() - -- Register keybindings via which-key - -- to get documentation in which-key - local wk = require('which-key') - wk.register({ - g = { - name = "Go to", - d = {vim.lsp.buf.definition, "Definition"}, - D = {vim.lsp.buf.declaration, "Declaration"}, - i = {vim.lsp.buf.implementation, "Implementation"}, - r = {vim.lsp.buf.references, "References"} - }, - [''] = { - name = "Leader", - w = { - name = "Workspace", - a = {vim.lsp.buf.add_workspace_folder, "Add folder"}, - r = {vim.lsp.buf.remove_workspace_folder, "Remove folder"}, - l = { - function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, "List folders" - } - }, - D = {vim.lsp.buf.type_definition, "Type definition"}, - rn = {vim.lsp.buf.rename, "Rename symbol"}, - ca = {vim.lsp.buf.code_action, "Code action"}, - e = {vim.diagnostic.open_float, "Open diagnostics"}, - f = {vim.lsp.buf.format, "Format"} - }, - K = {vim.lsp.buf.hover, "Hover"}, - ['['] = {d = {vim.diagnostic.goto_prev, "Previous diagnostic"}}, - [']'] = {d = {vim.diagnostic.goto_next, "Next diagnostic"}} - - }) + -- Register keybindings via which-key + -- to get documentation in which-key + local wk = require("which-key") + wk.register({ + g = { + name = "Go to", + d = { vim.lsp.buf.definition, "Definition" }, + D = { vim.lsp.buf.declaration, "Declaration" }, + i = { vim.lsp.buf.implementation, "Implementation" }, + r = { vim.lsp.buf.references, "References" }, + }, + [""] = { + name = "Leader", + w = { + name = "Workspace", + a = { vim.lsp.buf.add_workspace_folder, "Add folder" }, + r = { vim.lsp.buf.remove_workspace_folder, "Remove folder" }, + l = { + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, + "List folders", + }, + }, + D = { vim.lsp.buf.type_definition, "Type definition" }, + rn = { vim.lsp.buf.rename, "Rename symbol" }, + ca = { vim.lsp.buf.code_action, "Code action" }, + e = { vim.diagnostic.open_float, "Open diagnostics" }, + f = { vim.lsp.buf.format, "Format" }, + }, + K = { vim.lsp.buf.hover, "Hover" }, + ["["] = { d = { vim.diagnostic.goto_prev, "Previous diagnostic" } }, + ["]"] = { d = { vim.diagnostic.goto_next, "Next diagnostic" } }, + }) end function M.setup() + local function on_attach() + -- Setup lsp signature plugin + require("lsp_signature").setup({}) - local function on_attach() - -- Setup lsp signature plugin - require('lsp_signature').setup {} + -- Setup keybinds + M.map_keys() + end - -- Setup keybinds - M.map_keys() - end + local capabilities = require("cmp_nvim_lsp").default_capabilities() - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - -- Setup every defined server - for server, settings in pairs(Servers) do - require('lspconfig')[server].setup { - on_attach = on_attach, - settings = settings, - -- Inform lsp server about client - -- capabilities - capabilities = capabilities - } - end + -- Setup every defined server + for server, settings in pairs(Servers) do + require("lspconfig")[server].setup({ + on_attach = on_attach, + settings = settings, + -- Inform lsp server about client + -- capabilities + capabilities = capabilities, + }) + end end return M diff --git a/home/.config/nvim/lua/plugins/lualine.lua b/home/.config/nvim/lua/plugins/lualine.lua index 861aa73..18c9a01 100644 --- a/home/.config/nvim/lua/plugins/lualine.lua +++ b/home/.config/nvim/lua/plugins/lualine.lua @@ -1 +1,3 @@ -return function() require('lualine').setup {} end +return function() + require("lualine").setup({}) +end diff --git a/home/.config/nvim/lua/plugins/luasnip.lua b/home/.config/nvim/lua/plugins/luasnip.lua index 730f7a1..4142273 100644 --- a/home/.config/nvim/lua/plugins/luasnip.lua +++ b/home/.config/nvim/lua/plugins/luasnip.lua @@ -1,15 +1,23 @@ return function() - local luasnip = require('luasnip') - local wk = require('which-key') + local luasnip = require("luasnip") + local wk = require("which-key") - -- load friendly-snippets to luasnip - require('luasnip/loaders/from_vscode').lazy_load() + -- load friendly-snippets to luasnip + require("luasnip/loaders/from_vscode").lazy_load() - -- Register snippet navigation keybindings - local snippet_mappings = { - [''] = {function()luasnip.jump(1) end}, - [''] = {function() luasnip.jump(-1) end} - } - --wk.register(snippet_mappings, {mode = "i"}) - --wk.register(snippet_mappings, {mode = "s"}) + -- Register snippet navigation keybindings + local snippet_mappings = { + [""] = { + function() + luasnip.jump(1) + end, + }, + [""] = { + function() + luasnip.jump(-1) + end, + }, + } + --wk.register(snippet_mappings, {mode = "i"}) + --wk.register(snippet_mappings, {mode = "s"}) end diff --git a/home/.config/nvim/lua/plugins/mason.lua b/home/.config/nvim/lua/plugins/mason.lua index f774b81..225d50f 100644 --- a/home/.config/nvim/lua/plugins/mason.lua +++ b/home/.config/nvim/lua/plugins/mason.lua @@ -1,10 +1,13 @@ local M = {} -Opts = {mason = {}, lspconfig = {automatic_installation = true}} +Opts = { mason = {}, lspconfig = { automatic_installation = true } } -M.setup = function() require('mason').setup(Opts.mason) end +M.setup = function() + require("mason").setup(Opts.mason) +end -M.lspconfig_setup = - function() require('mason-lspconfig').setup(Opts.lspconfig) end +M.lspconfig_setup = function() + require("mason-lspconfig").setup(Opts.lspconfig) +end return M diff --git a/home/.config/nvim/lua/plugins/nvim-tree.lua b/home/.config/nvim/lua/plugins/nvim-tree.lua index a382629..7f86f96 100644 --- a/home/.config/nvim/lua/plugins/nvim-tree.lua +++ b/home/.config/nvim/lua/plugins/nvim-tree.lua @@ -1,13 +1,13 @@ return function() - require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS + require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS diagnostics = { enable = true, show_on_dirs = true, }, renderer = { - highlight_git = true - } - } + highlight_git = true, + }, + }) -- Open/close with alt-o - vim.keymap.set('n', '', vim.cmd.NvimTreeToggle) + vim.keymap.set("n", "", vim.cmd.NvimTreeToggle) end diff --git a/home/.config/nvim/lua/plugins/telescope.lua b/home/.config/nvim/lua/plugins/telescope.lua index a4a13ba..c647c41 100644 --- a/home/.config/nvim/lua/plugins/telescope.lua +++ b/home/.config/nvim/lua/plugins/telescope.lua @@ -1,17 +1,17 @@ return function() - local telescope = require('telescope') - local builtin = require('telescope.builtin') + local telescope = require("telescope") + local builtin = require("telescope.builtin") - telescope.setup { - pickers = {find_files = {find_command = {"fd", "-Ht", "f"}}} - } + telescope.setup({ + pickers = { find_files = { find_command = { "fd", "-Ht", "f" } } }, + }) - telescope.load_extension('fzf') - telescope.load_extension('ui-select') - telescope.load_extension('cder') + telescope.load_extension("fzf") + telescope.load_extension("ui-select") + telescope.load_extension("cder") - -- Keybinds - vim.keymap.set('n', '', vim.cmd.Telescope) - vim.keymap.set('n', '', builtin.find_files) - vim.keymap.set('n', '', builtin.live_grep) + -- Keybinds + vim.keymap.set("n", "", vim.cmd.Telescope) + vim.keymap.set("n", "", builtin.find_files) + vim.keymap.set("n", "", builtin.live_grep) end diff --git a/home/.config/nvim/lua/plugins/treesitter.lua b/home/.config/nvim/lua/plugins/treesitter.lua index ffef72a..64fea67 100644 --- a/home/.config/nvim/lua/plugins/treesitter.lua +++ b/home/.config/nvim/lua/plugins/treesitter.lua @@ -1,17 +1,37 @@ return function() - require'nvim-treesitter.configs'.setup { - ensure_installed = { - 'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json', - 'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', - 'regex', 'rasi', 'rst', 'scss', 'toml', 'tsx', 'typescript', - 'javascript', 'yaml' - }, - highlight = {enable = true}, - indent = {enable = true}, - incremental_selection = {enable = true}, - context_commentstring = {enable = true} - } + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "c", + "css", + "dockerfile", + "html", + "http", + "java", + "json", + "json5", + "latex", + "lua", + "make", + "markdown", + "php", + "python", + "regex", + "rasi", + "rst", + "scss", + "toml", + "tsx", + "typescript", + "javascript", + "yaml", + }, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { enable = true }, + context_commentstring = { enable = true }, + }) - -- vim.wo.foldmethod = 'expr' - -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()' + -- vim.wo.foldmethod = 'expr' + -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()' end diff --git a/home/.config/nvim/lua/plugins/which-key.lua b/home/.config/nvim/lua/plugins/which-key.lua index a1eab54..405773b 100644 --- a/home/.config/nvim/lua/plugins/which-key.lua +++ b/home/.config/nvim/lua/plugins/which-key.lua @@ -1,3 +1,3 @@ return function() - require('which-key').setup {spelling = {enabled = true}} + require("which-key").setup({ spelling = { enabled = true } }) end diff --git a/home/.config/nvim/lua/settings.lua b/home/.config/nvim/lua/settings.lua index e395629..acfaf76 100644 --- a/home/.config/nvim/lua/settings.lua +++ b/home/.config/nvim/lua/settings.lua @@ -5,17 +5,17 @@ local g = vim.g o.termguicolors = true -- Font for nvim GUI's -o.guifont = 'Fira Code:h14' +o.guifont = "Fira Code:h14" -- Floating window transparency o.winblend = 10 -- Set window title o.title = true -o.titlestring = 'NeoVim: ' .. vim.fn.getcwd() +o.titlestring = "NeoVim: " .. vim.fn.getcwd() -- Diff settings -o.diffopt = 'filler,internal,algorithm:histogram,indent-heuristic' +o.diffopt = "filler,internal,algorithm:histogram,indent-heuristic" -- Allow switching buffers with unsaved changes o.hidden = true @@ -24,9 +24,9 @@ o.hidden = true o.number = true o.guicursor = table.concat({ - 'i:ver1', -- Vertical bar cursor in insert mode - 'a:blinkon1' -- Blinking cursor in all modes -}, ',') + "i:ver1", -- Vertical bar cursor in insert mode + "a:blinkon1", -- Blinking cursor in all modes +}, ",") -- Enable global statusline o.laststatus = 3