Add session managment to tmux and neovim

This commit is contained in:
Alexander Navarro 2023-10-30 16:43:53 -03:00
parent 58f515d9d0
commit 5898f6b5a6
7 changed files with 69 additions and 60 deletions

View file

@ -1,6 +1,7 @@
{ {
"LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" },
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
"auto-session": { "branch": "main", "commit": "3eb26b949e1b90798e84926848551046e2eb0721" },
"bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" }, "bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },

View file

@ -11,62 +11,64 @@ local opt = vim.opt
opt.autowrite = true -- Enable auto write opt.autowrite = true -- Enable auto write
--opt.clipboard = "unnamedplus" -- Sync with system clipboard --opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect" opt.completeopt = "menu,menuone,noselect"
opt.conceallevel = 3 -- Hide * markup for bold and italic opt.conceallevel = 3 -- Hide * markup for bold and italic
opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.confirm = true -- Confirm to save changes before exiting modified buffer
opt.cursorline = true -- Enable highlighting of the current line opt.cursorline = true -- Enable highlighting of the current line
opt.expandtab = true -- Use spaces instead of tabs opt.expandtab = true -- Use spaces instead of tabs
opt.formatoptions = "jcroqlnt" -- tcqj opt.formatoptions = "jcroqlnt" -- tcqj
opt.grepformat = "%f:%l:%c:%m" opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep" opt.grepprg = "rg --vimgrep"
opt.ignorecase = true -- Ignore case opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute opt.inccommand = "nosplit" -- preview incremental substitute
opt.laststatus = 0 opt.laststatus = 0
opt.list = true -- Show some invisible characters (tabs... opt.list = true -- Show some invisible characters (tabs...
opt.mouse = "a" -- Enable mouse mode opt.mouse = "a" -- Enable mouse mode
opt.number = true -- Print line number opt.number = true -- Print line number
opt.pumblend = 10 -- Popup blend opt.pumblend = 10 -- Popup blend
opt.pumheight = 10 -- Maximum number of entries in a popup opt.pumheight = 10 -- Maximum number of entries in a popup
opt.relativenumber = true -- Relative line numbers opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 8 -- Lines of context opt.scrolloff = 8 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.shiftround = true -- Round indent opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append({ W = true, I = true, c = true }) opt.shortmess:append({ W = true, I = true, c = true })
opt.showmode = false -- Dont show mode since we have a statusline opt.showmode = false -- Dont show mode since we have a statusline
opt.sidescrolloff = 8 -- Columns of context opt.sidescrolloff = 8 -- Columns of context
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
opt.smartcase = true -- Don't ignore case with capitals opt.smartcase = true -- Don't ignore case with capitals
opt.smartindent = true -- Insert indents automatically opt.smartindent = true -- Insert indents automatically
opt.spelllang = { "en" } opt.spelllang = { "en" }
opt.splitbelow = true -- Put new windows below current opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support opt.termguicolors = true -- True color support
opt.timeoutlen = 300 opt.timeoutlen = 300
opt.undofile = true opt.undofile = true
opt.undolevels = 10000 opt.undolevels = 10000
opt.updatetime = 200 -- Save swap file and trigger CursorHold opt.updatetime = 200 -- Save swap file and trigger CursorHold
opt.wildmode = "longest:full,full" -- Command-line completion mode opt.wildmode = "longest:full,full" -- Command-line completion mode
opt.winminwidth = 5 -- Minimum window width opt.winminwidth = 5 -- Minimum window width
opt.wrap = false -- Disable line wrap opt.wrap = false -- Disable line wrap
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
vim.filetype.add({ vim.filetype.add({
-- Detect and assign filetype based on the extension of the filename -- Detect and assign filetype based on the extension of the filename
extension = { extension = {
mdx = "mdx", mdx = "mdx",
log = "log", log = "log",
conf = "conf", conf = "conf",
env = "dotenv", env = "dotenv",
}, },
-- Detect and apply filetypes based on the entire filename -- Detect and apply filetypes based on the entire filename
filename = { filename = {
[".env"] = "dotenv", [".env"] = "dotenv",
["env"] = "dotenv", ["env"] = "dotenv",
["tsconfig.json"] = "jsonc", ["tsconfig.json"] = "jsonc",
}, },
-- Detect and apply filetypes based on certain patterns of the filenames -- Detect and apply filetypes based on certain patterns of the filenames
pattern = { pattern = {
-- INFO: Match filenames like - ".env.example", ".env.local" and so on -- INFO: Match filenames like - ".env.example", ".env.local" and so on
["%.env%.[%w_.-]+"] = "dotenv", ["%.env%.[%w_.-]+"] = "dotenv",
}, },
}) })

View file

@ -10,6 +10,7 @@ return {
"petertriho/cmp-git", "petertriho/cmp-git",
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
}, },
config = function() config = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })

View file

@ -1,16 +1,9 @@
return { return {
-- NOTE: First, some plugins that don't require any configuration
-- Detect tabstop and shiftwidth automatically -- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth", "tpope/vim-sleuth",
{ {
-- Autocompletion -- Highlight word under cursor
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
},
{
"RRethy/vim-illuminate", "RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
opts = { delay = 200 }, opts = { delay = 200 },

View file

@ -0,0 +1,10 @@
return {
-- sessions
"rmagatti/auto-session",
config = function()
require("auto-session").setup({
log_level = "error",
auto_session_suppress_dirs = { "~/", "~/Downloads", "/" },
})
end,
}

View file

@ -23,7 +23,7 @@ set -g prefix C-Space
# Reload Config # Reload Config
unbind R unbind R
bind R source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf" bind R source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
# Copy Mode # Copy Mode
unbind [ unbind [
@ -71,8 +71,8 @@ bind l next-window
if "test ! -d ~/.config/tmux/plugins/tpm" \ if "test ! -d ~/.config/tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'" "run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'"
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins/tpm'
run -b '~/.config/tmux/plugins/tpm/tpm' run -b '~/.config/tmux/plugins/tpm/tpm'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'catppuccin/tmux' set -g @plugin 'catppuccin/tmux'
# set -g @plugin 'rwxd/catppuccin-tmux' # set -g @plugin 'rwxd/catppuccin-tmux'
@ -82,8 +82,8 @@ set -g @plugin 'laktak/extrakto'
set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'sainnhe/tmux-fzf' set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tpm'
## Plugin Config ## Plugin Config
set -g @catppuccin_flavour 'macchiato' set -g @catppuccin_flavour 'macchiato'
@ -94,10 +94,12 @@ set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no" set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon" set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_status_connect_separator "no"
set -g @continuum-restore 'on'
set -g @resurrect-processes 'vi vim nvim man "~pnpm dev->pnpm dev *"'
TMUX_FZF_LAUNCH_KEY="w" TMUX_FZF_LAUNCH_KEY="w"
TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m" TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m"
# Tmux Managment # Tmux Managment
bind-key "f" run-shell -b "$HOME/.tmux/plugins/tmux-fzf/scripts/session.sh switch" bind-key "f" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
bind-key "F" run-shell -b "$HOME/.tmux/plugins/tmux-fzf/scripts/window.sh switch" bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/window.sh switch"