From 409dfed3237f9f0a6e96879078d1daf3d9c02e03 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 7 Jul 2021 14:10:25 +0200 Subject: Updated config again after Chris's updates --- .config/nvim/lua/cfg/autopairs/init.lua | 4 ++ .config/nvim/lua/cfg/colorizer/init.lua | 6 +- .config/nvim/lua/cfg/compe/init.lua | 10 +++- .config/nvim/lua/cfg/dashboard/init.lua | 9 +-- .config/nvim/lua/cfg/galaxyline/init.lua | 4 +- .config/nvim/lua/cfg/gitsigns/init.lua | 6 +- .config/nvim/lua/cfg/lspinstall/init.lua | 26 --------- .config/nvim/lua/cfg/neoformat/init.lua | 12 ++++ .config/nvim/lua/cfg/nvimtree/init.lua | 24 +++++--- .config/nvim/lua/cfg/telescope/init.lua | 11 ++-- .config/nvim/lua/cfg/treesitter/init.lua | 26 ++------- .config/nvim/lua/cfg/utils/init.lua | 15 +++-- .config/nvim/lua/cfg/which-key/init.lua | 98 +++++++++----------------------- .config/nvim/lua/cfg/zen/init.lua | 6 +- .config/nvim/lua/default-config.lua | 12 ++-- .config/nvim/lua/plugins.lua | 59 ++++++++++++++----- 16 files changed, 162 insertions(+), 166 deletions(-) create mode 100644 .config/nvim/lua/cfg/neoformat/init.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/cfg/autopairs/init.lua b/.config/nvim/lua/cfg/autopairs/init.lua index 6a9e428..b8dad5f 100644 --- a/.config/nvim/lua/cfg/autopairs/init.lua +++ b/.config/nvim/lua/cfg/autopairs/init.lua @@ -1,6 +1,10 @@ -- if not package.loaded['nvim-autopairs'] then -- return -- end +local status_ok, autopairs = pcall(require, "nvim-autopairs") +if not status_ok then + return +end local npairs = require "nvim-autopairs" local Rule = require "nvim-autopairs.rule" diff --git a/.config/nvim/lua/cfg/colorizer/init.lua b/.config/nvim/lua/cfg/colorizer/init.lua index ac5f135..abe2f72 100644 --- a/.config/nvim/lua/cfg/colorizer/init.lua +++ b/.config/nvim/lua/cfg/colorizer/init.lua @@ -1,4 +1,8 @@ -require("colorizer").setup({ "*" }, { +local status_ok, colorizer = pcall(require, "colorizer") +if not status_ok then + return +end +colorizer.setup({ "*" }, { RGB = true, -- #RGB hex codes RRGGBB = true, -- #RRGGBB hex codes RRGGBBAA = true, -- #RRGGBBAA hex codes diff --git a/.config/nvim/lua/cfg/compe/init.lua b/.config/nvim/lua/cfg/compe/init.lua index 5b86f27..f42e8ad 100644 --- a/.config/nvim/lua/cfg/compe/init.lua +++ b/.config/nvim/lua/cfg/compe/init.lua @@ -7,7 +7,7 @@ local M = {} vim.g.vsnip_snippet_dir = O.vnsip_dir M.config = function() - opt = { + local opt = { enabled = O.auto_complete, autocomplete = true, debug = false, @@ -39,8 +39,12 @@ M.config = function() -- for emoji press : (idk if that in compe tho) }, } + local status_ok, compe = pcall(require, "compe") + if not status_ok then + return + end - require("compe").setup(opt) + compe.setup(opt) local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) @@ -86,7 +90,7 @@ M.config = function() vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) vim.api.nvim_set_keymap("i", "", "compe#complete()", { noremap = true, silent = true, expr = true }) - -- vim.api.nvim_set_keymap("i", "", "compe#confirm('')", { noremap = true, silent = true, expr = true }) + vim.api.nvim_set_keymap("i", "", "compe#confirm('')", { noremap = true, silent = true, expr = true }) vim.api.nvim_set_keymap("i", "", "compe#close('')", { noremap = true, silent = true, expr = true }) vim.api.nvim_set_keymap("i", "", "compe#scroll({ 'delta': +4 })", { noremap = true, silent = true, expr = true }) vim.api.nvim_set_keymap("i", "", "compe#scroll({ 'delta': -4 })", { noremap = true, silent = true, expr = true }) diff --git a/.config/nvim/lua/cfg/dashboard/init.lua b/.config/nvim/lua/cfg/dashboard/init.lua index 2305243..bac9081 100644 --- a/.config/nvim/lua/cfg/dashboard/init.lua +++ b/.config/nvim/lua/cfg/dashboard/init.lua @@ -1,3 +1,4 @@ + local M = {} M.config = function() @@ -28,10 +29,10 @@ M.config = function() description = { " Settings " }, command = ":e " .. CONFIG_PATH .. "/config.lua", }, - f = { - description = { " Neovim Config Files" }, - command = "Telescope find_files cwd=" .. CONFIG_PATH, - }, + -- f = { + -- description = { " Neovim Config Files" }, + -- command = "Telescope find_files cwd=" .. CONFIG_PATH, + -- }, -- e = {description = {' Marks '}, command = 'Telescope marks'} } vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'" diff --git a/.config/nvim/lua/cfg/galaxyline/init.lua b/.config/nvim/lua/cfg/galaxyline/init.lua index 058846a..536144d 100644 --- a/.config/nvim/lua/cfg/galaxyline/init.lua +++ b/.config/nvim/lua/cfg/galaxyline/init.lua @@ -51,7 +51,7 @@ table.insert(gls.left, { t = colors.blue, } vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) - return "▊" + return "▎" end, highlight = "StatusLineNC", }, @@ -173,7 +173,7 @@ local get_lsp_client = function(msg) lsps = client.name else lsps = lsps .. ", " .. client.name - -- print("more", lsps) + -- print("more", lsps) end end end diff --git a/.config/nvim/lua/cfg/gitsigns/init.lua b/.config/nvim/lua/cfg/gitsigns/init.lua index 7f1fbff..920c312 100644 --- a/.config/nvim/lua/cfg/gitsigns/init.lua +++ b/.config/nvim/lua/cfg/gitsigns/init.lua @@ -1,7 +1,11 @@ local M = {} M.config = function() - require("gitsigns").setup { + local status_ok, gitsigns = pcall(require, "gitsigns") + if not status_ok then + return + end + gitsigns.setup { signs = { -- TODO add hl to colorscheme add = { diff --git a/.config/nvim/lua/cfg/lspinstall/init.lua b/.config/nvim/lua/cfg/lspinstall/init.lua index 68fcfa2..af5e175 100644 --- a/.config/nvim/lua/cfg/lspinstall/init.lua +++ b/.config/nvim/lua/cfg/lspinstall/init.lua @@ -1,27 +1 @@ --- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. --- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! -local config = require("lspconfig").jdtls.document_config -require("lspconfig/configs").jdtls = nil -- important, unset the loaded config again --- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" - --- 2. extend the config with an install_script and (optionally) uninstall_script --- require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { --- -- lspinstall will automatically create/delete the install directory for every server --- install_script = [[ --- git clone https://github.com/eclipse/eclipse.jdt.ls.git --- cd eclipse.jdt.ls --- ./mvnw clean verify --- ]], --- uninstall_script = nil -- can be omitted --- }) - --- require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, { --- install_script = [[ --- git clone https://github.com/fwcd/kotlin-language-server.git language-server --- cd language-server --- ./gradlew :server:installDist --- ]], --- uninstall_script = nil -- can be omitted --- }) - require("lspinstall").setup() diff --git a/.config/nvim/lua/cfg/neoformat/init.lua b/.config/nvim/lua/cfg/neoformat/init.lua new file mode 100644 index 0000000..eb9596e --- /dev/null +++ b/.config/nvim/lua/cfg/neoformat/init.lua @@ -0,0 +1,12 @@ +-- autoformat +if O.format_on_save then + require("cfg.utils").define_augroups { + autoformat = { + { + "BufWritePre", + "*", + [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], + }, + }, + } +end diff --git a/.config/nvim/lua/cfg/nvimtree/init.lua b/.config/nvim/lua/cfg/nvimtree/init.lua index 37a931e..97cfe03 100644 --- a/.config/nvim/lua/cfg/nvimtree/init.lua +++ b/.config/nvim/lua/cfg/nvimtree/init.lua @@ -1,9 +1,13 @@ ---if not package.loaded['nvim-tree.view'] then --- return ---end - +-- --if not package.loaded['nvim-tree.view'] then +-- -- return +-- --end +-- local M = {} - +local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not status_ok then + return +end +-- M.config = function() local g = vim.g @@ -52,7 +56,7 @@ M.config = function() symlink = "", }, } - local tree_cb = require("nvim-tree.config").nvim_tree_callback + local tree_cb = nvim_tree_config.nvim_tree_callback vim.g.nvim_tree_bindings = { { key = { "l", "", "o" }, cb = tree_cb "edit" }, @@ -61,8 +65,10 @@ M.config = function() } end -local view = require "nvim-tree.view" - +local view_status_ok, view = pcall(require, "nvim-tree.view") +if not view_status_ok then + return +end M.toggle_tree = function() if view.win_open() then require("nvim-tree").close() @@ -77,5 +83,5 @@ M.toggle_tree = function() require("nvim-tree").find_file(true) end end - +-- return M diff --git a/.config/nvim/lua/cfg/telescope/init.lua b/.config/nvim/lua/cfg/telescope/init.lua index 6bbce29..5411c32 100644 --- a/.config/nvim/lua/cfg/telescope/init.lua +++ b/.config/nvim/lua/cfg/telescope/init.lua @@ -1,3 +1,7 @@ +local status_ok, telescope = pcall(require, "telescope") +if not status_ok then + return +end local actions = require "telescope.actions" -- if O.plugin.trouble.active then -- local trouble = require("trouble.providers.telescope") @@ -5,7 +9,7 @@ local actions = require "telescope.actions" -- Global remapping ------------------------------ -- '--color=never', -require("telescope").setup { +telescope.setup { defaults = { find_command = { "rg", @@ -20,11 +24,11 @@ require("telescope").setup { entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", - sorting_strategy = "descending", + sorting_strategy = "ascending", layout_strategy = "horizontal", layout_config = { width = 0.75, - prompt_position = "bottom", + prompt_position = "top", preview_cutoff = 120, horizontal = { mirror = false }, vertical = { mirror = false }, @@ -83,4 +87,3 @@ require("telescope").setup { }, } --- require'telescope'.load_extension('project') diff --git a/.config/nvim/lua/cfg/treesitter/init.lua b/.config/nvim/lua/cfg/treesitter/init.lua index 12525da..deaa86e 100644 --- a/.config/nvim/lua/cfg/treesitter/init.lua +++ b/.config/nvim/lua/cfg/treesitter/init.lua @@ -80,8 +80,12 @@ if status then wk.register(textobj_move_keymaps["goto_previous_start"], normal) wk.register(textobj_move_keymaps["goto_previous_end"], normal) end +local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") +if not status_ok then + return +end -require("nvim-treesitter.configs").setup { +treesitter_configs.setup { ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages ignore_install = O.treesitter.ignore_install, matchup = { @@ -97,7 +101,7 @@ require("nvim-treesitter.configs").setup { enable = O.plugin.ts_context_commentstring.active, config = { css = "// %s" }, }, - -- indent = {enable = true, disable = {"python", "html", "javascript"}}, + -- indent = {enable = true, disable = {"python", "html, "javascript"}}, -- TODO seems to be broken indent = { enable = { "javascriptreact" } }, autotag = { enable = O.plugin.ts_autotag.active }, @@ -116,22 +120,4 @@ require("nvim-treesitter.configs").setup { enable = O.plugin.ts_textsubjects, keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" }, }, - playground = { - enable = O.plugin.ts_playground.active, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false, -- Whether the query persists across vim sessions - keybindings = { - toggle_query_editor = "o", - toggle_hl_groups = "i", - toggle_injected_languages = "t", - toggle_anonymous_nodes = "a", - toggle_language_display = "I", - focus_language = "f", - unfocus_language = "F", - update = "R", - goto_node = "", - show_help = "?", - }, - }, } diff --git a/.config/nvim/lua/cfg/utils/init.lua b/.config/nvim/lua/cfg/utils/init.lua index e879831..f8ed082 100644 --- a/.config/nvim/lua/cfg/utils/init.lua +++ b/.config/nvim/lua/cfg/utils/init.lua @@ -1,5 +1,13 @@ local utils = {} +function utils.reload_config() + vim.cmd "source ~/.config/nvim/config.lua" + vim.cmd "source ~/.config/nvim/lua/plugins.lua" + vim.cmd "source ~/.config/nvim/lua/neoformat/init.lua" + vim.cmd ":PackerCompile" + vim.cmd ":PackerInstall" +end + function utils.define_augroups(definitions) -- {{{1 -- Create autocommand groups based on the passed definitions -- @@ -24,7 +32,7 @@ end utils.define_augroups { - _user_autocommands = O.user_autocommands, + _user_autocommands = O.user_autocommands, _general_settings = { { "TextYankPost", @@ -46,6 +54,7 @@ utils.define_augroups { "*", "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", }, + { "BufWritePost", "config.lua", "lua require('utils').reload_config()" }, { "VimLeavePre", "*", "set title set titleold=" }, }, -- _solidity = { @@ -65,7 +74,7 @@ utils.define_augroups { }, _auto_resize = { -- will cause split windows to be resized evenly if main window is resized - {'VimResized ', '*', 'wincmd ='}, + { "VimResized ", "*", "wincmd =" }, }, -- _mode_switching = { -- -- will switch between absolute and relative line numbers depending on mode @@ -77,5 +86,3 @@ utils.define_augroups { } return utils - --- TODO find a new home for these autocommands diff --git a/.config/nvim/lua/cfg/which-key/init.lua b/.config/nvim/lua/cfg/which-key/init.lua index 1558a50..ca87c6f 100644 --- a/.config/nvim/lua/cfg/which-key/init.lua +++ b/.config/nvim/lua/cfg/which-key/init.lua @@ -1,8 +1,12 @@ -- if not package.loaded['which-key'] then -- return -- end +local status_ok, which_key = pcall(require, "which-key") +if not status_ok then + return +end -require("which-key").setup { +which_key.setup { plugins = { marks = true, -- shows a list of your marks on ' and ` registers = true, -- shows your registers on " in NORMAL or in INSERT mode @@ -61,16 +65,12 @@ vim.api.nvim_set_keymap("n", "n", ':let @/=""', { noremap = true, si -- explorer --- TODO this introduces some bugs unfortunately vim.api.nvim_set_keymap( "n", "e", ":lua require'cfg.nvimtree'.toggle_tree()", { noremap = true, silent = true } ) --- vim.api.nvim_set_keymap('n', 'e', --- ":NvimTreeToggle", --- {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "f", ":Telescope find_files", { noremap = true, silent = true }) @@ -81,23 +81,31 @@ vim.api.nvim_set_keymap("n", ";", ":Dashboard", { noremap = true, si vim.api.nvim_set_keymap("n", "k", ":CommentToggle", { noremap = true, silent = true }) vim.api.nvim_set_keymap("v", "k", ":CommentToggle", { noremap = true, silent = true }) - -- split window vim.api.nvim_set_keymap("n", "v", ":vsplit", {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "h", ":split", {noremap = true, silent = true}) + -- close buffer vim.api.nvim_set_keymap("n", "c", ":BufferClose", { noremap = true, silent = true }) --- TODO create entire treesitter section +-- open config +vim.api.nvim_set_keymap( + "n", + ".", + ":e " .. CONFIG_PATH .. "/config.lua", + { noremap = true, silent = true } +) local mappings = { + ["."] = "LunarConfig", ["k"] = "Comment", ["c"] = "Close Buffer", ["e"] = "Explorer", ["f"] = "Find File", ["n"] = "No Highlight", + [";"] = "Dashboard", ["v"] = "Vertical Split", ["h"] = "Horizontal Split", b = { @@ -127,54 +135,10 @@ local mappings = { name = "Packer", c = { "PackerCompile", "Compile" }, i = { "PackerInstall", "Install" }, - r = { ":luafile %", "Reload" }, + r = { "lua require('cfg.utils').reload_config()", "Reload" }, s = { "PackerSync", "Sync" }, u = { "PackerUpdate", "Update" }, }, - -- diagnostics vanilla nvim - -- -- diagnostic - -- function lv_utils.get_all() - -- vim.lsp.diagnostic.get_all() - -- end - -- function lv_utils.get_next() - -- vim.lsp.diagnostic.get_next() - -- end - -- function lv_utils.get_prev() - -- vim.lsp.diagnostic.get_prev() - -- end - -- function lv_utils.goto_next() - -- vim.lsp.diagnostic.goto_next() - -- end - -- function lv_utils.goto_prev() - -- vim.lsp.diagnostic.goto_prev() - -- end - -- function lv_utils.show_line_diagnostics() - -- vim.lsp.diagnostic.show_line_diagnostics() - -- end - - -- " Available Debug Adapters: - -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/ - -- " Adapter configuration and installation instructions: - -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation - -- " Debug Adapter protocol: - -- " https://microsoft.github.io/debug-adapter-protocol/ - -- " Debugging - d = { - name = "Debug", - t = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, - b = { "lua require'dap'.step_back()", "Step Back" }, - c = { "lua require'dap'.continue()", "Continue" }, - C = { "lua require'dap'.run_to_cursor()", "Run To Cursor" }, - d = { "lua require'dap'.disconnect()", "Disconnect" }, - g = { "lua require'dap'.session()", "Get Session" }, - i = { "lua require'dap'.step_into()", "Step Into" }, - o = { "lua require'dap'.step_over()", "Step Over" }, - u = { "lua require'dap'.step_out()", "Step Out" }, - p = { "lua require'dap'.pause.toggle()", "Pause" }, - r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, - s = { "lua require'dap'.continue()", "Start" }, - q = { "lua require'dap'.stop()", "Quit" }, - }, g = { name = "Git", j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, @@ -207,7 +171,7 @@ local mappings = { "Telescope lsp_workspace_diagnostics", "Workspace Diagnostics", }, - f = { "lua vim.lsp.buf.formatting()", "Format" }, + f = { "Neoformat", "Format" }, i = { "LspInfo", "Info" }, j = { "lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})", "Next Diagnostic" }, k = { "lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})", "Prev Diagnostic" }, @@ -244,18 +208,6 @@ local mappings = { }, } --- if O.plugin.trouble.active then --- mappings["d"] = { --- name = "Diagnostics", --- t = { "TroubleToggle", "trouble" }, --- w = { "TroubleToggle lsp_workspace_diagnostics", "workspace" }, --- d = { "TroubleToggle lsp_document_diagnostics", "document" }, --- q = { "TroubleToggle quickfix", "quickfix" }, --- l = { "TroubleToggle loclist", "loclist" }, --- r = { "TroubleToggle lsp_references", "references" }, --- } --- end - if O.plugin.symbol_outline.active then vim.api.nvim_set_keymap("n", "o", ":SymbolsOutline", { noremap = true, silent = true }) mappings["o"] = "Symbols outline" @@ -270,10 +222,7 @@ if O.plugin.zen.active then vim.api.nvim_set_keymap("n", "z", ":ZenMode", { noremap = true, silent = true }) mappings["z"] = "Zen" end -if O.plugin.lazygit.active then - vim.api.nvim_set_keymap("n", "gg", ":LazyGit", { noremap = true, silent = true }) - mappings["gg"] = "LazyGit" -end + if O.plugin.telescope_project.active then -- open projects vim.api.nvim_set_keymap( @@ -285,8 +234,6 @@ if O.plugin.telescope_project.active then mappings["P"] = "Projects" end --- [";"] = "Dashboard", - if O.lang.latex.active then mappings["L"] = { name = "+Latex", @@ -309,5 +256,14 @@ if O.lushmode then } end +-- for _, v in pairs(O.user_which_key) do +-- end +for k, v in pairs(O.user_which_key) do + mappings[k] = v + -- table.insert(mappings, O.user_which_key[1]) + -- print(k) + -- print(v) +end + local wk = require "which-key" wk.register(mappings, opts) diff --git a/.config/nvim/lua/cfg/zen/init.lua b/.config/nvim/lua/cfg/zen/init.lua index 0d6bfca..d4a3da5 100644 --- a/.config/nvim/lua/cfg/zen/init.lua +++ b/.config/nvim/lua/cfg/zen/init.lua @@ -1,7 +1,11 @@ local M = {} +local status_ok, zen_mode = pcall(require, "zen-mode") +if not status_ok then + return +end M.config = function() - require("zen-mode").setup { + zen_mode.setup { window = { backdrop = 1, height = 0.85, -- height of the Zen window diff --git a/.config/nvim/lua/default-config.lua b/.config/nvim/lua/default-config.lua index 0207635..fce3caf 100644 --- a/.config/nvim/lua/default-config.lua +++ b/.config/nvim/lua/default-config.lua @@ -20,6 +20,7 @@ O = { smart_case = true, lushmode = false, hl_search = false, + document_highlight = false, transparent_window = false, leader_key = "space", vnsip_dir = vim.fn.stdpath "config" .. "/snippets", @@ -65,8 +66,6 @@ O = { dashboard = { active = false }, colorizer = { active = false }, zen = { active = false }, - hop = { active = false }, - vim_rooter = { active = false }, ts_context_commentstring = { active = false }, ts_hintobjects = { active = false }, ts_autotag = { active = false }, @@ -84,9 +83,13 @@ O = { floatterm = { active = false }, trouble = { active = false }, sanegx = { active = false }, + vim_rooter = { active = false }, + hop = { active = false }, }, - custom_plugins = { + user_which_key = {}, + + user_plugins = { -- use config.lua for this not put here }, @@ -203,7 +206,7 @@ O = { ' ##########..........########## ', ' ##########........########## ', ' ##########.......########## ', - ' ##########.....##########.. ', + ' ##########.....##########.. ', ' ##########....##########..... ', ' ..##########..##########......... ', ' ....##########.#########............. ', @@ -217,6 +220,5 @@ O = { ' ..... ', ' . ', }, - footer = { "chrisatmachine.com" }, }, } diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4fc780d..2545dcb 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -61,7 +61,9 @@ return require("packer").startup(function(use) use { "kyazdani42/nvim-tree.lua", + -- event = "BufEnter", -- cmd = "NvimTreeToggle", + commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb", config = function() require("cfg.nvimtree").config() end, @@ -92,9 +94,14 @@ return require("packer").startup(function(use) -- Comments use { "terrortylor/nvim-comment", - cmd = "CommentToggle", + event = "BufRead", + -- cmd = "CommentToggle", config = function() - require("nvim_comment").setup() + local status_ok, nvim_comment = pcall(require, "nvim_comment") + if not status_ok then + return + end + nvim_comment.setup() end, } @@ -123,13 +130,9 @@ return require("packer").startup(function(use) use { "ChristianChiarulli/dashboard-nvim", event = "BufWinEnter", - cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" }, - config = function() - require("cfg.dashboard").config() - end, disable = not O.plugin.dashboard.active, - opt = true, } + -- Zen Mode use { "folke/zen-mode.nvim", @@ -145,12 +148,31 @@ return require("packer").startup(function(use) "norcalli/nvim-colorizer.lua", event = "BufRead", config = function() - require("colorizer").setup() - vim.cmd "ColorizerReloadAllBuffers" + require "cfg.colorizer" end, disable = not O.plugin.colorizer.active, } + use { + "lukas-reineke/indent-blankline.nvim", + event = "BufRead", + setup = 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 = true + end, + disable = not O.plugin.indent_line.active, + } + -- comments in context use { "JoosepAlviste/nvim-ts-context-commentstring", @@ -164,6 +186,7 @@ return require("packer").startup(function(use) cmd = "SymbolsOutline", disable = not O.plugin.symbol_outline.active, } + -- diagnostics use { "folke/trouble.nvim", @@ -182,7 +205,9 @@ return require("packer").startup(function(use) use { "nvim-telescope/telescope-project.nvim", event = "BufRead", - setup = function () vim.cmd[[packadd telescope.nvim]] end, + setup = function() + vim.cmd [[packadd telescope.nvim]] + end, disable = not O.plugin.telescope_project.active, } @@ -249,7 +274,7 @@ return require("packer").startup(function(use) -- Custom semantic text objects use { "nvim-treesitter/nvim-treesitter-textobjects", - disable = not O.plugin.ts_textobjects.active, + disable= not O.plugin.ts_textobjects.active, } -- Smart text objects @@ -264,7 +289,6 @@ return require("packer").startup(function(use) event = "BufRead", disable = not O.plugin.ts_hintobjects.active, } - -- vim rooter for projects use { "airblade/vim-rooter", @@ -274,11 +298,16 @@ return require("packer").startup(function(use) -- hop use { - "phaazon/hop.nvim", - disable = not O.plugin.hop.active, + "phaazon/hop.nvim", + event = "BufRead", + config = function() + require("cfg.hop").config() + end, + disable = not O.plugin.hop.active, } - for _, plugin in pairs(O.custom_plugins) do + for _, plugin in pairs(O.user_plugins) do packer.use(plugin) end + end) -- cgit v1.2.3-70-g09d2