feat(nvim): add session management

This commit is contained in:
winston 2023-06-13 07:07:41 +02:00
parent bfc3643020
commit 87e0202d63
Signed by: winston
GPG key ID: 3786770EDBC2B481
5 changed files with 101 additions and 63 deletions

View file

@ -11,9 +11,9 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"comment.nvim": { "branch": "master", "commit": "c8043290f2d77f61025494d839d88e414608c460" }, "comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" },
"copilot.lua": { "branch": "master", "commit": "77e3a4907928f0813024e573b882dc879dfc0c6b" }, "copilot.lua": { "branch": "master", "commit": "77e3a4907928f0813024e573b882dc879dfc0c6b" },
"diffview.nvim": { "branch": "main", "commit": "397ce240d3141b97067049fa3544f974d8b4d06d" }, "diffview.nvim": { "branch": "main", "commit": "0ad3e4f834093412ebbf317b7eaa9c59568824b9" },
"dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" }, "dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" },
"editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" },
"fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" },
@ -23,15 +23,16 @@
"guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" }, "guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" },
"headlines.nvim": { "branch": "master", "commit": "ddef41b2664f0ce25fe76520d708e2dc9dfebd70" }, "headlines.nvim": { "branch": "master", "commit": "ddef41b2664f0ce25fe76520d708e2dc9dfebd70" },
"indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" }, "indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" },
"lazy.nvim": { "branch": "main", "commit": "678179543e0d27650c328d8659f2c2cab4d854ef" }, "lazy.nvim": { "branch": "main", "commit": "10d4371745f88837c78c8daab00c5be6e48abea4" },
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" }, "lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"ltex-extra.nvim": { "branch": "master", "commit": "3ceb2401ab70c132305b3dba4dcb418d97b567ad" }, "ltex-extra.nvim": { "branch": "master", "commit": "3ceb2401ab70c132305b3dba4dcb418d97b567ad" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
"neodev.nvim": { "branch": "main", "commit": "d69254e1fbdc4a04c56719dde19e5eafb7b04b58" }, "neodev.nvim": { "branch": "main", "commit": "c120c96225f878e096f124321c14c45aa07968b7" },
"neogit": { "branch": "master", "commit": "68a3e90e9d1ed9e362317817851d0f34b19e426b" }, "neogit": { "branch": "master", "commit": "68a3e90e9d1ed9e362317817851d0f34b19e426b" },
"neovim-session-manager": { "branch": "master", "commit": "fd92e73506601a48adb843cdc0a15f2e63513754" },
"null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" }, "null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" },
"nvim-autopairs": { "branch": "master", "commit": "59df87a84c80a357ca8d8fe86e451b93ac476ccc" }, "nvim-autopairs": { "branch": "master", "commit": "59df87a84c80a357ca8d8fe86e451b93ac476ccc" },
"nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" }, "nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" },
@ -39,13 +40,13 @@
"nvim-dap": { "branch": "master", "commit": "7c1d47cf7188fc31acdf951f9eee22da9d479152" }, "nvim-dap": { "branch": "master", "commit": "7c1d47cf7188fc31acdf951f9eee22da9d479152" },
"nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" }, "nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
"nvim-lspconfig": { "branch": "master", "commit": "08f1f347c718e945c3b1712ebb68c6834182cf3a" }, "nvim-lspconfig": { "branch": "master", "commit": "fefba589c56a5568a089299e36a4c8242502faaa" },
"nvim-navic": { "branch": "master", "commit": "15704c607569d6c5cfeab486d3ef9459645a70ce" }, "nvim-navic": { "branch": "master", "commit": "15704c607569d6c5cfeab486d3ef9459645a70ce" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-spectre": { "branch": "master", "commit": "8adb05dbfbd36862d700b5c3d1c26f0febf3f10d" }, "nvim-spectre": { "branch": "master", "commit": "8adb05dbfbd36862d700b5c3d1c26f0febf3f10d" },
"nvim-surround": { "branch": "main", "commit": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18" }, "nvim-surround": { "branch": "main", "commit": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18" },
"nvim-tree.lua": { "branch": "master", "commit": "e0c7eb50442922920cf6727a80ae09028947ddc6" }, "nvim-tree.lua": { "branch": "master", "commit": "f873625d0636889af4cd47a01e486beb865db205" },
"nvim-treesitter": { "branch": "master", "commit": "9c9e12f0333a1686171a1315b237e9f6c49ff41d" }, "nvim-treesitter": { "branch": "master", "commit": "0ae494269acd469fbd896cf5d5a430dbbf4d4e95" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "2d6d3c7e49a24f6ffbbf7898241fefe9784f61bd" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "2d6d3c7e49a24f6ffbbf7898241fefe9784f61bd" },
"nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" }, "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "60e34278a87b1a9f2ae59a67b4a062c5f6b9b8e7" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "60e34278a87b1a9f2ae59a67b4a062c5f6b9b8e7" },
@ -61,6 +62,7 @@
"telescope-file-browser.nvim": { "branch": "master", "commit": "87dfaa9a9c251388cf4f01b9d4078c29d1fc8803" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "87dfaa9a9c251388cf4f01b9d4078c29d1fc8803" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" }, "telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
"telescope.nvim": { "branch": "master", "commit": "37c526857807e9550bdc8649700d4ceb47750ef2" }, "telescope.nvim": { "branch": "master", "commit": "37c526857807e9550bdc8649700d4ceb47750ef2" },
"todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" }, "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
"trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" }, "trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" },

View file

@ -1,5 +1,9 @@
---@type LazyPluginSpec[] ---@type LazyPluginSpec[]
return { return {
{
"Shatur/neovim-session-manager",
opts = { autoload_mode = "CurrentDir" },
},
{ {
"goolord/alpha-nvim", "goolord/alpha-nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
@ -20,8 +24,24 @@ return {
" `--' `--' ", " `--' `--' ",
} }
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"), dashboard.button("n", " New file", ":ene <bar> startinsert <cr>"),
dashboard.button("q", "󰅚 Quit NVIM", ":qa<CR>"), dashboard.button(
"SPC fd",
" Find file",
":Telescope find_files<cr>"
),
dashboard.button(
"SPC fg",
" Live grep",
":Telescope live_grep<cr>"
),
dashboard.button(
"s",
" Show sessions",
":SessionManager load_session<cr>"
),
dashboard.button("SPC fp", " Projects", ":Telescope project<CR>"),
dashboard.button("q", " Quit", ":qa<CR>"),
} }
local version = vim.version() local version = vim.version()
dashboard.section.footer.val = "neovim v" dashboard.section.footer.val = "neovim v"

View file

@ -9,6 +9,7 @@ return {
dependencies = { "neovim/nvim-lspconfig" }, dependencies = { "neovim/nvim-lspconfig" },
opts = { opts = {
highlight = true, highlight = true,
separator = "",
icons = { icons = {
File = "", File = "",
Module = "", Module = "",
@ -58,18 +59,30 @@ return {
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { lualine_b = { "branch", "diff", "diagnostics" },
"branch",
"diff",
"diagnostics",
},
lualine_c = { "searchcount" }, lualine_c = { "searchcount" },
lualine_x = { { "filetype", colored = false } }, lualine_x = { { "filetype", colored = false } },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
}, },
tabline = {}, tabline = {},
winbar = { lualine_c = { "navic" } }, winbar = {
lualine_c = { "navic" },
lualine_x = {
{
function()
return " "
end,
cond = function()
local present, navic = pcall(require, "nvim-navic")
if not present then
return false
end
return navic.is_available()
end,
},
},
},
inactive_winbar = {}, inactive_winbar = {},
extensions = {}, extensions = {},
}) })

View file

@ -3,18 +3,33 @@ return {
{ {
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"GustavoKatel/telescope-asynctasks.nvim",
"nvim-telescope/telescope-file-browser.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-telescope/telescope-project.nvim",
"nvim-telescope/telescope-ui-select.nvim",
{ "pwntester/octo.nvim", opts = {} },
},
config = function() config = function()
local telescope = require("telescope") local telescope = require("telescope")
pcall(telescope.load_extension, "fzf")
pcall(telescope.load_extension, "asynctasks") pcall(telescope.load_extension, "asynctasks")
pcall(telescope.load_extension, "file_browser") pcall(telescope.load_extension, "file_browser")
pcall(telescope.load_extension, "project") pcall(telescope.load_extension, "fzf")
pcall(telescope.load_extension, "notify") pcall(telescope.load_extension, "notify")
pcall(telescope.load_extension, "project")
pcall(telescope.load_extension, "ui-select")
telescope.setup({ telescope.setup({
defaults = { defaults = {
selection_caret = "", prompt_prefix = "",
selection_caret = "",
multi_icon = "",
borderchars = { borderchars = {
vim.g.bc.horiz, vim.g.bc.horiz,
vim.g.bc.vert, vim.g.bc.vert,
@ -39,28 +54,36 @@ return {
}, },
}, },
}) })
end,
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
"GustavoKatel/telescope-asynctasks.nvim",
"nvim-telescope/telescope-file-browser.nvim",
"nvim-telescope/telescope-project.nvim",
},
},
-- octo extension local wk_present, wk = pcall(require, "which-key")
{ if not wk_present then
"pwntester/octo.nvim", return
dependencies = { end
"nvim-lua/plenary.nvim", wk.register({
"nvim-telescope/telescope.nvim", ["<leader>f"] = {
"nvim-tree/nvim-web-devicons", name = "+Telescope",
}, b = {
opts = {}, "<cmd>Telescope file_browser grouped=true<cr>",
"File browser",
},
d = { "<cmd>Telescope find_files<cr>", "Find file" },
g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
h = { "<cmd>Telescope help_tags<cr>", "Help tags" },
n = { "<cmd>Telescope notify<cr>", "Show notifications" },
p = { "<cmd>Telescope project<cr>", "Project" },
r = { "<cmd>Telescope asynctasks all<cr>", "Run asynctasks" },
s = {
function()
require("telescope.builtin").find_files({
cwd = vim.fn.resolve(vim.fn.stdpath("config")),
})
end,
"Find in config",
},
S = { "<cmd>SessionManager load_session<cr>", "Show sessions" },
},
})
end,
}, },
}, },
} }

View file

@ -7,11 +7,12 @@ return {
wk.setup({ wk.setup({
key_labels = { key_labels = {
["<space>"] = "", ["<space>"] = "󱁐 ",
["<leader>"] = "", ["<leader>"] = "󱁐 ",
["<bs>"] = "󰌍 ",
["<cr>"] = "󰌑 ", ["<cr>"] = "󰌑 ",
["<esc>"] = "󱊷 ",
["<tab>"] = "󰌒 ", ["<tab>"] = "󰌒 ",
["<esc>"] = "",
}, },
window = { window = {
border = vim.g.bc.style, border = vim.g.bc.style,
@ -19,27 +20,6 @@ return {
}, },
}) })
-- Telescope
wk.register({
["<leader>f"] = {
name = "+Telescope",
b = { "<cmd>Telescope file_browser grouped=true<cr>", "File browser" },
d = { "<cmd>Telescope find_files<cr>", "Find file" },
g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
h = { "<cmd>Telescope help_tags<cr>", "Help tags" },
n = { "<cmd>Telescope notify<cr>", "Show notifications" },
p = { "<cmd>Telescope project<cr>", "Project" },
r = { "<cmd>Telescope asynctasks all<cr>", "Run asynctasks" },
s = {
function()
local confpath = vim.fn.resolve(vim.fn.stdpath("config"))
require("telescope.builtin").find_files({ cwd = confpath })
end,
"Find in config",
},
},
})
-- clipboard -- clipboard
wk.register({ wk.register({
["<leader>"] = { ["<leader>"] = {