feat(plugins): Add file tree, Enable Lazy loading
I've tried to lazy load most the plugins to improve start up time. It has been greatly reduced, from more than 600ms to just around 100ms Bug: Line that shows up when you are inside a block(block-line) doesn't have color.
This commit is contained in:
parent
79b55158e1
commit
23e69634da
19 changed files with 151 additions and 78 deletions
|
|
@ -1,5 +1,6 @@
|
|||
return {
|
||||
-- "gc" to comment visual regions/lines
|
||||
'numToStr/Comment.nvim',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
return {
|
||||
-- NOTE: Yes, you can install new plugins here!
|
||||
'mfussenegger/nvim-dap',
|
||||
-- NOTE: And you can specify dependencies as well
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
|
@ -21,6 +19,7 @@ return {
|
|||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
-- NOTE: First, some plugins that don't require any configuration
|
||||
return {
|
||||
-- Git related plugins
|
||||
'tpope/vim-fugitive',
|
||||
'tpope/vim-rhubarb',
|
||||
}
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
return {
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = {
|
||||
-- Git related plugins
|
||||
'tpope/vim-fugitive',
|
||||
'tpope/vim-rhubarb',
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
|
|
|
|||
80
lua/kickstart/plugins/git.lua
Normal file
80
lua/kickstart/plugins/git.lua
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
return {
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = {
|
||||
-- Git related plugins
|
||||
'tpope/vim-fugitive',
|
||||
'tpope/vim-rhubarb',
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map({ 'n', 'v' }, ']c', function()
|
||||
if vim.wo.diff then
|
||||
return ']c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to next hunk' })
|
||||
|
||||
map({ 'n', 'v' }, '[c', function()
|
||||
if vim.wo.diff then
|
||||
return '[c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to previous hunk' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
||||
map('n', '<leader>hb', function()
|
||||
gs.blame_line { full = false }
|
||||
end, { desc = 'git blame line' })
|
||||
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gs.diffthis '~'
|
||||
end, { desc = 'git diff against last commit' })
|
||||
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -3,6 +3,11 @@ return {
|
|||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
opts = {
|
||||
exclude = {
|
||||
filetypes = { 'dashboard', 'alpha', 'help', 'nvim-tree', 'lazy', 'mason' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ return {
|
|||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
'NvimTree',
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ return {
|
|||
-- Adds a number of user-friendly snippets
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
-- [[ Configure nvim-cmp ]]
|
||||
-- See `:help cmp`
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ return {
|
|||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
},
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
|
|
|
|||
33
lua/kickstart/plugins/nvim-tree.lua
Normal file
33
lua/kickstart/plugins/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
lazy = 'true',
|
||||
cmd = { 'NvimTreeToggle', 'NvimTreeOpen' },
|
||||
keys = {
|
||||
{ '<S-t>', '<cmd>NvimTreeToggle .<CR>', { noremap = true, silent = true } }
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
--[[ init = function()
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
pattern = 'NvimTree',
|
||||
command = ":lua require('gitsigns').detach()"
|
||||
})
|
||||
end, ]]
|
||||
opts = {
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = 38,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
build = ':TSUpdate',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
require 'nvim-treesitter.install'.compilers = { 'zig' }
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ return {
|
|||
end,
|
||||
},
|
||||
},
|
||||
event = 'VeryLazy',
|
||||
config = function()
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
return {
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
'tpope/vim-sleuth',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ return {
|
|||
-- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
opts = {},
|
||||
event = 'VeryLazy',
|
||||
config = function()
|
||||
-- document existing key chains
|
||||
require('which-key').register {
|
||||
|
|
|
|||
|
|
@ -36,5 +36,9 @@ vim.o.timeoutlen = 300
|
|||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
-- disable netrw at the very start of your init.lua for Nvim-tree plugin
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- set termguicolors to enable highlight groups
|
||||
vim.opt.termguicolors = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue