From 14eaeb66d537341ffa765ff162109ae331929bdf Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 28 Mar 2021 19:19:35 -0400 Subject: [PATCH] plugins/all: small changes, fixes and no more unnecessary global variables --- lua/configs/nvim-focus.lua | 2 +- lua/configs/nvim-telescope.lua | 4 ++-- lua/configs/nvim-toggleterm.lua | 2 +- lua/configs/nvim-tree.lua | 37 ++++++++++++--------------------- lua/configs/statusline.lua | 8 +++---- lua/configs/tree-sitter.lua | 2 +- 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/lua/configs/nvim-focus.lua b/lua/configs/nvim-focus.lua index 071bb76..25ccb11 100644 --- a/lua/configs/nvim-focus.lua +++ b/lua/configs/nvim-focus.lua @@ -1,4 +1,4 @@ -focus = require('focus') +local focus = require('focus') -- Enable focus focus.enable = true diff --git a/lua/configs/nvim-telescope.lua b/lua/configs/nvim-telescope.lua index f82e5b2..74f8215 100644 --- a/lua/configs/nvim-telescope.lua +++ b/lua/configs/nvim-telescope.lua @@ -1,7 +1,7 @@ -- https://github.com/nvim-telescope/telescope.nvim#telescope-defaults -- Required to close with ESC in insert mode -actions = require('telescope.actions') -telescope = require('telescope') +local actions = require('telescope.actions') +local telescope = require('telescope') telescope.setup{ defaults = { diff --git a/lua/configs/nvim-toggleterm.lua b/lua/configs/nvim-toggleterm.lua index 479d7e9..a03ff13 100644 --- a/lua/configs/nvim-toggleterm.lua +++ b/lua/configs/nvim-toggleterm.lua @@ -1,4 +1,4 @@ -toggleterm = require('toggleterm').setup{ +require('toggleterm').setup{ size = 10, open_mapping = [[]], shade_filetypes = {}, diff --git a/lua/configs/nvim-tree.lua b/lua/configs/nvim-tree.lua index df1585a..a7fea11 100644 --- a/lua/configs/nvim-tree.lua +++ b/lua/configs/nvim-tree.lua @@ -1,39 +1,28 @@ ----[[----------------------]]--- --- Vim-related wrappers -- ----]]----------------------[[--- --- Access to global variables -g = vim.g --- Vim commands like 'colorscheme X' -cmd = vim.cmd - ---------------------------------------------- - - -- Empty by default -g.nvim_tree_ignore = { '.git', 'node_modules', '.cache', '__pycache__' } +vim.g.nvim_tree_ignore = { '.git', 'node_modules', '.cache', '__pycache__' } -- False by default, opens the tree when typing `vim $DIR` or `vim` -g.nvim_tree_auto_open = false +vim.g.nvim_tree_auto_open = 0 -- False by default, closes the tree when it is the last window -g.nvim_tree_auto_close = false +vim.g.nvim_tree_auto_close = 0 -- False by default, closes the tree when you open a file -g.nvim_tree_quit_on_open = true +vim.g.nvim_tree_quit_on_open = 1 -- False by default, this option allows the cursor to be updated when entering a buffer -g.nvim_tree_follow = true +vim.g.nvim_tree_follow = 1 -- False by default, this option shows indent markers when folders are open -g.nvim_tree_indent_markers = true +vim.g.nvim_tree_indent_markers = 1 -- False by default, will enable file highlight for git attributes (can be used without the icons). -g.nvim_tree_git_hl = true +vim.g.nvim_tree_git_hl = 1 -- This is the default. See :help filename-modifiers for more options -g.nvim_tree_root_folder_modifier = ':~' +vim.g.nvim_tree_root_folder_modifier = ':~' -- False by default, will open the tree when entering a new tab and the tree was previously open -g.nvim_tree_tab_open = true +vim.g.nvim_tree_tab_open = 1 -- False by default, will not resize the tree when opening a file -g.nvim_tree_width_allow_resize = true +vim.g.nvim_tree_width_allow_resize = 1 --- Tree icons -- If false, do not show the icons for one of 'git' 'folder' and 'files' -- true by default, notice that if 'files' is 1, it will only display -- if nvim-web-devicons is installed and on your runtimepath -g.nvim_tree_show_icons = { +vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1, @@ -41,7 +30,7 @@ g.nvim_tree_show_icons = { -- You can edit keybindings be defining this variable -- You don't have to define all keys. -- NOTE: the 'edit' key will wrap/unwrap a folder and open a file -g.nvim_tree_bindings = { +vim.g.nvim_tree_bindings = { edit = {"", "o"}, edit_vsplit = "", edit_split = "", @@ -66,7 +55,7 @@ g.nvim_tree_bindings = { -- default will show icon by default if no icon is provided -- default shows no icon by default -g.nvim_tree_icons = { +vim.g.nvim_tree_icons = { default = "", symlink = "", git = { diff --git a/lua/configs/statusline.lua b/lua/configs/statusline.lua index c324d67..6a213b3 100644 --- a/lua/configs/statusline.lua +++ b/lua/configs/statusline.lua @@ -1,9 +1,9 @@ -- Extracted from https://github.com/glepnir/galaxyline.nvim/blob/main/example/eviline.lua -- Credits goes to its author (glepnir) :) -gl = require('galaxyline') -colors = require('galaxyline.theme').default -condition = require('galaxyline.condition') -gls = gl.section +local gl = require('galaxyline') +local colors = require('galaxyline.theme').default +local condition = require('galaxyline.condition') +local gls = gl.section gl.short_line_list = {'NvimTree','vista','dbui','packer'} diff --git a/lua/configs/tree-sitter.lua b/lua/configs/tree-sitter.lua index e28daea..e60429d 100644 --- a/lua/configs/tree-sitter.lua +++ b/lua/configs/tree-sitter.lua @@ -1,4 +1,4 @@ -ts = require('nvim-treesitter.configs') +local ts = require('nvim-treesitter.configs') --[[ Here you can use the maintained value which indicates that we wish to use all maintained languages modules instead of a list of languages. You also need to