From abf32b26c333828539c47b2f6b70561858cd0c57 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Fri, 8 Oct 2021 11:16:06 +0200 Subject: [PATCH] remove some unued plugins --- configs/init.lua | 15 +++------ configs/lua/autoformatter.lua | 58 ----------------------------------- configs/lua/lazy-git.lua | 3 +- configs/lua/lsp-utils.lua | 5 ++- configs/lua/utils.lua | 12 +++++++- 5 files changed, 20 insertions(+), 73 deletions(-) delete mode 100644 configs/lua/autoformatter.lua diff --git a/configs/init.lua b/configs/init.lua index 5b6ea8a..e81fd76 100644 --- a/configs/init.lua +++ b/configs/init.lua @@ -19,7 +19,6 @@ paq:setup({verbose = true}) { --"unkiwii/vim-nerdtree-sync", "kyazdani42/nvim-web-devicons", "kyazdani42/nvim-tree.lua", - "karb94/neoscroll.nvim", "alexghergh/nvim-tmux-navigation", -- Code Navigation "dense-analysis/ale", @@ -45,7 +44,7 @@ paq:setup({verbose = true}) { "L3MON4D3/LuaSnip", -- Snippets plugin {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}, -- Formatting - "mhartington/formatter.nvim", + --"mhartington/formatter.nvim", -- Git Interface "akinsho/nvim-toggleterm.lua", -- Database Interface @@ -56,10 +55,11 @@ paq:setup({verbose = true}) { if u.has_plugin("cmp") then -- Global options o.number = true - o.tabstop = 2 + o.tabstop = 8 o.shiftwidth = 2 -- Indents will have a width of 4 o.softtabstop = 2 -- Sets the number of columns for a TAB - o.expandtab = false -- Expand TABs to spaces + o.expandtab = false -- Dont expand TABs to spaces + o.autoindent = true cmd [[set mouse=a]] cmd [[set undofile]] cmd [[set fcs=eob:\ ]] @@ -206,9 +206,6 @@ if u.has_plugin("cmp") then } ) - -- Smooth Scrolling - require("neoscroll").setup() - -- Autocompletion Setup o.completeopt = "menuone,noselect" require "autocomplete" @@ -217,9 +214,7 @@ if u.has_plugin("cmp") then require "lspinstall".setup() require "lsp-utils" - -- Autoformat - require "autoformatter" else paq.install() - cmd [[source $MYVIMRC]] + u.ReloadConfig() end diff --git a/configs/lua/autoformatter.lua b/configs/lua/autoformatter.lua deleted file mode 100644 index 7802d30..0000000 --- a/configs/lua/autoformatter.lua +++ /dev/null @@ -1,58 +0,0 @@ -local u = require "utils" - --- Config Formatter -u.create_augroup( - { - --{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.svelte", "OrganizeImports"}, - {"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"} - }, - "FormatAutogroup" -) - -require("formatter").setup( - { - logging = false, - filetype = { - typescript = { - -- prettier - function() - return { - exe = "prettier", - args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"}, - stdin = true - } - end - }, - javascript = { - -- prettier - function() - return { - exe = "prettier", - args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"}, - stdin = true - } - end - }, - svelte = { - -- prettier - function() - return { - exe = "prettier", - args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"}, - stdin = true - } - end - }, - lua = { - -- luafmt - function() - return { - exe = "luafmt", - args = {"--indent-count", 2, "--stdin"}, - stdin = true - } - end - } - } - } -) diff --git a/configs/lua/lazy-git.lua b/configs/lua/lazy-git.lua index 151b1cf..7a3d66f 100644 --- a/configs/lua/lazy-git.lua +++ b/configs/lua/lazy-git.lua @@ -1,4 +1,5 @@ local Terminal = require("toggleterm.terminal").Terminal +local u = require("utils") local lazygit = Terminal:new( { @@ -51,7 +52,7 @@ local nvimConfig = direction = "float", on_close = function(term) Terminal:close() - vim.api.nvim_command(":source $MYVIMRC") + u.ReloadConfig() end } ) diff --git a/configs/lua/lsp-utils.lua b/configs/lua/lsp-utils.lua index 736bf7c..b4356f0 100644 --- a/configs/lua/lsp-utils.lua +++ b/configs/lua/lsp-utils.lua @@ -41,9 +41,8 @@ local function on_attach(client) autocmd! * autocmd CursorHold lua vim.lsp.buf.document_highlight() autocmd CursorMoved lua vim.lsp.buf.clear_references() - " autocmd CursorHold *.* :lua vim.lsp.diagnostic.show_line_diagnostics() - autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 300) - augroup END + autocmd CursorHold *.* :lua vim.lsp.diagnostic.show_line_diagnostics() + augroup END ]], false ) diff --git a/configs/lua/utils.lua b/configs/lua/utils.lua index 70466c0..dce77cd 100644 --- a/configs/lua/utils.lua +++ b/configs/lua/utils.lua @@ -10,6 +10,16 @@ function M.create_augroup(autocmds, name) cmd('augroup END') end +function M.ReloadConfig() + for name,_ in pairs(package.loaded) do + if name:match('^cnull') then + package.loaded[name] = nil + end + end + + dofile(vim.env.MYVIMRC) +end + local function dump(o) if type(o) == 'table' then local s = '{ ' @@ -28,4 +38,4 @@ function M.has_plugin(pluginName) return status end -return M +return M \ No newline at end of file