lazy loading : nvimtree and autopairs

This commit is contained in:
siduck76 2021-06-25 23:06:17 +05:30
parent 922089fc07
commit 4e23587ca3
4 changed files with 106 additions and 89 deletions

View File

@ -39,12 +39,10 @@ g.indent_blankline_show_first_indent_level = false
require "mappings" require "mappings"
require "telescope-nvim" require "telescope-nvim"
require "nvimTree" -- file tree stuff
require "file-icons" require "file-icons"
-- git signs , lsp symbols etc -- git signs , lsp symbols etc
require "gitsigns-nvim" require "gitsigns-nvim"
require("nvim-autopairs").setup()
require("lspkind").init() require("lspkind").init()
-- hide line numbers , statusline in specific buffers! -- hide line numbers , statusline in specific buffers!

View File

@ -91,3 +91,14 @@ map("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
map("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) map("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
map("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) map("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
map("i", "<CR>", "v:lua.completions()", {expr = true}) map("i", "<CR>", "v:lua.completions()", {expr = true})
-- Mappings for nvimtree
vim.api.nvim_set_keymap(
"n",
"<C-n>",
":NvimTreeToggle<CR>",
{
noremap = true,
silent = true
}
)

View File

@ -1,28 +1,31 @@
local g = vim.g local M = {}
vim.o.termguicolors = true M.config = function()
local g = vim.g
g.nvim_tree_side = "left" vim.o.termguicolors = true
g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0
g.nvim_tree_quit_on_open = 0
g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_root_folder_modifier = ":t"
g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1
g.nvim_tree_show_icons = { g.nvim_tree_side = "left"
g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0
g.nvim_tree_quit_on_open = 0
g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_root_folder_modifier = ":t"
g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1
g.nvim_tree_show_icons = {
git = 1, git = 1,
folders = 1, folders = 1,
files = 1 files = 1
} }
g.nvim_tree_icons = { g.nvim_tree_icons = {
default = "", default = "",
symlink = "", symlink = "",
git = { git = {
@ -42,22 +45,11 @@ g.nvim_tree_icons = {
empty_open = "", empty_open = "",
symlink_open = "" symlink_open = ""
} }
}
-- Mappings for nvimtree
vim.api.nvim_set_keymap(
"n",
"<C-n>",
":NvimTreeToggle<CR>",
{
noremap = true,
silent = true
} }
)
local tree_cb = require "nvim-tree.config".nvim_tree_callback local tree_cb = require "nvim-tree.config".nvim_tree_callback
g.nvim_tree_bindings = { g.nvim_tree_bindings = {
["u"] = ":lua require'some_module'.some_function()<cr>", ["u"] = ":lua require'some_module'.some_function()<cr>",
-- default mappings -- default mappings
["<CR>"] = tree_cb("edit"), ["<CR>"] = tree_cb("edit"),
@ -90,4 +82,7 @@ g.nvim_tree_bindings = {
["]c"] = tree_cb("next_git_item"), ["]c"] = tree_cb("next_git_item"),
["-"] = tree_cb("dir_up"), ["-"] = tree_cb("dir_up"),
["q"] = tree_cb("close") ["q"] = tree_cb("close")
} }
end
return M

View File

@ -38,10 +38,16 @@ return packer.startup(
use "lewis6991/gitsigns.nvim" use "lewis6991/gitsigns.nvim"
use "akinsho/nvim-bufferline.lua" use "akinsho/nvim-bufferline.lua"
use "glepnir/galaxyline.nvim" use "glepnir/galaxyline.nvim"
use "windwp/nvim-autopairs"
use {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup()
end
}
-- use "alvan/vim-closetag" -- for html -- use "alvan/vim-closetag" -- for html
-- Comment
use "terrortylor/nvim-comment" -- snippet support use "terrortylor/nvim-comment" -- snippet support
-- snippet -- snippet
@ -52,7 +58,14 @@ return packer.startup(
use "rafamadriz/friendly-snippets" use "rafamadriz/friendly-snippets"
-- file managing , picker etc -- file managing , picker etc
use "kyazdani42/nvim-tree.lua" use {
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle",
config = function()
require("nvimTree").config()
end
}
use "kyazdani42/nvim-web-devicons" use "kyazdani42/nvim-web-devicons"
use "nvim-telescope/telescope.nvim" use "nvim-telescope/telescope.nvim"
use "nvim-telescope/telescope-media-files.nvim" use "nvim-telescope/telescope-media-files.nvim"