re-organized the dir and divided the init.lua into smaller plugins files
This commit is contained in:
parent
8bce42bec4
commit
8623090268
15 changed files with 373 additions and 420 deletions
5
lua/custom/plugins/comments.lua
Normal file
5
lua/custom/plugins/comments.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {},
|
||||
lazy = false
|
||||
}
|
||||
32
lua/custom/plugins/gitsigns.lua
Normal file
32
lua/custom/plugins/gitsigns.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, {
|
||||
buffer = bufnr, desc = 'Preview git hunk'
|
||||
})
|
||||
|
||||
-- don't override the built-in and fugitive keymaps
|
||||
local gs = package.loaded.gitsigns
|
||||
vim.keymap.set({ 'n', 'v' }, ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
|
||||
vim.keymap.set({ 'n', 'v' }, '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
19
lua/custom/plugins/indent.lua
Normal file
19
lua/custom/plugins/indent.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
-- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = {
|
||||
--[[ highlight = highlight ]]
|
||||
char = "┆",
|
||||
smart_indent_cap = true,
|
||||
},
|
||||
whitespace = {
|
||||
--[[ highlight = highlight, ]]
|
||||
remove_blankline_trail = false,
|
||||
},
|
||||
scope = { enabled = true },
|
||||
},
|
||||
}
|
||||
22
lua/custom/plugins/lsp-config.lua
Normal file
22
lua/custom/plugins/lsp-config.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
-- LSP Configuration & Plugin
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
tag = 'legacy',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
},
|
||||
}
|
||||
-- These are some example plugins that I've included in the kickstart repository.
|
||||
13
lua/custom/plugins/lualine.lua
Normal file
13
lua/custom/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
-- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'onedark',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
},
|
||||
}
|
||||
7
lua/custom/plugins/monokai.lua
Normal file
7
lua/custom/plugins/monokai.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
'tanvirtin/monokai.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme('monokai')
|
||||
end,
|
||||
}
|
||||
63
lua/custom/plugins/nvim-cmp.lua
Normal file
63
lua/custom/plugins/nvim-cmp.lua
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
return {
|
||||
-- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
|
||||
-- Adds a number of user-friendly snippets
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
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 {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
35
lua/custom/plugins/telescope.lua
Normal file
35
lua/custom/plugins/telescope.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
'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
|
||||
-- requirements installed.
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
-- NOTE: If you are having trouble with this installation,
|
||||
-- refer to the README for telescope-fzf-native for more instructions.
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
end,
|
||||
} -- See `:help telescope` and `:help telescope.setup()`
|
||||
79
lua/custom/plugins/tree-sitter.lua
Normal file
79
lua/custom/plugins/tree-sitter.lua
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
return {
|
||||
-- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'windwp/nvim-ts-autotag',
|
||||
},
|
||||
build = ':TSUpdate',
|
||||
-- setup autotag with default options
|
||||
opts = {
|
||||
enable = true,
|
||||
},
|
||||
config = function()
|
||||
-- See `:help nvim-treesitter`
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = { 'c', 'cpp', 'lua', 'python', 'go', 'vimdoc', 'vim' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<M-space>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>i'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>I'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
4
lua/custom/plugins/which-key.lua
Normal file
4
lua/custom/plugins/which-key.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
'folke/which-key.nvim',
|
||||
opts = {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue