From c20a1b6e2d6a0fd165e833b536d0b6b7b5d2d670 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 1 Nov 2023 16:07:37 -0400 Subject: Use fern instead of netrw --- fern-bookmarks | 1 + lua/ben/core/init.lua | 3 ++ lua/ben/plugins/alpha.lua | 12 +++--- lua/ben/plugins/copilot.lua | 13 +++---- lua/ben/plugins/fern.lua | 19 ++++++++++ lua/ben/plugins/linting.lua | 29 +++++++++++++++ lua/ben/plugins/lsp/mason.lua | 67 ++++++++++++++++++++++++--------- lua/ben/plugins/lualine.lua | 86 ++++++++++++++++++++++--------------------- lua/ben/plugins/vinegar.lua | 6 --- 9 files changed, 156 insertions(+), 80 deletions(-) create mode 100644 fern-bookmarks create mode 100644 lua/ben/plugins/fern.lua create mode 100644 lua/ben/plugins/linting.lua delete mode 100644 lua/ben/plugins/vinegar.lua diff --git a/fern-bookmarks b/fern-bookmarks new file mode 100644 index 0000000..1d9503d --- /dev/null +++ b/fern-bookmarks @@ -0,0 +1 @@ +{"nvim$Neovim": "fern:///file:///home/master/.config/nvim$"} diff --git a/lua/ben/core/init.lua b/lua/ben/core/init.lua index 4314091..59f9e93 100644 --- a/lua/ben/core/init.lua +++ b/lua/ben/core/init.lua @@ -65,6 +65,9 @@ vim.api.nvim_set_keymap("n", "", "l", {}) vim.api.nvim_set_keymap("n", "ZF", "ZQ", {}) vim.api.nvim_set_keymap("n", "w", ":update", { silent = true }) +-- Enter vim's F.ile M.anager +vim.api.nvim_set_keymap("n", "fm", ":e .", { silent = true }) + -- Remove trailing white spaces on BufWritePre vim.cmd([[autocmd BufWritePre * %s/\s\+$//e]]) diff --git a/lua/ben/plugins/alpha.lua b/lua/ben/plugins/alpha.lua index 1a25baa..f694fbd 100644 --- a/lua/ben/plugins/alpha.lua +++ b/lua/ben/plugins/alpha.lua @@ -1,8 +1,8 @@ return { - "goolord/alpha-nvim", - event = "VimEnter", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("alpha").setup(require("alpha.themes.theta").config) - end, + "goolord/alpha-nvim", + event = "VimEnter", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + require("alpha").setup(require("alpha.themes.theta").config) + end, } diff --git a/lua/ben/plugins/copilot.lua b/lua/ben/plugins/copilot.lua index c62a8f5..f53bb48 100644 --- a/lua/ben/plugins/copilot.lua +++ b/lua/ben/plugins/copilot.lua @@ -1,10 +1,7 @@ return { - "github/copilot.vim", - event = "VeryLazy", - config = function() - vim.cmd([[Copilot enable]]) - end, - build = function() - vim.cmd([[Copilot setup]]) - end, + "github/copilot.vim", + event = "VeryLazy", + build = function() + vim.cmd([[Copilot setup]]) + end, } diff --git a/lua/ben/plugins/fern.lua b/lua/ben/plugins/fern.lua new file mode 100644 index 0000000..b120125 --- /dev/null +++ b/lua/ben/plugins/fern.lua @@ -0,0 +1,19 @@ +return { + "lambdalisue/fern.vim", + dependencies = { + "TheLeoP/fern-renderer-web-devicons.nvim", + "lambdalisue/fern-git-status.vim", + "lambdalisue/fern-hijack.vim", + "lambdalisue/fern-bookmark.vim", + "lambdalisue/fern-ssh", + }, + config = function() + vim.g["fern#renderer"] = "nvim-web-devicons" + -- Store bookmarks in $XDG_CONFIG_HOME/nvim/fern-bookmarks + vim.g["fern#scheme#bookmark#store#file"] = vim.fn.stdpath("config") .. "/fern-bookmarks" + end, + keys = { + { "fm", "Fern -drawer ." }, + { "fb", "Fern bookmark:///" }, + }, +} diff --git a/lua/ben/plugins/linting.lua b/lua/ben/plugins/linting.lua new file mode 100644 index 0000000..a5be347 --- /dev/null +++ b/lua/ben/plugins/linting.lua @@ -0,0 +1,29 @@ +return { + "mfussenegger/nvim-lint", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local lint = require("lint") + lint.linters_by_ft = { + css = { "stylelint" }, + markdown = { "markdownlint" }, + python = { "pylint" }, + go = { "golangci_lint" }, + sh = { "shellcheck" }, + } + + local lint_augroup = vim.api.nvim_create_augroup("link", { clear = true }) + + vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + vim.keymap.set("n", "l", function() + lint.try_lint() + end, { + desc = "Trigger linting for current file", + silent = true, + }) + end, +} diff --git a/lua/ben/plugins/lsp/mason.lua b/lua/ben/plugins/lsp/mason.lua index cafdb3b..121509d 100644 --- a/lua/ben/plugins/lsp/mason.lua +++ b/lua/ben/plugins/lsp/mason.lua @@ -2,7 +2,7 @@ return { "williamboman/mason.nvim", dependencies = { "williamboman/mason-lspconfig.nvim", - + "WhoIsSethDaniel/mason-tool-installer.nvim", }, config = function() --import mason @@ -10,32 +10,63 @@ return { -- import mason-lspconfig local mason_lspconfig = require("mason-lspconfig") + local mason_tool_installer = require("mason-tool-installer") + -- enable mason and configure icons mason.setup({ ui = { - icons = { - package_installed = "", - package_pending = "", - package_uninstalled = "" - }, - }, - }) - mason_lspconfig.setup({ - -- list of servers for mason to install - ensure_installed = { - "prettier", + icons = { + package_installed = "", + package_pending = "", + package_uninstalled = "", + }, + }, + }) + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + "bashls", + "cssls", + "diagnosticls", + "dockerls", + "docker_compose_language_service", + "gopls", + "lua_ls", + "texlab", + "zk", + "pyright", + "r_language_server", + "sqls", + }, + -- auto-install configured servers (with lspconfig) + automatic_installation = true, -- not the same as ensure_installed + }) + + mason_tool_installer.setup({ + ensure_installed = { + "mutt-language-server", + "emmet-ls", + -- Linters: + "prettier", "bibtex-tidy", "goimports", "gci", "golines", "shfmt", "latexindent", - "sql_formatter", - "isort", "black", + "sql-formatter", + "isort", + "black", "yamlfix", - }, - -- auto-install configured servers (with lspconfig) - automatic_installation = true, -- not the same as ensure_installed - }) + "stylua", + -- Formatters: + "stylelint", + "markdownlint", + "pylint", + "golangci-lint", + "shellcheck", + }, + }) + end, } diff --git a/lua/ben/plugins/lualine.lua b/lua/ben/plugins/lualine.lua index 6f29613..1bd6270 100644 --- a/lua/ben/plugins/lualine.lua +++ b/lua/ben/plugins/lualine.lua @@ -1,44 +1,46 @@ return { - "nvim-lualine/lualine.nvim", - dependencies = "nvim-tree/nvim-web-devicons", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("lualine").setup({ - options = { - theme = "everforest", - icons_enabled = true, - -- section_separators = { left = "", right = "" }, - section_separators = { left = "▓", right = "▓" }, - -- component_separators = { left = "", right = "" }, - component_separators = { left = "░", right = "░" }, - globalstatus = false, - ignore_focus = {}, - always_divide_middle = true, - refresh = { - statusline = 500, - tabline = 500, - winbar = 500, - }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch" }, - lualine_c = { "filename" }, - lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - winbar = {}, - extensions = {}, - }) - end, + "nvim-lualine/lualine.nvim", + dependencies = "nvim-tree/nvim-web-devicons", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("lualine").setup({ + options = { + theme = "everforest", + icons_enabled = true, + -- section_separators = { left = "", right = "" }, + section_separators = { left = "▓", right = "▓" }, + -- component_separators = { left = "", right = "" }, + component_separators = { left = "░", right = "░" }, + globalstatus = false, + ignore_focus = {}, + always_divide_middle = true, + refresh = { + statusline = 500, + tabline = 500, + winbar = 500, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + extensions = {}, + }) + -- set noshowmode to remove the useless -- INSERT -- text + vim.opt.showmode = false + end, } diff --git a/lua/ben/plugins/vinegar.lua b/lua/ben/plugins/vinegar.lua deleted file mode 100644 index aa58b16..0000000 --- a/lua/ben/plugins/vinegar.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "tpope/vim-vinegar", - keys = { - { "fm", "Exp" }, - }, -} -- cgit v1.2.3