summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-04-16 10:38:16 -0500
committerToby Vincent <tobyv13@gmail.com>2022-04-16 10:38:16 -0500
commitd2991233f365acab9590783a64a2e08061994939 (patch)
treec4afd00a44651f0546a9a3c1d2766e697de2ef8b
parent5f377ce61be1825bb9b1645a1e67b12f2494b9cf (diff)
feat: add session manager
-rw-r--r--nvim/.config/nvim/lua/autocommands.lua8
-rw-r--r--nvim/.config/nvim/lua/mappings.lua2
-rw-r--r--nvim/.config/nvim/lua/options.lua115
-rw-r--r--nvim/.config/nvim/lua/plugins.lua7
-rw-r--r--nvim/.config/nvim/lua/plugins/lsp-installer.lua12
-rw-r--r--nvim/.config/nvim/lua/plugins/neo-tree.lua120
-rw-r--r--nvim/.config/nvim/lua/plugins/null-ls.lua54
-rw-r--r--nvim/.config/nvim/lua/plugins/session-lens.lua15
-rw-r--r--nvim/.config/nvim/lua/plugins/session_manager.lua25
9 files changed, 185 insertions, 173 deletions
diff --git a/nvim/.config/nvim/lua/autocommands.lua b/nvim/.config/nvim/lua/autocommands.lua
index c87fb70..83203ff 100644
--- a/nvim/.config/nvim/lua/autocommands.lua
+++ b/nvim/.config/nvim/lua/autocommands.lua
@@ -1,6 +1,6 @@
-- to Show whitespace, MUST be inserted BEFORE the colorscheme command
vim.cmd [[
- augroup _general_settings
+ augroup general_settings
autocmd!
autocmd FileType qf,help,man,lspinfo,spectre_panel nnoremap <silent> <buffer> q :close<CR>
autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200})
@@ -18,6 +18,12 @@ vim.cmd [[
autocmd BufWritePre * lua vim.lsp.buf.formatting()
augroup end
+ augroup auto_search_highlighting
+ autocmd!
+ autocmd CmdlineEnter /,\? set hlsearch
+ autocmd CmdlineLeave /,\? set nohlsearch
+ augroup END
+
augroup _git
autocmd!
autocmd FileType gitcommit setlocal wrap
diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua
index 0a21f77..a594a00 100644
--- a/nvim/.config/nvim/lua/mappings.lua
+++ b/nvim/.config/nvim/lua/mappings.lua
@@ -31,6 +31,7 @@ local nmappings = {
-- Prefix "<leader>"
["<leader>"] = {
a = { "<cmd>Alpha<cr>", "Alpha" },
+ f = { "<cmd>Telescope buffers show_all_buffers=true theme=get_dropdown<cr>", "Buffers" },
c = { "<cmd>Bdelete!<CR>", "Close Buffer" },
q = { "<cmd>q!<CR>", "Quit" },
R = { "<cmd>lua require('renamer').rename()<cr>", "Rename" },
@@ -55,6 +56,7 @@ local nmappings = {
p = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
r = { "<cmd>Telescope oldfiles<cr>", "Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
+ s = { "<cmd>Telescope session-lens search_session<cr>", "Sessions" },
t = { "<cmd>Telescope buffers show_all_buffers=true theme=get_dropdown<cr>", "Buffers" },
},
diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua
index 6fb959d..5349cf3 100644
--- a/nvim/.config/nvim/lua/options.lua
+++ b/nvim/.config/nvim/lua/options.lua
@@ -2,74 +2,75 @@ local g = vim.g -- global variables
local opt = vim.opt -- vim options
local exec = vim.api.nvim_exec -- execute Vimscript
-g.mapleader = ' '
+g.mapleader = " "
-- set colorscheme
g.vscode_style = "dark"
g.vscode_transparent = 1
g.vscode_italic_comment = 1
-g.vscode_disable_nvimtree_bg = true
+g.vscode_disable_nvimtree_bg = true
-vim.cmd('colorscheme vscode')
+vim.cmd("colorscheme vscode")
-g.tex_flavor = "latex";
+g.tex_flavor = "latex"
-- global options
local options = {
- termguicolors = true, -- Enable GUI colors for the terminal to get truecolor
- list = false, -- show whitespace
- listchars = {
- nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
- extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
- precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
- tab = '▷─', -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
- trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2)
- space = ' '
- },
- fillchars = {
- diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99)
- eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
- fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
- vert = ' ' -- remove ugly vertical lines on window division
- },
- undofile = true,
- undodir = vim.fn.stdpath("config") .. "/undo",
- clipboard = opt.clipboard + "unnamedplus", -- copy & paste
- shortmess = opt.shortmess + "c",
- wrap = false, -- don't automatically wrap on load
- showmatch = true, -- show the matching part of the pair for [] {} and ()
- cursorline = true, -- highlight current line
- number = true, -- show line numbers
- relativenumber = true, -- show relative line number
- incsearch = true, -- incremental search
- hlsearch = true, -- highlighted search results
- ignorecase = true, -- ignore case sensetive while searching
- smartcase = true,
- scrolloff = 1, -- when scrolling, keep cursor 1 lines away from screen border
- sidescrolloff = 2, -- keep 30 columns visible left and right of the cursor at all times
- backspace = 'indent,start,eol', -- make backspace behave like normal again
- mouse = "a", -- turn on mouse interaction
- updatetime = 500, -- CursorHold interval
- expandtab = true,
- softtabstop = 4,
- textwidth = 100,
- shiftwidth = 4, -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces
- tabstop = 4, -- spaces per tab
- smarttab = true, -- <tab>/<BS> indent/dedent in leading whitespace
- autoindent = true, -- maintain indent of current line
- shiftround = true,
- splitbelow = true, -- open horizontal splits below current window
- splitright = true, -- open vertical splits to the right of the current window
- laststatus = 2, -- always show status line
- colorcolumn = "100", -- vertical word limit line
- hidden = true, -- allows you to hide buffers with unsaved changes without being prompted
- inccommand = 'split', -- live preview of :s results
- shell = 'zsh', -- shell to use for `!`, `:!`, `system()` etc.
- wildignore = opt.wildignore + '*.o,*.rej,*.so',
- lazyredraw = true,
- completeopt = 'menuone,noselect,noinsert',
+ termguicolors = true, -- Enable GUI colors for the terminal to get truecolor
+ list = false, -- show whitespace
+ listchars = {
+ nbsp = "⦸", -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
+ extends = "»", -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
+ precedes = "«", -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
+ tab = "▷─", -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
+ trail = "•", -- BULLET (U+2022, UTF-8: E2 80 A2)
+ space = " ",
+ },
+ fillchars = {
+ diff = "∙", -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99)
+ eob = " ", -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
+ fold = "·", -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
+ vert = " ", -- remove ugly vertical lines on window division
+ },
+ undofile = true,
+ undodir = vim.fn.stdpath("config") .. "/undo",
+ clipboard = opt.clipboard + "unnamedplus", -- copy & paste
+ shortmess = opt.shortmess + "c",
+ wrap = false, -- don't automatically wrap on load
+ showmatch = true, -- show the matching part of the pair for [] {} and ()
+ cursorline = true, -- highlight current line
+ number = true, -- show line numbers
+ relativenumber = true, -- show relative line number
+ incsearch = true, -- incremental search
+ hlsearch = true, -- highlighted search results
+ ignorecase = true, -- ignore case sensetive while searching
+ smartcase = true,
+ scrolloff = 1, -- when scrolling, keep cursor 1 lines away from screen border
+ sidescrolloff = 2, -- keep 30 columns visible left and right of the cursor at all times
+ backspace = "indent,start,eol", -- make backspace behave like normal again
+ mouse = "a", -- turn on mouse interaction
+ updatetime = 500, -- CursorHold interval
+ expandtab = true,
+ softtabstop = 4,
+ textwidth = 100,
+ shiftwidth = 4, -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces
+ tabstop = 4, -- spaces per tab
+ smarttab = true, -- <tab>/<BS> indent/dedent in leading whitespace
+ autoindent = true, -- maintain indent of current line
+ shiftround = true,
+ splitbelow = true, -- open horizontal splits below current window
+ splitright = true, -- open vertical splits to the right of the current window
+ laststatus = 2, -- always show status line
+ colorcolumn = "100", -- vertical word limit line
+ hidden = true, -- allows you to hide buffers with unsaved changes without being prompted
+ inccommand = "split", -- live preview of :s results
+ shell = "zsh", -- shell to use for `!`, `:!`, `system()` etc.
+ wildignore = opt.wildignore + "*.o,*.rej,*.so",
+ lazyredraw = true,
+ completeopt = "menuone,noselect,noinsert",
+ sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal",
}
for k, v in pairs(options) do
- vim.opt[k] = v
+ vim.opt[k] = v
end
diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua
index 2de99be..0b93193 100644
--- a/nvim/.config/nvim/lua/plugins.lua
+++ b/nvim/.config/nvim/lua/plugins.lua
@@ -62,6 +62,12 @@ return packer.startup(function(use)
})
use({
+ "rmagatti/session-lens",
+ requires = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
+ config = [[require("plugins/session-lens").setup()]],
+ })
+
+ use({
"tpope/vim-dispatch",
cmd = {
"Dispatch",
@@ -225,7 +231,6 @@ return packer.startup(function(use)
use("rcarriga/nvim-notify")
use("antoinemadec/FixCursorHold.nvim")
use("nacro90/numb.nvim")
- use("Shatur/neovim-session-manager")
use("ThePrimeagen/harpoon")
use("b0o/SchemaStore.nvim")
use("windwp/nvim-spectre")
diff --git a/nvim/.config/nvim/lua/plugins/lsp-installer.lua b/nvim/.config/nvim/lua/plugins/lsp-installer.lua
index 199fd37..ea452b4 100644
--- a/nvim/.config/nvim/lua/plugins/lsp-installer.lua
+++ b/nvim/.config/nvim/lua/plugins/lsp-installer.lua
@@ -20,6 +20,12 @@ lsp_installer.settings {
---------------------------------------------------
local enhance_server_opts = {
+ ["sumneko_lua"] = function(opts)
+ opts.on_attach = function(client)
+ client.resolved_capabilities.document_formatting = false
+ client.resolved_capabilities.document_range_formatting = false
+ end
+ end,
["eslintls"] = function(opts)
opts.settings = {
format = {
@@ -28,8 +34,8 @@ local enhance_server_opts = {
}
end,
["gopls"] = function(opts)
- opts.cmd = {
- "gopls",
+ opts.cmd = {
+ "gopls",
"serve",
}
opts.settings = {
@@ -121,4 +127,4 @@ for _, name in pairs(servers) do
server:install()
end
end
-end \ No newline at end of file
+end
diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/plugins/neo-tree.lua
index 37512d9..cea3880 100644
--- a/nvim/.config/nvim/lua/plugins/neo-tree.lua
+++ b/nvim/.config/nvim/lua/plugins/neo-tree.lua
@@ -1,6 +1,6 @@
local status_ok, neo_tree = pcall(require, "neo-tree")
if not status_ok then
- return
+ return
end
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
@@ -11,63 +11,63 @@ vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSi
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
neo_tree.setup({
- close_if_last_window = true,
- window = {
- mappings = {
- ["<space>"] = "none",
- ["<2-LeftMouse>"] = "none",
- ["<cr>"] = "none",
- ["S"] = "none",
- ["s"] = "none",
- ["t"] = "none",
- ["C"] = "none",
- ["a"] = "none",
- ["A"] = "none",
- ["d"] = "none",
- ["r"] = "none",
- ["y"] = "none",
- ["x"] = "none",
- ["p"] = "none",
- ["c"] = "none",
- ["m"] = "none",
- ["q"] = "none",
- ["R"] = "none",
- },
- },
- filesystem = {
- filtered_items = {
- hide_dotfiles = false,
- },
- use_libuv_file_watcher = true,
- window = {
- mappings = {
- ["<bs>"] = "none",
- ["."] = "none",
- ["H"] = "none",
- ["/"] = "none",
- ["f"] = "none",
- ["<c-x>"] = "none",
- },
- },
- },
- buffers = {
- mappings = {
- ["bd"] = "none",
- ["<bs>"] = "none",
- ["."] = "none",
- },
- },
- git_status = {
- window = {
- mappings = {
- ["A"] = "none",
- ["gu"] = "none",
- ["ga"] = "none",
- ["gr"] = "none",
- ["gc"] = "none",
- ["gp"] = "none",
- ["gg"] = "none",
- },
- },
- },
+ close_if_last_window = true,
+ window = {
+ mappings = {
+ ["<space>"] = "none",
+ ["<2-LeftMouse>"] = "none",
+ ["<cr>"] = "none",
+ ["S"] = "none",
+ ["s"] = "none",
+ ["t"] = "none",
+ ["C"] = "none",
+ ["a"] = "none",
+ ["A"] = "none",
+ ["d"] = "none",
+ ["r"] = "none",
+ ["y"] = "none",
+ ["x"] = "none",
+ ["p"] = "none",
+ ["c"] = "none",
+ ["m"] = "none",
+ ["q"] = "none",
+ ["R"] = "none",
+ },
+ },
+ filesystem = {
+ filtered_items = {
+ hide_dotfiles = false,
+ },
+ use_libuv_file_watcher = true,
+ window = {
+ mappings = {
+ ["<bs>"] = "none",
+ ["."] = "none",
+ ["H"] = "none",
+ ["/"] = "none",
+ ["f"] = "none",
+ ["<c-x>"] = "none",
+ },
+ },
+ },
+ buffers = {
+ mappings = {
+ ["bd"] = "none",
+ ["<bs>"] = "none",
+ ["."] = "none",
+ },
+ },
+ git_status = {
+ window = {
+ mappings = {
+ ["A"] = "none",
+ ["gu"] = "none",
+ ["ga"] = "none",
+ ["gr"] = "none",
+ ["gc"] = "none",
+ ["gp"] = "none",
+ ["gg"] = "none",
+ },
+ },
+ },
})
diff --git a/nvim/.config/nvim/lua/plugins/null-ls.lua b/nvim/.config/nvim/lua/plugins/null-ls.lua
index 5cbaa21..568f041 100644
--- a/nvim/.config/nvim/lua/plugins/null-ls.lua
+++ b/nvim/.config/nvim/lua/plugins/null-ls.lua
@@ -1,30 +1,32 @@
-local status_ok, null_ls = pcall(require, "null-ls")
-if not status_ok then
- return
-end
+ local status_ok, null_ls = pcall(require, "null-ls")
+ if not status_ok then
+ return
+ end
-local code_actions = null_ls.builtins.code_actions
-local diagnostics = null_ls.builtins.diagnostics
-local formatting = null_ls.builtins.formatting
+ local code_actions = null_ls.builtins.code_actions
+ local diagnostics = null_ls.builtins.diagnostics
+ local formatting = null_ls.builtins.formatting
-null_ls.setup({
- sources = {
- -- Code Actions
- code_actions.gitsigns,
- code_actions.shellcheck,
+ null_ls.setup({
+ sources = {
- -- Diagnostics
- -- diagnostics.codespell,
- -- diagnostics.luacheck,
- -- diagnostics.markdownlint,
- diagnostics.shellcheck,
+ require("null-ls").builtins.formatting.stylua,
+ -- Code Actions
+ code_actions.gitsigns,
+ code_actions.shellcheck,
- -- Formatting
- formatting.prettier,
- formatting.black,
- formatting.latexindent,
- formatting.markdownlint,
- formatting.stylua,
- formatting.shfmt,
- },
-})
+ -- Diagnostics
+ -- diagnostics.codespell,
+ -- diagnostics.luacheck,
+ -- diagnostics.markdownlint,
+ diagnostics.shellcheck,
+
+ -- Formatting
+ formatting.prettier,
+ formatting.black,
+ formatting.latexindent,
+ formatting.markdownlint,
+ formatting.stylua,
+ formatting.shfmt,
+ },
+ })
diff --git a/nvim/.config/nvim/lua/plugins/session-lens.lua b/nvim/.config/nvim/lua/plugins/session-lens.lua
new file mode 100644
index 0000000..cfdfe95
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/session-lens.lua
@@ -0,0 +1,15 @@
+local M = {}
+
+function M.setup()
+ local status_ok, session_lens = pcall(require, "session-lens")
+ if not status_ok then
+ return
+ end
+
+ session_lens.setup({
+ path_display = { "shorten" },
+ previewer = true,
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/plugins/session_manager.lua b/nvim/.config/nvim/lua/plugins/session_manager.lua
deleted file mode 100644
index 736e69a..0000000
--- a/nvim/.config/nvim/lua/plugins/session_manager.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-local status_ok, session_manager = pcall(require, "session_manager")
-if not status_ok then
- return
-end
-
-local status_ok, config = pcall(require, "session_manager.config")
-if not status_ok then
- return
-end
-
--- local Path = require('plenary.path')
-session_manager.setup({
- autoload_mode = config.AutoloadMode.CurrentDir, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
- autosave_last_session = false, -- Automatically save last session on exit.
-})
-
-local tele_status_ok, telescope = pcall(require, "telescope")
-if not tele_status_ok then
- return
-end
-
-local tele_session_status_ok, telescope = pcall(telescope.load_extension, "sessions")
-if not tele_session_status_ok then
- return
-end \ No newline at end of file