summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua46
1 files changed, 25 insertions, 21 deletions
diff --git a/init.lua b/init.lua
index 7ee7cee..e30bc32 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,30 +74,33 @@ 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
- 'williamboman/mason.nvim',
+ { 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
-- 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' },
},
-- 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`
@@ -117,7 +119,8 @@ require('lazy').setup({
},
},
- { -- Theme inspired by Atom
+ {
+ -- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
@@ -125,7 +128,8 @@ require('lazy').setup({
end,
},
- { -- Set lualine as statusline
+ {
+ -- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
@@ -138,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`
@@ -149,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
@@ -167,14 +172,13 @@ require('lazy').setup({
end,
},
- { -- Highlight, edit, and navigate code
+ {
+ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
- config = function()
- pcall(require('nvim-treesitter.install').update { with_sync = true })
- end,
+ build = ":TSUpdate",
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
@@ -283,6 +287,7 @@ vim.keymap.set('n', '<leader>/', function()
})
end, { desc = '[/] Fuzzily search in current buffer' })
+vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
@@ -433,9 +438,6 @@ require('neodev').setup()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
--- Setup mason so it can manage external tooling
-require('mason').setup()
-
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
@@ -466,6 +468,8 @@ cmp.setup {
end,
},
mapping = cmp.mapping.preset.insert {
+ ['<C-n>'] = cmp.mapping.select_next_item(),
+ ['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
@@ -476,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()
@@ -485,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()