From 2952f4d5c74522c1ed0e22b1926335bde4c3ade0 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Fri, 16 Jul 2021 23:22:36 +0530 Subject: [PATCH] clean stuff --- init.lua | 5 ++-- lua/highlights.lua | 2 +- lua/options.lua | 2 +- lua/pluginList.lua | 11 ++++---- lua/plugins/autosave.lua | 4 +-- lua/plugins/blankline.lua | 9 ------- lua/plugins/colorizer.lua | 13 ---------- lua/plugins/comment.lua | 5 ---- lua/plugins/lspkind.lua | 5 ---- lua/plugins/others.lua | 54 +++++++++++++++++++++++++++++++++++++++ lua/plugins/telescope.lua | 2 +- lua/theme.lua | 2 -- 12 files changed, 66 insertions(+), 48 deletions(-) delete mode 100644 lua/plugins/blankline.lua delete mode 100644 lua/plugins/colorizer.lua delete mode 100644 lua/plugins/comment.lua delete mode 100644 lua/plugins/lspkind.lua create mode 100644 lua/plugins/others.lua diff --git a/init.lua b/init.lua index c9df36f..ec789ab 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,7 @@ -- load all options require "options" --- only try to load stuff if atleast base16 is initialized --- TODO: Find a better way to trigger PackerSync +-- load stuff only if theme is initialized if require "theme" then local async async = @@ -21,7 +20,7 @@ if require "theme" then ) async:send() else - -- otherwise run packer sync + -- otherwise run PackerSync require "pluginList" print("Now PackerSync will be executed, after completion, restart neovim.\n") vim.cmd("PackerSync") diff --git a/lua/highlights.lua b/lua/highlights.lua index 2f3cc01..b579954 100644 --- a/lua/highlights.lua +++ b/lua/highlights.lua @@ -42,7 +42,7 @@ fg("IndentBlanklineChar", line) -- misc -- fg("LineNr", grey) -fg("Comment", grey_fg2) +fg("Comment", grey_fg) fg("NvimInternalError", red) fg("VertSplit", line) fg("EndOfBuffer", black) diff --git a/lua/options.lua b/lua/options.lua index 3d2d2dd..caed235 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -26,7 +26,7 @@ opt.number = true opt.numberwidth = 2 -- opt.relativenumber = true --- for indenline +-- Indenline opt.expandtab = true opt.shiftwidth = 2 opt.smartindent = true diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 4289f02..34650f3 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -33,7 +33,7 @@ return packer.startup( "norcalli/nvim-colorizer.lua", event = "BufRead", config = function() - require "plugins.colorizer" + require("plugins.others").colorizer() end } @@ -63,7 +63,7 @@ return packer.startup( "onsails/lspkind-nvim", event = "BufRead", config = function() - require "plugins.lspkind" + require("plugins.others").lspkind() end } @@ -122,7 +122,6 @@ return packer.startup( } use {"nvim-telescope/telescope-fzf-native.nvim", run = "make", cmd = "Telescope"} - use { "nvim-telescope/telescope-media-files.nvim", cmd = "Telescope" @@ -152,7 +151,7 @@ return packer.startup( "terrortylor/nvim-comment", cmd = "CommentToggle", config = function() - require "plugins.comment" + require("plugins.others").comment() end } @@ -188,7 +187,7 @@ return packer.startup( "karb94/neoscroll.nvim", event = "WinScrolled", config = function() - require "plugins.neoscroll" + require("plugins.others").neoscroll() end } @@ -206,7 +205,7 @@ return packer.startup( "lukas-reineke/indent-blankline.nvim", event = "BufRead", setup = function() - require "plugins.blankline" + require("plugins.others").blankline() end } end diff --git a/lua/plugins/autosave.lua b/lua/plugins/autosave.lua index 6ddcd82..fda9f9a 100644 --- a/lua/plugins/autosave.lua +++ b/lua/plugins/autosave.lua @@ -3,7 +3,7 @@ local autosave if not pcall( function() - func = require "autosave" + autosave = require "autosave" end ) then @@ -20,7 +20,7 @@ autosave.setup( filetype_is_not = {}, modifiable = true }, - write_all_buffers = true, + write_all_buffers = false, on_off_commands = true, clean_command_line_interval = 2500 } diff --git a/lua/plugins/blankline.lua b/lua/plugins/blankline.lua deleted file mode 100644 index 6a1bd4a..0000000 --- a/lua/plugins/blankline.lua +++ /dev/null @@ -1,9 +0,0 @@ --- blankline config -vim.g.indentLine_enabled = 1 -vim.g.indent_blankline_char = "▏" - -vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"} -vim.g.indent_blankline_buftype_exclude = {"terminal"} - -vim.g.indent_blankline_show_trailing_blankline_indent = false -vim.g.indent_blankline_show_first_indent_level = false diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua deleted file mode 100644 index d3e1d9d..0000000 --- a/lua/plugins/colorizer.lua +++ /dev/null @@ -1,13 +0,0 @@ -local colorizer -if - not pcall( - function() - colorizer = require("colorizer") - end - ) - then - return -end - -colorizer.setup() -vim.cmd("ColorizerReloadAllBuffers") diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua deleted file mode 100644 index 2a41f8a..0000000 --- a/lua/plugins/comment.lua +++ /dev/null @@ -1,5 +0,0 @@ -pcall( - function() - require("nvim_comment").setup() - end -) diff --git a/lua/plugins/lspkind.lua b/lua/plugins/lspkind.lua deleted file mode 100644 index f9159d6..0000000 --- a/lua/plugins/lspkind.lua +++ /dev/null @@ -1,5 +0,0 @@ -pcall( - function() - require("lspkind").init() - end -) diff --git a/lua/plugins/others.lua b/lua/plugins/others.lua new file mode 100644 index 0000000..6382701 --- /dev/null +++ b/lua/plugins/others.lua @@ -0,0 +1,54 @@ +local M = {} + +M.colorizer = function() + local colorizer + if + not pcall( + function() + colorizer = require("colorizer") + end + ) + then + return + end + + colorizer.setup() + vim.cmd("ColorizerReloadAllBuffers") +end + +M.comment = function() + pcall( + function() + require("nvim_comment").setup() + end + ) +end + +M.lspkind = function() + pcall( + function() + require("lspkind").init() + end + ) +end + +M.neoscroll = function() + pcall( + function() + require("neoscroll").setup() + end + ) +end + +M.blankline = function() + vim.g.indentLine_enabled = 1 + vim.g.indent_blankline_char = "▏" + + vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"} + vim.g.indent_blankline_buftype_exclude = {"terminal"} + + vim.g.indent_blankline_show_trailing_blankline_indent = false + vim.g.indent_blankline_show_first_indent_level = false +end + +return M diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 4fea957..f9f3819 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -44,7 +44,7 @@ telescope.setup( file_sorter = require("telescope.sorters").get_fuzzy_file, file_ignore_patterns = {}, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = shorten, + path_display = {"absolute"}, winblend = 0, border = {}, borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}, diff --git a/lua/theme.lua b/lua/theme.lua index 8727eaf..2bdfb11 100644 --- a/lua/theme.lua +++ b/lua/theme.lua @@ -1,4 +1,3 @@ --- colorscheme related stuff vim.g.nvchad_theme = "onedark" local base16 @@ -12,7 +11,6 @@ if return false else base16(base16.themes["onedark"], true) - local cmd = vim.cmd -- load bg color before async for smooth transition local background = require("themes/" .. vim.g.nvchad_theme).black