diff --git a/nvim/config/autosession.lua b/nvim/config/autosession.lua new file mode 100644 index 0000000..db504d6 --- /dev/null +++ b/nvim/config/autosession.lua @@ -0,0 +1,68 @@ +local defaults = { + -- Saving / restoring + enabled = true, -- Enables/disables auto creating, saving and restoring + auto_save = true, -- Enables/disables auto saving session on exit + auto_restore = true, -- Enables/disables auto restoring session on start + auto_create = true, -- Enables/disables auto creating new session files. Can be a function that returns true if a new session file should be allowed + auto_restore_last_session = false, -- On startup, loads the last saved session if session for cwd does not exist + cwd_change_handling = false, -- Automatically save/restore sessions when changing directories + single_session_mode = false, -- Enable single session mode to keep all work in one session regardless of cwd changes. When enabled, prevents creation of separate sessions for different directories and maintains one unified session. Does not work with cwd_change_handling + + -- Filtering + suppressed_dirs = nil, -- Suppress session restore/create in certain directories + allowed_dirs = nil, -- Allow session restore/create in certain directories + bypass_save_filetypes = nil, -- List of filetypes to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards + close_filetypes_on_save = { "checkhealth" }, -- Buffers with matching filetypes will be closed before saving + close_unsupported_windows = true, -- Close windows that aren't backed by normal file before autosaving a session + preserve_buffer_on_restore = nil, -- Function that returns true if a buffer should be preserved when restoring a session + + -- Git / Session naming + git_use_branch_name = false, -- Include git branch name in session name + git_auto_restore_on_branch_change = false, -- Should we auto-restore the session when the git branch changes. Requires git_use_branch_name + custom_session_tag = nil, -- Function that can return a string to be used as part of the session name + + -- Deleting + auto_delete_empty_sessions = true, -- Enables/disables deleting the session if there are only unnamed/empty buffers when auto-saving + purge_after_minutes = nil, -- Sessions older than purge_after_minutes will be deleted asynchronously on startup, e.g. set to 14400 to delete sessions that haven't been accessed for more than 10 days, defaults to off (no purging), requires >= nvim 0.10 + + -- Saving extra data + save_extra_data = nil, -- Function that returns extra data that should be saved with the session. Will be passed to restore_extra_data on restore + restore_extra_data = nil, -- Function called when there's extra data saved for a session + + -- Argument handling + args_allow_single_directory = true, -- Follow normal session save/load logic if launched with a single directory as the only argument + args_allow_files_auto_save = false, -- Allow saving a session even when launched with a file argument (or multiple files/dirs). It does not load any existing session first. Can be true or a function that returns true when saving is allowed. See documentation for more detail + + -- Misc + log_level = "error", -- Sets the log level of the plugin (debug, info, warn, error). + root_dir = vim.fn.stdpath("data") .. "/sessions/", -- Root dir where sessions will be stored + show_auto_restore_notif = false, -- Whether to show a notification when auto-restoring + restore_error_handler = nil, -- Function called when there's an error restoring. By default, it ignores fold errors otherwise it displays the error and returns false to disable auto_save + continue_restore_on_error = true, -- Keep loading the session even if there's an error + lsp_stop_on_restore = false, -- Should language servers be stopped when restoring a session. Can also be a function that will be called if set. Not called on autorestore from startup + lazy_support = true, -- Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used + legacy_cmds = true, -- Define legacy commands: Session*, Autosession (lowercase s), currently true. Set to false to prevent defining them + + ---@type SessionLens + session_lens = { + picker = nil, -- "telescope"|"snacks"|"fzf"|"select"|nil Pickers are detected automatically but you can also set one manually. Falls back to vim.ui.select + load_on_setup = true, -- Only used for telescope, registers the telescope extension at startup so you can use :Telescope session-lens + picker_opts = nil, -- Table passed to Telescope / Snacks / Fzf-Lua to configure the picker. See below for more information + + ---@type SessionLensMappings + mappings = { + -- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode + delete_session = { "i", "" }, -- mode and key for deleting a session from the picker + alternate_session = { "i", "" }, -- mode and key for swapping to alternate session from the picker + copy_session = { "i", "" }, -- mode and key for copying a session from the picker + }, + + ---@type SessionControl + session_control = { + control_dir = vim.fn.stdpath("data") .. "/auto_session/", -- Auto session control dir, for control files, like alternating between two sessions with session-lens + control_filename = "session_control.json", -- File name of the session control file + }, + }, +} + +-- require("auto-session").setup(defaults) diff --git a/nvim/config/mini.sessions.lua b/nvim/config/mini.sessions.lua index d1ebedb..f83339b 100644 --- a/nvim/config/mini.sessions.lua +++ b/nvim/config/mini.sessions.lua @@ -1 +1,27 @@ -require('mini.sessions').setup() +local settings = { + autoread = false, + + -- Whether to write currently read session before leaving it + autowrite = true, + + -- Directory where global sessions are stored (use `''` to disable) + directory = "~/.config/nvim/sessions/", + + -- File for local session (use `''` to disable) + file = 'Session.vim', + + -- Whether to force possibly harmful actions (meaning depends on function) + force = { read = false, write = true, delete = false }, + + -- Hook functions for actions. Default `nil` means 'do nothing'. + hooks = { + -- Before successful action + pre = { read = nil, write = nil, delete = nil }, + -- After successful action + post = { read = nil, write = nil, delete = nil }, + }, + + -- Whether to print session path after action + verbose = { read = false, write = true, delete = true }, +} +require('mini.sessions').setup(settings) diff --git a/nvim/config/mini.starter.lua b/nvim/config/mini.starter.lua new file mode 100644 index 0000000..6cb5eed --- /dev/null +++ b/nvim/config/mini.starter.lua @@ -0,0 +1 @@ +require('mini.starter').setup() diff --git a/nvim/config/mini.tabline.lua b/nvim/config/mini.tabline.lua index 4dbcd06..16cc1dd 100644 --- a/nvim/config/mini.tabline.lua +++ b/nvim/config/mini.tabline.lua @@ -1,6 +1,6 @@ function meow(buf_id, label) local suffix = vim.bo[buf_id].modified and '+ ' or '| ' - local prefix = '|' + local prefix = '' return prefix .. MiniTabline.default_format(buf_id, label) .. suffix end diff --git a/nvim/lua/doloro/plugins.lua b/nvim/lua/doloro/plugins.lua index e302a7f..f2a2638 100644 --- a/nvim/lua/doloro/plugins.lua +++ b/nvim/lua/doloro/plugins.lua @@ -2,11 +2,13 @@ return { "neovim/nvim-lspconfig", { "nvim-tree/nvim-tree.lua", event = "UIEnter", name="nvim-tree" }, -- mini stuff - "echasnovski/mini.notify", - "echasnovski/mini.cursorword", - "echasnovski/mini.tabline", - "echasnovski/mini.statusline", - "echasnovski/mini.completion", - "echasnovski/mini.comment", - "echasnovski/mini.sessions", + "nvim-mini/mini.notify", + "nvim-mini/mini.cursorword", + "nvim-mini/mini.tabline", + "nvim-mini/mini.statusline", + "nvim-mini/mini.completion", + "nvim-mini/mini.comment", + "nvim-mini/mini.starter", + "nvim-mini/mini.sessions", + { "rmagatti/auto-session", name="autosession"}, } diff --git a/nvim/lua/doloro/Session.vim b/nvim/meow similarity index 78% rename from nvim/lua/doloro/Session.vim rename to nvim/meow index fae033a..dfe4ef0 100644 --- a/nvim/lua/doloro/Session.vim +++ b/nvim/meow @@ -3,25 +3,20 @@ let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=- let v:this_session=expand(":p") silent only silent tabonly -cd ~/dotfiles/nvim/lua/doloro +cd ~/dotfiles/nvim if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' let s:wipebuf = bufnr('%') endif let s:shortmess_save = &shortmess set shortmess+=aoO -badd +12 plugins.lua -badd +21 ~/dotfiles/nvim/init.lua -badd +1 ~/dotfiles/nvim/init.lua.old -badd +1 init.lua -badd +1 ~/dotfiles/nvim/config/nvim-tree.lua -badd +3 ~/dotfiles/nvim/config/mini.tabline.lua +badd +1 config/mini.sessions.lua +badd +0 lua/doloro/init.lua argglobal %argdel -$argadd plugins.lua argglobal enew file NvimTree_1 -balt plugins.lua +balt config/mini.sessions.lua setlocal foldmethod=manual setlocal foldexpr=0 setlocal foldmarker={{{,}}} @@ -30,7 +25,6 @@ setlocal foldlevel=0 setlocal foldminlines=1 setlocal foldnestmax=20 setlocal nofoldenable -lcd ~/dotfiles/nvim tabnext 1 if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' silent exe 'bwipe ' . s:wipebuf diff --git a/nvim/sessions/meowmeow.vim b/nvim/sessions/meowmeow.vim new file mode 100644 index 0000000..e17cc0a --- /dev/null +++ b/nvim/sessions/meowmeow.vim @@ -0,0 +1,42 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~ +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +let s:shortmess_save = &shortmess +set shortmess+=aoO +badd +3 dotfiles/nvim/lua/doloro/plugins.lua +argglobal +%argdel +argglobal +enew +file NvimTree_1 +balt dotfiles/nvim/lua/doloro/plugins.lua +setlocal foldmethod=manual +setlocal foldexpr=0 +setlocal foldmarker={{{,}}} +setlocal foldignore=# +setlocal foldlevel=0 +setlocal foldminlines=1 +setlocal foldnestmax=20 +setlocal nofoldenable +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 +let &shortmess = s:shortmess_save +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/nvim/sessions/test b/nvim/sessions/test new file mode 100644 index 0000000..05b4e22 --- /dev/null +++ b/nvim/sessions/test @@ -0,0 +1,41 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~/dotfiles/nvim +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +let s:shortmess_save = &shortmess +set shortmess+=aoO +argglobal +%argdel +argglobal +enew +file ministarter://1/welcome +setlocal foldmethod=manual +setlocal foldexpr=0 +setlocal foldmarker={{{,}}} +setlocal foldignore=# +setlocal foldlevel=999 +setlocal foldminlines=1 +setlocal foldnestmax=20 +setlocal foldenable +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 +let &shortmess = s:shortmess_save +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +nohlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/tmux/plugins/minimal-tmux-status b/tmux/plugins/minimal-tmux-status new file mode 160000 index 0000000..de2bb04 --- /dev/null +++ b/tmux/plugins/minimal-tmux-status @@ -0,0 +1 @@ +Subproject commit de2bb049a743e0f05c08531a0461f7f81da0fc72 diff --git a/tmux/plugins/tmux-sensible b/tmux/plugins/tmux-sensible new file mode 160000 index 0000000..25cb91f --- /dev/null +++ b/tmux/plugins/tmux-sensible @@ -0,0 +1 @@ +Subproject commit 25cb91f42d020f675bb0a2ce3fbd3a5d96119efa diff --git a/tmux/plugins/tpm b/tmux/plugins/tpm new file mode 160000 index 0000000..99469c4 --- /dev/null +++ b/tmux/plugins/tpm @@ -0,0 +1 @@ +Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946 diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..45f116d --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,8 @@ +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +set -g @plugin 'niksingh710/minimal-tmux-status' + + + +run '~/.tmux/plugins/tpm/tpm'