feat(nvim): configure mbbill/undotree

This commit is contained in:
2022-12-23 02:32:21 +01:00
parent af6f94cbdc
commit 8a90fd35f5
10 changed files with 138 additions and 155 deletions

View File

@@ -26,9 +26,10 @@ dashboard.section.footer.val = {
dashboard.section.buttons.val = {
dashboard.button("n", " Create New file", ":set laststatus=3 | :ene <BAR> startinsert <CR>"),
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen <CR>"),
dashboard.button("s", "Δ Search Sessions", ":Telescope persisted<CR>"),
dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua <CR>"),
dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles<CR>"),
dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc <CR>"),
-- dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc <CR>"),
dashboard.button("u", " Update Nvim Plugins", ":Lazy update <CR>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
@@ -51,22 +52,24 @@ dashboard.section.header.val = {
[[\/____\/ ]],
}
dashboard.section.header.val = {
[[ ____]],
[[ /\ \]],
[[ / \ \]],
[[ / \ \]],
[[ / \ \]],
[[ / /\ \ \]],
[[ / / \ \ \]],
[[ / / \ \ \]],
[[ / / / \ \ \]],
[[ / / / \ \ \]],
[[ / / /---------' \]],
[[/ / /_______________\]],
[[\ / /]],
[[ \/_____________________/ ]],
}
-- dashboard.section.header.val = {
-- [[ ____]],
-- [[ /\ \]],
-- [[ / \ \]],
-- [[ / \ \]],
-- [[ / \ \]],
-- [[ / /\ \ \]],
-- [[ / / \ \ \]],
-- [[ / / \ \ \]],
-- [[ / / / \ \ \]],
-- [[ / / / \ \ \]],
-- [[ / / /---------' \]],
-- [[/ / /_______________\]],
-- [[\ / /]],
-- [[ \/_____________________/ ]],
-- }
-- Layout For Luavim ascii art
dashboard.config.layout = {
{ type = "padding", val = 5 },

View File

@@ -1,68 +1,13 @@
local Workspace = require("projections.workspace")
local Session = require("projections.session")
require("projections").setup({
workspaces = { "~/Projects" }, -- Default workspaces to search for
patterns = { ".git", ".svn", ".hg" }, -- Patterns to search for, these are NOT regexp
store_hooks = {
pre = function()
require("nvim-tree").close()
end,
},
restore_hooks = {
post = function()
require("nvim-tree").open()
end,
},
})
vim.keymap.set("n", "<leader>o", function()
local find_projects = require("telescope").extensions.projections.projections
find_projects({
action = function(selection)
-- chdir is required since there might not be a session file
vim.fn.chdir(selection.value)
Session.restore(selection.value)
end,
})
end, { desc = "Find projects" })
vim.api.nvim_create_autocmd({ "DirChangedPre", "VimLeavePre" }, {
callback = function()
Session.store(vim.loop.cwd())
require("persistence").setup({
autoload = true,
use_git_branch = false,
before_save = function()
pcall(vim.cmd, ":NvimTreeClose")
end,
desc = "Store project session",
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
if 0 then
return
end
local session_info = Session.info(vim.loop.cwd())
if session_info == nil then
Session.restore_latest()
else
Session.restore(vim.loop.cwd())
end
after_source = function()
-- Reload the LSP servers
vim.lsp.stop_client(vim.lsp.get_active_clients())
pcall(vim.cmd, ":NvimTreeOpen");
end,
desc = "Restore last session automatically",
dir = vim.fn.stdpath('data') .. '/sessions/'
})
vim.api.nvim_create_user_command("RestoreSession", function()
local session_info = Session.info(vim.loop.cwd())
if session_info == nil then
Session.restore_latest()
else
Session.restore(vim.loop.cwd())
end
end, {})
vim.api.nvim_create_user_command("SaveSession", function()
Session.store(vim.loop.cwd())
end, {})
-- Add workspace command
vim.api.nvim_create_user_command("AddWorkspace", function()
Workspace.add(vim.loop.cwd())
end, {})

View File

@@ -8,6 +8,11 @@ local function open_with_trouble()
end
local default = {
extensions = {
sessions_picker = {
sessions_dir = vim.fn.stdpath('data') .. '/sessions/',
}
},
defaults = {
vimgrep_arguments = {
"rg",
@@ -61,9 +66,5 @@ local default = {
}
telescope.setup(default)
-- telescope.load_extension("themes");
--
-- telescope.load_extension("harpoon")
telescope.load_extension("projections")
telescope.load_extension("git_worktree")
telescope.load_extension("notify")

View File

@@ -32,6 +32,7 @@ map("n", "<leader>e", "<cmd>lua vim.lsp.buf.hover()<CR>", { silent = true })
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
map({ "n", "v" }, "<leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
map({ "n", "v" }, "gr", "<cmd>Lspsaga lsp_finder<CR>", options)
map("n", "<S-U>", ":UndotreeToggle<CR>", options)
map("n", "<leader>t", ":TroubleToggle<CR>", remap)

View File

@@ -15,6 +15,8 @@ set.expandtab = true -- Converts tabs to spaces
set.autoindent = true -- Good auto indent
set.autochdir = false -- Your working directory will always be the same as your working directory
set.incsearch = true -- sets incremental search
set.undofile = true;
set.undodir = vim.fn.stdpath('data') .. '/undo'
set.shell = "/bin/zsh" -- Set your shell to bash or zsh
set.shortmess:append("sI") -- Disable nvim intro
vim.cmd([[set nobackup]]) -- creates a backup file

View File

@@ -13,13 +13,19 @@ local plugins = {
--------------------
-- Layout Plugins --
--------------------
{ "mbbill/undotree", lazy = false },
{
"petertriho/nvim-scrollbar",
config = function()
require("configs.scrollbar")
end,
},
{
"stevearc/dressing.nvim",
config = function()
require("dressing")
end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
@@ -162,6 +168,18 @@ local plugins = {
--------------------
-- IDE Type Stuff --
--------------------
{
"jackMort/ChatGPT.nvim",
command = "ChatGPT",
config = function()
require("chatgpt").setup({
-- optional configuration
})
end,
dependencies = {
"MunifTanjim/nui.nvim",
}
},
{
"ThePrimeagen/git-worktree.nvim",
config = function()
@@ -169,9 +187,11 @@ local plugins = {
end,
},
{
"GnikDroy/projections.nvim",
"olimorris/persisted.nvim",
lazy = false,
config = function()
require("configs.sessions")
require("persisted").setup()
require("telescope").load_extension("persisted") -- To load the telescope extension
end,
},
-- Dap Debugger -- Have not yet been able to set this up
@@ -211,6 +231,6 @@ local plugins = {
"kristijanhusak/vim-dadbod-ui",
}
local opts = { defaults = { lazy = true } }
local opts = { defaults = { lazy = true }, install = { colorscheme = { "catppuccin" } } }
require("lazy").setup(plugins, opts)