diff options
Diffstat (limited to 'lua/ben')
-rw-r--r-- | lua/ben/core/init.lua | 41 | ||||
-rw-r--r-- | lua/ben/plugins/blamer.lua | 9 | ||||
-rw-r--r-- | lua/ben/plugins/fugitive.lua | 2 | ||||
-rw-r--r-- | lua/ben/plugins/startify.lua | 28 | ||||
-rw-r--r-- | lua/ben/plugins/treesitter.lua | 25 | ||||
-rw-r--r-- | lua/ben/plugins/vinegar.lua | 6 |
6 files changed, 74 insertions, 37 deletions
diff --git a/lua/ben/core/init.lua b/lua/ben/core/init.lua index e5bb0a2..5d8b7b0 100644 --- a/lua/ben/core/init.lua +++ b/lua/ben/core/init.lua @@ -6,12 +6,6 @@ vim.g.mapleader = ";" -- Space is quicker than Shift+Semicolon vim.keymap.set("n", "<space>", ":") --- fm -> File Manager -vim.keymap.set("n", "<leader>fm", "<cmd>Exp<cr>") - --- Tree View for the netrw File Manager -vim.g.netrw_liststyle = 3 - -- Set encoding to UTF-8 vim.opt.encoding = "utf-8" @@ -74,3 +68,38 @@ vim.api.nvim_set_keymap("n", "<leader>w", ":update<CR>", { silent = true }) -- Remove trailing white spaces on BufWritePre vim.cmd([[autocmd BufWritePre * %s/\s\+$//e]]) + +-- Tree View for the netrw File Manager +vim.g.netrw_liststyle = 3 +vim.g.netrw_banner = 0 +-- If nvim is opened with no arguments, open the netrw file manager +local mygroup = vim.api.nvim_create_augroup("loading_netrwPlugin", { clear = true }) +vim.api.nvim_create_autocmd({ "VimEnter" }, { + pattern = { "*" }, + callback = function() + -- Getting the file name that you pass when you launch nvim, + local current_file = vim.fn.expand("%") + -- if we have already file_name, then, we edit it + if current_file ~= "" then + vim.cmd(":silent! edit " .. current_file) + else + -- We will check if the window (buffer) is the lazy nvim, as it conflict if the buffer (popup menu) is lazy + local lazy_popup_buf_exists = false + -- We will get list of all current opened buffers + local buf_list = vim.api.nvim_list_bufs() + for _, buf in ipairs(buf_list) do + -- We will obtain from the table only the filetype + local buf_ft = vim.api.nvim_buf_get_option(buf, "filetype") + if buf_ft == "lazy" then + lazy_popup_buf_exists = true + end + end -- Check if vim-floaterm is loaded + local has_floaterm, _ = pcall(require, "floaterm") + if not lazy_popup_buf_exists and not has_floaterm then + -- Then we can safely loading netrwPlugin at startup + vim.cmd(":silent! Explore") + end + end + end, + group = mygroup, +}) diff --git a/lua/ben/plugins/blamer.lua b/lua/ben/plugins/blamer.lua new file mode 100644 index 0000000..daf37cf --- /dev/null +++ b/lua/ben/plugins/blamer.lua @@ -0,0 +1,9 @@ +return { + "APZelos/blamer.nvim", + config = function() + vim.g.blamer_enabled = 1 + vim.g.blamer_delay = 500 + vim.g.blamer_template = "<committer>, <committer-time> • <summary>" + vim.g.blamer_prefix = ">" + end, +} diff --git a/lua/ben/plugins/fugitive.lua b/lua/ben/plugins/fugitive.lua index cf45d6a..54d83cf 100644 --- a/lua/ben/plugins/fugitive.lua +++ b/lua/ben/plugins/fugitive.lua @@ -1,5 +1,6 @@ return { "tpope/vim-fugitive", + dependencies = "tpope/vim-rhubarb", -- Only enable when in a git repo cond = function() return vim.fn.isdirectory(".git") == 1 @@ -9,7 +10,6 @@ return { vim.keymap.set("n", "<leader>gd", ":G difftool<CR>") vim.keymap.set("n", "<leader>gm", ":Gvdiffsplit!<CR>") vim.keymap.set("n", "<leader>gc", ":G commit<CR>") - vim.keymap.set("n", "<leader>gbb", ":GBrowse<CR>") vim.keymap.set("n", "<leader>gps", ":G push<CR>") vim.keymap.set("n", "<leader>gpl", ":G pull<CR>") end, diff --git a/lua/ben/plugins/startify.lua b/lua/ben/plugins/startify.lua deleted file mode 100644 index 07e3de5..0000000 --- a/lua/ben/plugins/startify.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - 'mhinz/vim-startify', - config = function() - --- Define your custom header as a Lua table -local header = { - ' _ _ _ ', - ' | \\ | | ___ _____ _(_)_ __ ___ ', - ' | \\| |/ _ \\/ _ \\ \\ / / | \'_ ` _ \\ ', - ' | |\\ | __/ (_) \\ V /| | | | | | | ', - ' |_| \\_|\\___|\\___/ \\_/ |_|_| |_| |_| ', - '', -} - - --- Set the g:startify_custom_header variable -local centered_header = vim.fn["startify#center"](header) -vim.g.startify_custom_header = centered_header - end -} - --- _ _ _ --- | \ | | ___ _____ _(_)_ __ ___ --- | \| |/ _ \/ _ \ \ / / | '_ ` _ \ --- | |\ | __/ (_) \ V /| | | | | | | --- |_| \_|\___|\___/ \_/ |_|_| |_| |_| --- - diff --git a/lua/ben/plugins/treesitter.lua b/lua/ben/plugins/treesitter.lua index 362318d..b8f4ec0 100644 --- a/lua/ben/plugins/treesitter.lua +++ b/lua/ben/plugins/treesitter.lua @@ -22,27 +22,48 @@ return { -- ensure these language parsers are installed ensure_installed = { "json", - "javascript", - "typescript", "yaml", "html", "css", + "javascript", "markdown", "markdown_inline", "graphql", "bash", "lua", "go", + "gomod", + "gowork", + "gosum", "latex", "bibtex", "rnoweb", "org", "rust", "c", + "cpp", + "arduino", "vim", + "make", + "cmake", + "mermaid", + "passwd", + "gpg", + "regex", + "awk", + "sql", + "ssh_config", + "sxhkdrc", "nix", + "xml", + "csv", "dockerfile", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", "gitignore", + "diff", }, -- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx context_commentstring = { diff --git a/lua/ben/plugins/vinegar.lua b/lua/ben/plugins/vinegar.lua new file mode 100644 index 0000000..aa58b16 --- /dev/null +++ b/lua/ben/plugins/vinegar.lua @@ -0,0 +1,6 @@ +return { + "tpope/vim-vinegar", + keys = { + { "<leader>fm", "<cmd>Exp<cr>" }, + }, +} |