aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua39
1 files changed, 25 insertions, 14 deletions
diff --git a/init.lua b/init.lua
index 2d377d2..71e1ae5 100644
--- a/init.lua
+++ b/init.lua
@@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now :)
--]]
-
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
@@ -75,7 +74,8 @@ require('lazy').setup({
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
- { -- LSP Configuration & Plugins
+ {
+ -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
@@ -84,21 +84,23 @@ require('lazy').setup({
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
- { 'j-hui/fidget.nvim', opts = {} },
+ { 'j-hui/fidget.nvim', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
},
},
- { -- Autocompletion
+ {
+ -- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',"rafamadriz/friendly-snippets", },
},
-- Useful plugin to show you pending keybinds.
- { 'folke/which-key.nvim', opts = {} },
- { -- Adds git releated signs to the gutter, as well as utilities for managing changes
+ { 'folke/which-key.nvim', opts = {} },
+ {
+ -- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
@@ -109,10 +111,16 @@ require('lazy').setup({
topdelete = { text = '‾' },
changedelete = { text = '~' },
},
+ on_attach = function(bufnr)
+ vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' })
+ vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' })
+ vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
+ end
},
},
- { -- Theme inspired by Atom
+ {
+ -- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
@@ -120,7 +128,8 @@ require('lazy').setup({
end,
},
- { -- Set lualine as statusline
+ {
+ -- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
@@ -133,7 +142,8 @@ require('lazy').setup({
},
},
- { -- Add indentation guides even on blank lines
+ {
+ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
@@ -144,10 +154,10 @@ require('lazy').setup({
},
-- "gc" to comment visual regions/lines
- { 'numToStr/Comment.nvim', opts = {} },
+ { 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc)
- { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
+ { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
@@ -162,7 +172,8 @@ require('lazy').setup({
end,
},
- { -- Highlight, edit, and navigate code
+ {
+ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
@@ -469,7 +480,7 @@ cmp.setup {
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
- elseif luasnip.expand_or_jumpable() then
+ elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
@@ -478,7 +489,7 @@ cmp.setup {
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
- elseif luasnip.jumpable(-1) then
+ elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()