From 71c5cb4f0be89d3a175e99b0c2ebc5e55178e8a9 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 5 Jul 2021 20:01:19 +0000 Subject: [PATCH 1/5] (feat) use neoformat as the defalt format option (#715) --- ftplugin/c.lua | 11 --------- ftplugin/go.lua | 18 +++----------- ftplugin/javascript.lua | 35 --------------------------- ftplugin/javascriptreact.lua | 35 --------------------------- ftplugin/json.lua | 12 --------- ftplugin/lua.lua | 31 ------------------------ ftplugin/python.lua | 17 ------------- ftplugin/ruby.lua | 8 ------ ftplugin/rust.lua | 8 ------ ftplugin/sh.lua | 4 --- ftplugin/typescript.lua | 35 --------------------------- ftplugin/typescriptreact.lua | 35 --------------------------- ftplugin/zig.lua | 1 - ftplugin/zsh.lua | 6 ----- init.lua | 13 ++++++++++ lua/default-config.lua | 31 +++--------------------- lua/plugins.lua | 5 +++- utils/installer/lv-config.example.lua | 33 ++----------------------- 18 files changed, 26 insertions(+), 312 deletions(-) diff --git a/ftplugin/c.lua b/ftplugin/c.lua index ef371c03..7443cabe 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -18,14 +18,3 @@ require("lspconfig").clangd.setup { }), }, } - -if O.lang.clang.autoformat then - require("lv-utils").define_augroups { - _clang_autoformat = { - { "BufWritePre *.c lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.h lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.cpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.hpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/go.lua b/ftplugin/go.lua index 0bee465f..56b9cacc 100644 --- a/ftplugin/go.lua +++ b/ftplugin/go.lua @@ -6,17 +6,7 @@ require("lspconfig").gopls.setup { on_attach = require("lsp").common_on_attach, } -if O.lang.go.autoformat then - require("lv-utils").define_augroups { - _go_format = { - { "BufWritePre", "*.go", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - _go = { - -- Go generally requires Tabs instead of spaces. - { "FileType", "go", "setlocal tabstop=4" }, - { "FileType", "go", "setlocal shiftwidth=4" }, - { "FileType", "go", "setlocal softtabstop=4" }, - { "FileType", "go", "setlocal noexpandtab" }, - }, - } -end +vim.opt_local.tabstop = 4 +vim.opt_local.shiftwidth = 4 +vim.opt_local.softtabstop = 4 +vim.opt_local.expandtab = false diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -if O.lang.tsserver.autoformat then - require("lv-utils").define_augroups { - _javascript_autoformat = { - { - - "BufWritePre", - "*.js", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _javascriptreact_autoformat = { - { - "BufWritePre", - "*.jsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescript_autoformat = { - { - "BufWritePre", - "*.ts", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescriptreact_autoformat = { - { - "BufWritePre", - "*.tsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/javascriptreact.lua b/ftplugin/javascriptreact.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/javascriptreact.lua +++ b/ftplugin/javascriptreact.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -if O.lang.tsserver.autoformat then - require("lv-utils").define_augroups { - _javascript_autoformat = { - { - - "BufWritePre", - "*.js", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _javascriptreact_autoformat = { - { - "BufWritePre", - "*.jsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescript_autoformat = { - { - "BufWritePre", - "*.ts", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescriptreact_autoformat = { - { - "BufWritePre", - "*.tsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/json.lua b/ftplugin/json.lua index da0c9ff2..29a3096f 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -15,15 +15,3 @@ require("lspconfig").jsonls.setup { }, }, } - -if O.lang.json.autoformat then - require("lv-utils").define_augroups { - _json_format = { - { - "BufWritePre", - "*.json", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index f3c3ac50..32c24e80 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -40,34 +40,3 @@ if O.lang.lua.autoformat then }, } end - -local lua_arguments = {} - -local luaFormat = { - formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80", - formatStdin = true, -} - -local lua_fmt = { - formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", - formatStdin = true, -} - -if O.lang.lua.formatter == "lua-format" then - table.insert(lua_arguments, luaFormat) -elseif O.lang.lua.formatter == "lua-fmt" then - table.insert(lua_arguments, lua_fmt) -end - -require("lspconfig").efm.setup { - -- init_options = {initializationOptions}, - cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, - init_options = { documentFormatting = true, codeAction = false }, - filetypes = { "lua" }, - settings = { - rootMarkers = { ".git/" }, - languages = { - lua = lua_arguments, - }, - }, -} diff --git a/ftplugin/python.lua b/ftplugin/python.lua index 62464397..a9b41648 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -20,12 +20,6 @@ if O.lang.python.isort then table.insert(python_arguments, isort) end -if O.lang.python.formatter == "yapf" then - table.insert(python_arguments, yapf) -elseif O.lang.python.formatter == "black" then - table.insert(python_arguments, black) -end - require("lspconfig").efm.setup { -- init_options = {initializationOptions}, cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, @@ -64,17 +58,6 @@ require("lspconfig").pyright.setup { }, }, } -if O.lang.python.autoformat then - require("lv-utils").define_augroups { - _python_autoformat = { - { - "BufWritePre", - "*.py", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end if O.plugin.debug.active and O.plugin.dap_install.active then local dap_install = require("dap-install") diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index 0cff96ff..bc844cd3 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -12,11 +12,3 @@ require("lspconfig").solargraph.setup { }, filetypes = O.lang.ruby.filetypes, } - -if O.lang.ruby.autoformat then - require("lv-utils").define_augroups { - _ruby_format = { - { "BufWritePre", "*.rb", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 34b211d6..2a106e7e 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -91,11 +91,3 @@ vim.api.nvim_exec( ]], true ) - -if O.lang.rust.autoformat then - require("lv-utils").define_augroups { - _rust_format = { - { "BufWritePre", "*.rs", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index fa8f0785..c146e45f 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -15,10 +15,6 @@ local shellcheck = { lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" }, } -if O.lang.sh.formatter == "shfmt" then - table.insert(sh_arguments, shfmt) -end - if O.lang.sh.linter == "shellcheck" then table.insert(sh_arguments, shellcheck) end diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/typescript.lua +++ b/ftplugin/typescript.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -if O.lang.tsserver.autoformat then - require("lv-utils").define_augroups { - _javascript_autoformat = { - { - - "BufWritePre", - "*.js", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _javascriptreact_autoformat = { - { - "BufWritePre", - "*.jsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescript_autoformat = { - { - "BufWritePre", - "*.ts", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescriptreact_autoformat = { - { - "BufWritePre", - "*.tsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/typescriptreact.lua b/ftplugin/typescriptreact.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/typescriptreact.lua +++ b/ftplugin/typescriptreact.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -if O.lang.tsserver.autoformat then - require("lv-utils").define_augroups { - _javascript_autoformat = { - { - - "BufWritePre", - "*.js", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _javascriptreact_autoformat = { - { - "BufWritePre", - "*.jsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescript_autoformat = { - { - "BufWritePre", - "*.ts", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - _typescriptreact_autoformat = { - { - "BufWritePre", - "*.tsx", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/zig.lua b/ftplugin/zig.lua index 7fc8d3fc..92b4120d 100644 --- a/ftplugin/zig.lua +++ b/ftplugin/zig.lua @@ -8,7 +8,6 @@ require("lspconfig").zls.setup { } require("lv-utils").define_augroups { _zig_autoformat = { - { "BufWritePre", "*.zig", "lua vim.lsp.buf.formatting_sync(nil, 1000)" }, { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' }, }, } diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua index a2847f19..b6fa9d5d 100644 --- a/ftplugin/zsh.lua +++ b/ftplugin/zsh.lua @@ -15,17 +15,11 @@ require("lspconfig").bashls.setup { -- sh local sh_arguments = {} -local shfmt = { formatCommand = "shfmt -ci -s -bn", formatStdin = true } - local shellcheck = { LintCommand = "shellcheck -f gcc -x", lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" }, } -if O.lang.sh.formatter == "shfmt" then - table.insert(sh_arguments, shfmt) -end - if O.lang.sh.linter == "shellcheck" then table.insert(sh_arguments, shellcheck) end diff --git a/init.lua b/init.lua index 8e44e868..2b5a9515 100644 --- a/init.lua +++ b/init.lua @@ -11,3 +11,16 @@ require "lsp" if O.lang.emmet.active then require "lsp.emmet-ls" end + +-- autoformat +if O.format_on_save then + require("lv-utils").define_augroups { + autoformat = { + { + "BufWritePre", + "*", + [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], + }, + }, + } +end diff --git a/lua/default-config.lua b/lua/default-config.lua index ce7b1062..e05fc9e3 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -4,7 +4,7 @@ CACHE_PATH = vim.fn.stdpath "cache" TERMINAL = vim.fn.expand "$TERMINAL" O = { - + format_on_save = true, auto_close_tree = 0, auto_complete = true, colorscheme = "lunar", @@ -33,7 +33,7 @@ O = { }, lsp = { - popup_border = "single" + popup_border = "single", }, database = { save_location = "~/.config/nvcode_db", auto_execute = 1 }, @@ -97,9 +97,6 @@ O = { lang = { python = { linter = "", - -- @usage can be 'yapf', 'black' - formatter = "", - autoformat = false, isort = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, @@ -116,9 +113,6 @@ O = { sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot", }, lua = { - -- @usage can be 'lua-format' - formatter = "", - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -129,8 +123,6 @@ O = { -- @usage can be 'shellcheck' linter = "", -- @usage can be 'shfmt' - formatter = "", - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -140,9 +132,6 @@ O = { tsserver = { -- @usage can be 'eslint' linter = "", - -- @usage can be 'prettier' - formatter = "", - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -150,9 +139,6 @@ O = { }, }, json = { - -- @usage can be 'prettier' - formatter = "", - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -178,7 +164,6 @@ O = { }, cross_file_rename = true, header_insertion = "never", - autoformat = false, -- update this to true for enabling autoformat }, ruby = { diagnostics = { @@ -198,8 +183,6 @@ O = { active = false, }, linter = "", - formatter = "", - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -208,13 +191,9 @@ O = { }, svelte = {}, php = { - format = { - braces = "psr12", - }, environment = { php_version = "7.4", }, - autoformat = false, diagnostics = { virtual_text = { spacing = 0, prefix = "" }, signs = true, @@ -233,8 +212,6 @@ O = { cmake = {}, java = {}, css = { - formatter = "", - autoformat = false, virtual_text = true, }, }, @@ -263,6 +240,4 @@ O = { }, footer = { "chrisatmachine.com" }, }, -} - - +} \ No newline at end of file diff --git a/lua/plugins.lua b/lua/plugins.lua index b14cac46..8752a1ba 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -66,6 +66,9 @@ return require("packer").startup(function(use) -- Treesitter use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" } + -- Neoformat + use { "sbdchd/neoformat", event = "BufEnter" } + use { "kyazdani42/nvim-tree.lua", -- cmd = "NvimTreeToggle", @@ -435,7 +438,7 @@ return require("packer").startup(function(use) "typescript", "typescriptreact", "typescript.tsx", - } + }, } -- use { -- "jose-elias-alvarez/null-ls.nvim", diff --git a/utils/installer/lv-config.example.lua b/utils/installer/lv-config.example.lua index 56fe7176..d5c3e40d 100644 --- a/utils/installer/lv-config.example.lua +++ b/utils/installer/lv-config.example.lua @@ -1,13 +1,14 @@ --[[ O is the global options object -Formatters and linters should be +Linters should be filled in as strings with either a global executable or a path to an executable ]] -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT -- general +O.format_on_save = true O.auto_complete = true O.colorscheme = "spacegray" O.auto_close_tree = 0 @@ -47,13 +48,9 @@ O.lang.clang.diagnostics.signs = true O.lang.clang.diagnostics.underline = true -- python --- add things like O.python.formatter.yapf.exec_path -- add things like O.python.linter.flake8.exec_path --- add things like O.python.formatter.isort.exec_path -O.lang.python.formatter = "yapf" -- O.python.linter = 'flake8' O.lang.python.isort = true -O.lang.python.autoformat = true O.lang.python.diagnostics.virtual_text = true O.lang.python.diagnostics.signs = true O.lang.python.diagnostics.underline = true @@ -61,37 +58,11 @@ O.lang.python.analysis.type_checking = "off" O.lang.python.analysis.auto_search_paths = true O.lang.python.analysis.use_library_code_types = true --- lua --- TODO look into stylua -O.lang.lua.formatter = "lua-format" --- O.lua.formatter = 'lua-format' -O.lang.lua.autoformat = false - -- javascript -O.lang.tsserver.formatter = "prettier" O.lang.tsserver.linter = nil -O.lang.tsserver.autoformat = true - --- json -O.lang.json.autoformat = true - --- ruby -O.lang.ruby.autoformat = true - --- go -O.lang.go.autoformat = true - --- rust -O.lang.rust.autoformat = true - --- clang -O.lang.clang.autoformat = false -- Set to true to enable auto-format in C/C++ files. -- php -O.lang.php.format.braces = "k&r" -- options: psr12, allman, k&r O.lang.php.environment.php_version = "7.4" --- TODO: autoformat seems not to work at the moment -O.lang.php.autoformat = false O.lang.php.diagnostics.signs = true O.lang.php.diagnostics.underline = true O.lang.php.filetypes = { "php", "phtml" } From 5c73e9bea50695e6b399351c2443068d23f41047 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 16:05:15 -0400 Subject: [PATCH 2/5] fix user config --- utils/installer/lv-config.example.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/installer/lv-config.example.lua b/utils/installer/lv-config.example.lua index d5c3e40d..71d9dfc8 100644 --- a/utils/installer/lv-config.example.lua +++ b/utils/installer/lv-config.example.lua @@ -5,8 +5,7 @@ Linters should be filled in as strings with either a global executable or a path to an executable -]] --- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT +]] -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT -- general O.format_on_save = true O.auto_complete = true @@ -23,7 +22,7 @@ O.transparent_window = false -- TODO User Config for predefined plugins -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile -O.bultin_plugin.hop.active = false +O.plugin.hop.active = false O.plugin.dial.active = false O.plugin.dashboard.active = true O.plugin.matchup.active = false @@ -40,7 +39,7 @@ O.plugin.zen.active = false -- if you don't want all the parsers change this to a table of the ones you want O.treesitter.ensure_installed = "all" -O.treesitter.ignore_install = { "haskell" } +O.treesitter.ignore_install = {"haskell"} O.treesitter.highlight.enabled = true O.lang.clang.diagnostics.virtual_text = true @@ -65,7 +64,7 @@ O.lang.tsserver.linter = nil O.lang.php.environment.php_version = "7.4" O.lang.php.diagnostics.signs = true O.lang.php.diagnostics.underline = true -O.lang.php.filetypes = { "php", "phtml" } +O.lang.php.filetypes = {"php", "phtml"} -- Autocommands (https://neovim.io/doc/user/autocmd.html) -- O.user_autocommands = {{ "BufWinEnter", "*", "echo \"hi again\""}} From 9b10d9298c58981b59beea11c140907f32533022 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 16:17:51 -0400 Subject: [PATCH 3/5] going back to barbar --- lua/lv-which-key/init.lua | 46 +++++++++++++++++++-------------------- lua/plugins.lua | 34 ++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 31 deletions(-) diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index d5ad771f..084be113 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -87,7 +87,7 @@ vim.api.nvim_set_keymap("n", "/", ":CommentToggle", { noremap = true vim.api.nvim_set_keymap("v", "/", ":CommentToggle", { noremap = true, silent = true }) -- close buffer -vim.api.nvim_set_keymap("n", "c", ":bdelete!", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "c", ":BufferClose", { noremap = true, silent = true }) -- TODO create entire treesitter section @@ -121,14 +121,14 @@ local mappings = { "sort BufferLines automatically by language", }, }, - p = { - name = "Packer", - c = {"PackerCompile", "Compile"}, - i = {"PackerInstall", "Install"}, - r = {":luafile %", "Reload"}, - s = {"PackerSync", "Sync"}, - u = {"PackerUpdate", "Update"} - }, + p = { + name = "Packer", + c = { "PackerCompile", "Compile" }, + i = { "PackerInstall", "Install" }, + r = { ":luafile %", "Reload" }, + s = { "PackerSync", "Sync" }, + u = { "PackerUpdate", "Update" }, + }, -- diagnostics vanilla nvim -- -- diagnostic -- function lv_utils.get_all() @@ -158,20 +158,20 @@ local mappings = { -- " 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"} + 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", diff --git a/lua/plugins.lua b/lua/plugins.lua index 8752a1ba..4ae2ec1a 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -118,13 +118,21 @@ return require("packer").startup(function(use) use { "glepnir/galaxyline.nvim" } use { - "akinsho/nvim-bufferline.lua", + "romgrk/barbar.nvim", config = function() - require("lv-bufferline").config() + vim.api.nvim_set_keymap("n", "", ":BufferNext", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", ":BufferPrevious", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", ":BufferClose", { noremap = true, silent = true }) end, event = "BufRead", } + -- use { + -- "akinsho/nvim-bufferline.lua", + -- config = function() require("lv-bufferline").config() end, + -- event = "BufRead" + -- } + -- Extras, these do not load by default -- Better motions @@ -224,7 +232,11 @@ return require("packer").startup(function(use) vim.g.indentLine_enabled = 1 vim.g.indent_blankline_char = "▏" - vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard" } + 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 @@ -256,9 +268,14 @@ return require("packer").startup(function(use) use { "mfussenegger/nvim-dap", config = function() - require('dap') - vim.fn.sign_define('DapBreakpoint', {text='', texthl='LspDiagnosticsSignError', linehl='', numhl=''}) - require('dap').defaults.fallback.terminal_win_cmd = '50vsplit new' + require "dap" + vim.fn.sign_define("DapBreakpoint", { + text = "", + texthl = "LspDiagnosticsSignError", + linehl = "", + numhl = "", + }) + require("dap").defaults.fallback.terminal_win_cmd = "50vsplit new" end, disable = not O.plugin.debug.active, } @@ -462,6 +479,7 @@ return require("packer").startup(function(use) requires = "hrsh7th/nvim-compe", disable = not O.plugin.tabnine.active, } - for _, plugin in pairs(O.custom_plugins) do packer.use(plugin) end - + for _, plugin in pairs(O.custom_plugins) do + packer.use(plugin) + end end) From d4822c2920336287579c74a5b37f0aa08402b871 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 16:20:14 -0400 Subject: [PATCH 4/5] no lazyloading barbar --- lua/plugins.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins.lua b/lua/plugins.lua index 4ae2ec1a..7c35c264 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -124,7 +124,7 @@ return require("packer").startup(function(use) vim.api.nvim_set_keymap("n", "", ":BufferPrevious", { noremap = true, silent = true }) vim.api.nvim_set_keymap("n", "", ":BufferClose", { noremap = true, silent = true }) end, - event = "BufRead", + -- event = "BufRead", } -- use { From a469c710bfc01f291df68dba40464caaa2b496da Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 16:21:26 -0400 Subject: [PATCH 5/5] no lazyload lspinstall --- lua/plugins.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins.lua b/lua/plugins.lua index 7c35c264..2b215291 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -32,7 +32,7 @@ return require("packer").startup(function(use) -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) use { "neovim/nvim-lspconfig" } - use { "kabouzeid/nvim-lspinstall", cmd = "LspInstall" } + use { "kabouzeid/nvim-lspinstall" } -- Telescope use { "nvim-lua/popup.nvim" } use { "nvim-lua/plenary.nvim" }