diff --git a/README.md b/README.md index 4dbc3af..db7012a 100644 --- a/README.md +++ b/README.md @@ -169,15 +169,29 @@ sudo apt install make gcc ripgrep unzip git neovim ``` sudo apt update -sudo apt install make gcc ripgrep unzip git -echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list -sudo apt update -sudo apt install -t unstable neovim +sudo apt install make gcc ripgrep unzip git curl + +# Now we install nvim +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz +sudo rm -rf /opt/nvim-linux64 +sudo mkdir -p /opt/nvim-linux64 +sudo chmod a+rX /opt/nvim-linux64 +sudo tar -C /opt -xzf nvim-linux64.tar.gz + +# make it available in /usr/local/bin, distro installs to /usr/bin +sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ ```
Fedora Install Steps ``` -sudo dnf install -y gcc make git ripgrep fd-find neovim +sudo dnf install -y gcc make git ripgrep fd-find unzip neovim +``` +
+ +
Arch Install Steps + +``` +sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim ```
diff --git a/init.lua b/init.lua index 817ae07..854e98f 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Set to true if you have a Nerd Font installed +-- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true -- Save start directory as base diff --git a/lua/custom/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua similarity index 83% rename from lua/custom/plugins/autopairs.lua rename to lua/kickstart/plugins/autopairs.lua index 6a9e751..87a7e5f 100644 --- a/lua/custom/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -1,7 +1,9 @@ --- File: lua/custom/plugins/autopairs.lua +-- autopairs +-- https://github.com/windwp/nvim-autopairs return { 'windwp/nvim-autopairs', + event = 'InsertEnter', -- Optional dependency dependencies = { 'hrsh7th/nvim-cmp' }, config = function() diff --git a/lua/kickstart/plugins/cmp.lua b/lua/kickstart/plugins/cmp.lua index 6c1f3cb..52f7156 100644 --- a/lua/kickstart/plugins/cmp.lua +++ b/lua/kickstart/plugins/cmp.lua @@ -70,6 +70,12 @@ return { [''] = cmp.mapping.confirm { select = true }, [''] = cmp.mapping.abort(), + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + --[''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.select_next_item(), + --[''] = cmp.mapping.select_prev_item(), + -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display -- completions whenever it has completion options available. diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index 46a40d5..fd3631b 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -15,7 +15,7 @@ return { changedelete = { text = '~' }, }, on_attach = function(bufnr) - local gs = package.loaded.gitsigns + local gitsigns = require 'gitsigns' local function map(mode, l, r, opts) opts = opts or {} @@ -24,50 +24,45 @@ return { end -- Navigation - map({ 'n', 'v' }, ']c', function() + map('n', ']c', function() if vim.wo.diff then - return ']c' + vim.cmd.normal { ']c', bang = true } + else + gitsigns.nav_hunk 'next' end - vim.schedule(function() - gs.next_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to next hunk' }) + end, { desc = 'Jump to next git [c]hange' }) - map({ 'n', 'v' }, '[c', function() + map('n', '[c', function() if vim.wo.diff then - return '[c' + vim.cmd.normal { '[c', bang = true } + else + gitsigns.nav_hunk 'prev' end - vim.schedule(function() - gs.prev_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to previous hunk' }) + end, { desc = 'Jump to previous git [c]hange' }) -- Actions -- visual mode map('v', 'hs', function() - gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'stage git hunk' }) map('v', 'hr', function() - gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'reset git hunk' }) -- normal mode - map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) - map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) - map('n', 'hb', function() - gs.blame_line { full = false } - end, { desc = 'git blame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) map('n', 'hD', function() - gs.diffthis '~' - end, { desc = 'git diff against last commit' }) - + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) -- Toggles - map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) - map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) -- Text object map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index 3eee972..8a5b4c7 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -3,7 +3,7 @@ return { 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - 'williamboman/mason.nvim', + { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -118,6 +118,16 @@ return { callback = vim.lsp.buf.clear_references, }) end + + -- The following autocommand is used to enable inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then + map('th', function() + vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) + end, '[T]oggle Inlay [H]ints') + end end, }) diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua new file mode 100644 index 0000000..c793b88 --- /dev/null +++ b/lua/kickstart/plugins/neo-tree.lua @@ -0,0 +1,25 @@ +-- Neo-tree is a Neovim plugin to browse the file system +-- https://github.com/nvim-neo-tree/neo-tree.nvim + +return { + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal', { desc = 'NeoTree reveal' } }, + }, + opts = { + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + }, + }, + }, + }, +} diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index e60e34b..741eedc 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -100,6 +100,8 @@ return { config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup(opts) end, diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua index 5b27685..dea9797 100644 --- a/lua/kickstart/plugins/which-key.lua +++ b/lua/kickstart/plugins/which-key.lua @@ -30,7 +30,7 @@ return { ['c'] = { name = '[C]ode/[C]odeium/[C]hange', _ = 'which_key_ignore' }, ['cd'] = { name = '[D]irectory', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument/[D]elete', _ = 'which_key_ignore' }, - ['h'] = { name = '[H]unk/[H]arpoon', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk/[H]arpoon', _ = 'which_key_ignore' }, ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, ['dn'] = { name = '[N]o', _ = 'which_key_ignore' }, } diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index a634574..8d946a3 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -69,6 +69,8 @@ require('lazy').setup({ require 'kickstart.plugins.debug', require 'kickstart.plugins.indent_line', require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config.