From a3a9eadf411dba412db0c5d20063921d0a024aa3 Mon Sep 17 00:00:00 2001 From: RubikNube Date: Tue, 18 Feb 2025 00:03:08 +0100 Subject: [PATCH] Initial nvim customization * disabled arrowkeys in normal mode * added pv as a shortcut for opening the file explorer * fixed mason-lspconfig by adding required attributes 'automatic_installation' and 'ensure_installed' * changed indent_width to 4 --- .stylua.toml | 2 +- init.lua | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.stylua.toml b/.stylua.toml index 139e9397..ba0c6e6a 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -1,6 +1,6 @@ column_width = 160 line_endings = "Unix" indent_type = "Spaces" -indent_width = 2 +indent_width = 4 quote_style = "AutoPreferSingle" call_parentheses = "None" diff --git a/init.lua b/init.lua index 99c7c9cb..9150b030 100644 --- a/init.lua +++ b/init.lua @@ -166,6 +166,7 @@ vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +vim.keymap.set('n', 'pv', vim.cmd.Ex) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. @@ -175,10 +176,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -228,8 +229,8 @@ vim.opt.rtp:prepend(lazypath) -- NOTE: Here is where you install your plugins. require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + 'sindrets/diffview.nvim', -- Neovim diff plugin -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. @@ -279,7 +280,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -325,7 +326,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, @@ -365,7 +366,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -473,7 +474,7 @@ require('lazy').setup({ 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by nvim-cmp 'hrsh7th/cmp-nvim-lsp', @@ -685,6 +686,8 @@ require('lazy').setup({ require('lspconfig')[server_name].setup(server) end, }, + automatic_installation = true, + ensure_installed = {} } end, },