Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't restore sessions with terminal buffers #391

Closed
leg7 opened this issue Nov 9, 2024 · 6 comments
Closed

[BUG] Can't restore sessions with terminal buffers #391

leg7 opened this issue Nov 9, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@leg7
Copy link

leg7 commented Nov 9, 2024

Describe the bug
If a session has a buffer with a terminal open restoring it will give an error saying that it's not possible to return to normal mode from the terminal. Possibly because it involves a different keybind/function. (<c-\>)
The session is restored correctly it's just that you the plugin gives an annoying error message.

To Reproduce
Open empty buffer
Open terminal buffer in a split :vs |:terminal<cr>
Save session :SessionSave
Close nvim
Open nvim again
Restore said session.

Expected behavior
Session is restored without errors.

Checkhealth

auto-session: require("auto-session.health").check()

vim options ~
- OK vim.o.sessionoptions

Lazy.nvim settings ~
- OK Lazy.nvim support is enabled
- OK auto-session is not lazy loaded

Config ~
- OK {
  suppressed_dirs = { "~/", "/" }
  }

General Info ~
- Session directory: /persistent/home/user/.local/share/nvim/sessions/
- Current session: /persistent/home/user
- Current session file: /persistent/home/user/.local/share/nvim/sessions/%2Fpersistent%2Fhome%2Fuser.vim

Baseline (please complete the following information):
sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions

Linux eleum 6.6.59 #1-NixOS SMP PREEMPT_DYNAMIC Fri Nov 1 00:58:34 UTC 2024 x86_64 GNU/Linux

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1693350652

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/939b2xyf52q9w9nkp6ll20y6nqbm5ydl-neovim-unwrapped-0.9.5/share/nvim
"

https://github.com/leg7/flake/blob/main/computers/modules/systems/river/config/nvim/init.lua

Additional context

auto-session DEBUG: Config at start of setup {                                                                                                                                                                                                                                                                                                                                                                                    
  args_allow_files_auto_save = false,
  args_allow_single_directory = true,
  auto_create = true,
  auto_restore = true,
  auto_restore_last_session = false,
  auto_save = true,
  close_unsupported_windows = true,
  continue_restore_on_error = true,
  cwd_change_handling = false,
  enabled = true,
  lazy_support = true,
  log_level = "debug",
  root_dir = "/persistent/home/user/.local/share/nvim/sessions/",
  session_lens = {
    load_on_setup = true,
    mappings = {
      alternate_session = { "i", "<C-S>" },
      copy_session = { "i", "<C-Y>" },
      delete_session = { "i", "<C-D>" }
    },
    previewer = false,
    session_control = {
      control_dir = "/persistent/home/user/.local/share/nvim/auto_session/",
      control_filename = "session_control.json"
    },
    theme_conf = {}
  },
  suppressed_dirs = { "~/", "/" },
  use_git_branch = false
}
auto-session WARN: vim.o.sessionoptions is missing localoptions. 
Use `:checkhealth autosession` for more info.
auto-session DEBUG: Root dir set to: /persistent/home/user/.local/share/nvim/sessions/
auto-session DEBUG: cwd_change_handling is disabled, skipping setting DirChangedPre and DirChanged autocmd handling
auto-session DEBUG: Loading session lens
auto-session INFO: Telescope.nvim is not installed. Session Lens cannot be setup!
"init.lua" 721L, 19805B
auto-session DEBUG: Lazy is loaded, but not visible, will try to restore session
auto-session DEBUG: enabled_for_command_line_argv, launch_argv: { "init.lua" }
auto-session DEBUG: args_allow_files_auto_save is false, not enabling restoring/saving
auto-session DEBUG: No session restored, call no_restore hooks
auto-session DEBUG: get_session_file_name no session_name, using cwd: /persistent/home/user/.local/bin/flake/computers/modules/systems/river/config/nvim
auto-session DEBUG: Autosaving before restoring {
  cwd = "/persistent/home/user/.local/bin/flake/computers/modules/systems/river/config/nvim",
  session_name = "/persistent/home/user"
}
auto-session DEBUG: enabled_for_command_line_argv, launch_argv: { "init.lua" }
auto-session DEBUG: args_allow_files_auto_save is false, not enabling restoring/saving
auto-session DEBUG: auto_save, pager, headless, or enabled_for_command_line_argv returned false
auto-session DEBUG: auto_save_conditions_met: auto_save() is false, returning false
auto-session DEBUG: Auto save conditions not met
auto-session DEBUG: RestoreSessionFromDir start { "/persistent/home/user/.local/share/nvim/sessions/", "/persistent/home/user" }
auto-session DEBUG: RestoreSessionFromDir validated session_dir:  /persistent/home/user/.local/share/nvim/sessions/
auto-session DEBUG: RestoreSessionFromDir escaped session name: %2Fpersistent%2Fhome%2Fuser.vim
auto-session DEBUG: get_session_file_name no session_name, using cwd: /persistent/home/user/.local/bin/flake/computers/modules/systems/river/config/nvim
auto-session DEBUG: Session is manually named
auto-session DEBUG: RestoreSessionFile restoring session from: /persistent/home/user/.local/share/nvim/sessions/%2Fpersistent%2Fhome%2Fuser.vim
auto-session ERROR: Error restoring session, disabling auto save.
Error: vim/_editor.lua:0: nvim_exec2()../persistent/home/user/.local/share/nvim/sessions/%2Fpersistent%2Fhome%2Fuser.vim, line 75: Vim(normal):Can't re-enter normal mode from terminal mode
@leg7 leg7 added the bug Something isn't working label Nov 9, 2024
@cameronr
Copy link
Collaborator

cameronr commented Nov 9, 2024

Thanks for reporting the issue. I tried reproducing with your config files but I'm not getting any errors when restoring session with terminal as indicated in the repro steps.

Can you post the contents of the session file:
/persistent/home/user/.local/share/nvim/sessions/%2Fpersistent%2Fhome%2Fuser.vim

@leg7
Copy link
Author

leg7 commented Nov 10, 2024

I deleted that session but I can give you another one with the same bug.

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("<sfile>:p")
silent only
silent tabonly
cd ~/.local/bin/flake/computers/modules/systems/river/config/nvim
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
  let s:wipebuf = bufnr('%')
endif
let s:shortmess_save = &shortmess
if &shortmess =~ 'A'
  set shortmess=aoOA
else
  set shortmess=aoO
endif
badd +1 init.lua
badd +1 term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu
argglobal
%argdel
edit init.lua
let s:save_splitbelow = &splitbelow
let s:save_splitright = &splitright
set splitbelow splitright
wincmd _ | wincmd |
vsplit
1wincmd h
wincmd w
let &splitbelow = s:save_splitbelow
let &splitright = s:save_splitright
wincmd t
let s:save_winminheight = &winminheight
let s:save_winminwidth = &winminwidth
set winminheight=0
set winheight=1
set winminwidth=0
set winwidth=1
exe 'vert 1resize ' . ((&columns * 114 + 85) / 170)
exe 'vert 2resize ' . ((&columns * 55 + 85) / 170)
argglobal
balt term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu
let s:cpo_save=&cpo
set cpo&vim
nnoremap <buffer> K <Cmd>lua vim.lsp.buf.hover()�
nnoremap <buffer> [d <Cmd>lua vim.diagnostic.goto_prev()�
nnoremap <buffer> ]d <Cmd>lua vim.diagnostic.goto_next()�
nnoremap <buffer> gd <Cmd>lua vim.lsp.buf.definition()�
nnoremap <buffer> gD <Cmd>lua vim.lsp.buf.declaration()�
nnoremap <buffer> gi <Cmd>lua vim.lsp.buf.implementation()�
nnoremap <buffer> go <Cmd>lua vim.lsp.buf.type_definition()�
nnoremap <buffer> gr <Cmd>lua vim.lsp.buf.references()�
nnoremap <buffer> gs <Cmd>lua vim.lsp.buf.signature_help()�
onoremap <buffer> ih :��Gitsigns select_hunk�
xnoremap <buffer> ih :��Gitsigns select_hunk�
nnoremap <buffer> <F2> <Cmd>lua vim.lsp.buf.rename()�
nnoremap <buffer> <F3> <Cmd>lua vim.lsp.buf.format({async = true})�
xnoremap <buffer> <F3> <Cmd>lua vim.lsp.buf.format({async = true})�
nnoremap <buffer> <F4> <Cmd>lua vim.lsp.buf.code_action()�
xnoremap <buffer> <F4> <Cmd>lua vim.lsp.buf.code_action()�
let &cpo=s:cpo_save
unlet s:cpo_save
setlocal keymap=
setlocal noarabic
setlocal autoindent
setlocal backupcopy=
setlocal nobinary
setlocal breakindent
setlocal breakindentopt=
setlocal bufhidden=
setlocal buflisted
setlocal buftype=
setlocal cindent
setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e
setlocal cinoptions=
setlocal cinwords=if,else,while,do,for,switch
setlocal cinscopedecls=public,protected,private
setlocal colorcolumn=
setlocal comments=:--
setlocal commentstring=--\ %s
setlocal complete=.,w,b,u,t
setlocal concealcursor=
setlocal conceallevel=0
setlocal completefunc=
setlocal nocopyindent
setlocal nocursorbind
setlocal nocursorcolumn
setlocal cursorline
setlocal cursorlineopt=both
setlocal define=\\<function\\�|\\<local\\%(\\s\\+function\\)\\=
setlocal dictionary=
setlocal nodiff
setlocal equalprg=
setlocal errorformat=
setlocal noexpandtab
if &filetype != 'lua'
setlocal filetype=lua
endif
setlocal fillchars=
setlocal fixendofline
setlocal foldcolumn=0
setlocal foldenable
setlocal foldexpr=0
setlocal foldignore=#
setlocal foldlevel=0
setlocal foldmarker={{{,}}}
setlocal foldmethod=manual
setlocal foldminlines=1
setlocal foldnestmax=20
setlocal foldtext=foldtext()
setlocal formatexpr=v:lua.vim.lsp.formatexpr()
setlocal formatoptions=jcroql
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
setlocal formatprg=
setlocal grepprg=
setlocal iminsert=0
setlocal imsearch=-1
setlocal include=
setlocal includeexpr=tr(v:fname,'.','/')
setlocal indentexpr=nvim_treesitter#indent()
setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,0=end,0=until
setlocal infercase
setlocal iskeyword=@,48-57,_,192-255
setlocal keywordprg=
setlocal nolinebreak
setlocal nolisp
setlocal lispoptions=
setlocal lispwords=
setlocal nolist
setlocal listchars=
setlocal makeencoding=
setlocal makeprg=
setlocal matchpairs=(:),{:},[:]
setlocal modeline
setlocal modifiable
setlocal nrformats=bin,hex
setlocal nonumber
setlocal numberwidth=4
setlocal omnifunc=v:lua.vim.lsp.omnifunc
setlocal path=
setlocal nopreserveindent
setlocal nopreviewwindow
setlocal quoteescape=\\
setlocal noreadonly
setlocal norelativenumber
setlocal norightleft
setlocal rightleftcmd=search
setlocal scrollback=-1
setlocal noscrollbind
setlocal scrolloff=-1
setlocal shiftwidth=6
setlocal showbreak=
setlocal sidescrolloff=-1
setlocal signcolumn=yes
setlocal smartindent
setlocal softtabstop=0
setlocal nospell
setlocal spellcapcheck=[.?!]\\_[\\])'\"\	\ ]\\+
setlocal spellfile=
setlocal spelllang=en
setlocal spelloptions=noplainbuffer
setlocal statuscolumn=
setlocal statusline=%<%#lualine_c_filename_normal#\ init.lua\ %#lualine_c_normal#%#lualine_c_progress_normal#\ 88%%\ %#lualine_c_normal#%#lualine_c_location_normal#\ 628:1\ \ %#lualine_c_normal#%#lualine_c_normal#\ %=\ %#lualine_c_filetype_DevIconLua_normal#\ \ %#lualine_c_normal#\ %#lualine_c_normal#%#lualine_c_7_normal#\ lua_ls\ %#lualine_c_normal#%#lualine_c_diagnostics_warn_normal#\ \ 106\ %#lualine_c_diagnostics_info_normal#\ 1\ %#lualine_c_diagnostics_hint_normal#󰌶\ 2\ %#lualine_c_normal#%=%#lualine_c_normal#\ \ main\ 
setlocal suffixesadd=.lua
setlocal noswapfile
setlocal synmaxcol=3000
if &syntax != ''
setlocal syntax=
endif
setlocal tagfunc=v:lua.vim.lsp.tagfunc
setlocal tabstop=6
setlocal tagcase=
setlocal tags=
setlocal textwidth=0
setlocal thesaurus=
setlocal thesaurusfunc=
setlocal undofile
setlocal undolevels=-123456
setlocal varsofttabstop=
setlocal vartabstop=
setlocal virtualedit=
setlocal winbar=
setlocal winblend=0
setlocal winhighlight=
setlocal nowinfixheight
setlocal nowinfixwidth
setlocal wrap
setlocal wrapmargin=0
silent! normal! zE
let &fdl = &fdl
let s:l = 628 - ((44 * winheight(0) + 32) / 64)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 628
normal! 0
wincmd w
argglobal
if bufexists(fnamemodify("term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu", ":p")) | buffer term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu | else | edit term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu | endif
if &buftype ==# 'terminal'
  silent file term://~/.local/bin/flake//88005:/run/current-system/sw/bin/nu
endif
balt init.lua
setlocal keymap=
setlocal noarabic
setlocal autoindent
setlocal backupcopy=
setlocal nobinary
setlocal breakindent
setlocal breakindentopt=
setlocal bufhidden=
setlocal buflisted
setlocal buftype=terminal
setlocal cindent
setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e
setlocal cinoptions=
setlocal cinwords=if,else,while,do,for,switch
setlocal cinscopedecls=public,protected,private
setlocal colorcolumn=
setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
setlocal commentstring=
setlocal complete=.,w,b,u,t
setlocal concealcursor=
setlocal conceallevel=0
setlocal completefunc=
setlocal nocopyindent
setlocal nocursorbind
setlocal nocursorcolumn
setlocal cursorline
setlocal cursorlineopt=both
setlocal define=
setlocal dictionary=
setlocal nodiff
setlocal equalprg=
setlocal errorformat=
setlocal noexpandtab
if &filetype != ''
setlocal filetype=
endif
setlocal fillchars=
setlocal fixendofline
setlocal foldcolumn=0
setlocal foldenable
setlocal foldexpr=0
setlocal foldignore=#
setlocal foldlevel=0
setlocal foldmarker={{{,}}}
setlocal foldmethod=manual
setlocal foldminlines=1
setlocal foldnestmax=20
setlocal foldtext=foldtext()
setlocal formatexpr=
setlocal formatoptions=tcqj
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
setlocal formatprg=
setlocal grepprg=
setlocal iminsert=0
setlocal imsearch=-1
setlocal include=
setlocal includeexpr=
setlocal indentexpr=
setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e
setlocal infercase
setlocal iskeyword=@,48-57,_,192-255
setlocal keywordprg=
setlocal nolinebreak
setlocal nolisp
setlocal lispoptions=
setlocal lispwords=
setlocal nolist
setlocal listchars=
setlocal makeencoding=
setlocal makeprg=
setlocal matchpairs=(:),{:},[:]
setlocal modeline
setlocal nomodifiable
setlocal nrformats=bin,hex
setlocal nonumber
setlocal numberwidth=4
setlocal omnifunc=
setlocal path=
setlocal nopreserveindent
setlocal nopreviewwindow
setlocal quoteescape=\\
setlocal noreadonly
setlocal norelativenumber
setlocal norightleft
setlocal rightleftcmd=search
setlocal scrollback=10000
setlocal noscrollbind
setlocal scrolloff=-1
setlocal shiftwidth=6
setlocal showbreak=
setlocal sidescrolloff=-1
setlocal signcolumn=yes
setlocal smartindent
setlocal softtabstop=0
setlocal nospell
setlocal spellcapcheck=[.?!]\\_[\\])'\"\	\ ]\\+
setlocal spellfile=
setlocal spelllang=en
setlocal spelloptions=
setlocal statuscolumn=
setlocal statusline=%#lualine_c_inactive#%=
setlocal suffixesadd=
setlocal noswapfile
setlocal synmaxcol=3000
if &syntax != ''
setlocal syntax=
endif
setlocal tagfunc=
setlocal tabstop=6
setlocal tagcase=
setlocal tags=
setlocal textwidth=0
setlocal thesaurus=
setlocal thesaurusfunc=
setlocal undofile
setlocal undolevels=-1
setlocal varsofttabstop=
setlocal vartabstop=
setlocal virtualedit=
setlocal winbar=
setlocal winblend=0
setlocal winhighlight=
setlocal nowinfixheight
setlocal nowinfixwidth
setlocal nowrap
setlocal wrapmargin=0
let s:l = 38 - ((37 * winheight(0) + 32) / 64)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 38
normal! 0
wincmd w
exe 'vert 1resize ' . ((&columns * 114 + 85) / 170)
exe 'vert 2resize ' . ((&columns * 55 + 85) / 170)
if exists(':tcd') == 2 | tcd ~/.local/bin/flake | endif
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 &winminheight = s:save_winminheight
let &winminwidth = s:save_winminwidth
let s:sx = expand("<sfile>: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 :

@cameronr
Copy link
Collaborator

Hmm, nothing is jumping out to me in that file (there are some normal calls but that's not unusual) and it's still not reproducing for me.

Can you answer the following to see if that helps us figure out what might be going on:

  1. What line number does it say the error is on for that session above (or, if you don't have that session, can you post a new session with the line number it says the error is happening on)? I assume it's one of the calls to normal but I want to make sure and it'll be helpful to see the specific command that's causing the error
  2. Can you try with the latest released nvim (0.10.2)? I think it's unlikely to change anything but i'm trying to rule out possible causes.
  3. Does it reproduce for you every time you save a session with a terminal open?
  4. The error message is from this line. What I don't understand is why it thinks it would be in terminal mode when restoring the session. Do you have anything in your config that tries to start terminals in insert/terminal mode?
  5. Does the error happen when restoring a session via :SessionRestore (or :SessionSearch) as well as when starting nvim in a directory with a session with a terminal?
  6. What happens if you have a terminal window open and you run :mks (to create a session manually) and then :%bd! | source Session.vim? Does it also give you an error?

thanks for the help!

@leg7
Copy link
Author

leg7 commented Nov 11, 2024

1

auto-session ERROR: Error restoring session, disabling auto save.                                                                                                                                                                                                                                                                                                                                                                            
Error: vim/_editor.lua:0: nvim_exec2()../persistent/home/user/.local/share/nvim/sessions/%2Fpersistent%2Fhome%2Fuser%2F%2Elocal%2Fbin%2Fflake.vim, line 338: Vim(normal):Can't re-enter normal mode from terminal mode

Contents:

     1	let SessionLoad = 1
     2	let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
     3	let v:this_session=expand("<sfile>:p")
     4	silent only
     5	silent tabonly
     6	cd ~/.local/bin/flake
     7	if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
     8	  let s:wipebuf = bufnr('%')
     9	endif
    10	let s:shortmess_save = &shortmess
    11	if &shortmess =~ 'A'
    12	  set shortmess=aoOA
    13	else
    14	  set shortmess=aoO
    15	endif
    16	badd +1 .
    17	badd +1 computers/modules/systems/river/config/nvim/init.lua
    18	badd +3 term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu
    19	argglobal
    20	%argdel
    21	edit computers/modules/systems/river/config/nvim/init.lua
    22	let s:save_splitbelow = &splitbelow
    23	let s:save_splitright = &splitright
    24	set splitbelow splitright
    25	wincmd _ | wincmd |
    26	vsplit
    27	1wincmd h
    28	wincmd w
    29	let &splitbelow = s:save_splitbelow
    30	let &splitright = s:save_splitright
    31	wincmd t
    32	let s:save_winminheight = &winminheight
    33	let s:save_winminwidth = &winminwidth
    34	set winminheight=0
    35	set winheight=1
    36	set winminwidth=0
    37	set winwidth=1
    38	exe 'vert 1resize ' . ((&columns * 277 + 214) / 429)
    39	exe 'vert 2resize ' . ((&columns * 151 + 214) / 429)
    40	argglobal
    41	balt term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu
    42	let s:cpo_save=&cpo
    43	set cpo&vim
    44	nnoremap <buffer> �� <Cmd>noh�
    45	nnoremap <buffer> K <Cmd>lua vim.lsp.buf.hover()�
    46	nnoremap <buffer> [d <Cmd>lua vim.diagnostic.goto_prev()�
    47	nnoremap <buffer> ]d <Cmd>lua vim.diagnostic.goto_next()�
    48	nnoremap <buffer> gd <Cmd>lua vim.lsp.buf.definition()�
    49	nnoremap <buffer> gD <Cmd>lua vim.lsp.buf.declaration()�
    50	nnoremap <buffer> gi <Cmd>lua vim.lsp.buf.implementation()�
    51	nnoremap <buffer> go <Cmd>lua vim.lsp.buf.type_definition()�
    52	nnoremap <buffer> gr <Cmd>lua vim.lsp.buf.references()�
    53	nnoremap <buffer> gs <Cmd>lua vim.lsp.buf.signature_help()�
    54	onoremap <buffer> ih :��Gitsigns select_hunk�
    55	xnoremap <buffer> ih :��Gitsigns select_hunk�
    56	nnoremap <buffer> <F2> <Cmd>lua vim.lsp.buf.rename()�
    57	nnoremap <buffer> <F3> <Cmd>lua vim.lsp.buf.format({async = true})�
    58	xnoremap <buffer> <F3> <Cmd>lua vim.lsp.buf.format({async = true})�
    59	nnoremap <buffer> <F4> <Cmd>lua vim.lsp.buf.code_action()�
    60	xnoremap <buffer> <F4> <Cmd>lua vim.lsp.buf.code_action()�
    61	let &cpo=s:cpo_save
    62	unlet s:cpo_save
    63	setlocal keymap=
    64	setlocal noarabic
    65	setlocal autoindent
    66	setlocal backupcopy=
    67	setlocal nobinary
    68	setlocal breakindent
    69	setlocal breakindentopt=
    70	setlocal bufhidden=
    71	setlocal buflisted
    72	setlocal buftype=
    73	setlocal cindent
    74	setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e
    75	setlocal cinoptions=
    76	setlocal cinwords=if,else,while,do,for,switch
    77	setlocal cinscopedecls=public,protected,private
    78	setlocal colorcolumn=
    79	setlocal comments=:--
    80	setlocal commentstring=--\ %s
    81	setlocal complete=.,w,b,u,t
    82	setlocal concealcursor=
    83	setlocal conceallevel=0
    84	setlocal completefunc=
    85	setlocal nocopyindent
    86	setlocal nocursorbind
    87	setlocal nocursorcolumn
    88	setlocal cursorline
    89	setlocal cursorlineopt=both
    90	setlocal define=\\<function\\�|\\<local\\%(\\s\\+function\\)\\=
    91	setlocal dictionary=
    92	setlocal nodiff
    93	setlocal equalprg=
    94	setlocal errorformat=
    95	setlocal noexpandtab
    96	if &filetype != 'lua'
    97	setlocal filetype=lua
    98	endif
    99	setlocal fillchars=
   100	setlocal fixendofline
   101	setlocal foldcolumn=0
   102	setlocal foldenable
   103	setlocal foldexpr=0
   104	setlocal foldignore=#
   105	setlocal foldlevel=0
   106	setlocal foldmarker={{{,}}}
   107	setlocal foldmethod=manual
   108	setlocal foldminlines=1
   109	setlocal foldnestmax=20
   110	setlocal foldtext=foldtext()
   111	setlocal formatexpr=v:lua.vim.lsp.formatexpr()
   112	setlocal formatoptions=jcroql
   113	setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
   114	setlocal formatprg=
   115	setlocal grepprg=
   116	setlocal iminsert=0
   117	setlocal imsearch=-1
   118	setlocal include=
   119	setlocal includeexpr=tr(v:fname,'.','/')
   120	setlocal indentexpr=nvim_treesitter#indent()
   121	setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,0=end,0=until
   122	setlocal infercase
   123	setlocal iskeyword=@,48-57,_,192-255
   124	setlocal keywordprg=
   125	setlocal nolinebreak
   126	setlocal nolisp
   127	setlocal lispoptions=
   128	setlocal lispwords=
   129	setlocal nolist
   130	setlocal listchars=
   131	setlocal makeencoding=
   132	setlocal makeprg=
   133	setlocal matchpairs=(:),{:},[:]
   134	setlocal modeline
   135	setlocal modifiable
   136	setlocal nrformats=bin,hex
   137	setlocal nonumber
   138	setlocal numberwidth=4
   139	setlocal omnifunc=v:lua.vim.lsp.omnifunc
   140	setlocal path=
   141	setlocal nopreserveindent
   142	setlocal nopreviewwindow
   143	setlocal quoteescape=\\
   144	setlocal noreadonly
   145	setlocal norelativenumber
   146	setlocal norightleft
   147	setlocal rightleftcmd=search
   148	setlocal scrollback=-1
   149	setlocal noscrollbind
   150	setlocal scrolloff=-1
   151	setlocal shiftwidth=6
   152	setlocal showbreak=
   153	setlocal sidescrolloff=-1
   154	setlocal signcolumn=yes
   155	setlocal smartindent
   156	setlocal softtabstop=0
   157	setlocal nospell
   158	setlocal spellcapcheck=[.?!]\\_[\\])'\"\	\ ]\\+
   159	setlocal spellfile=
   160	setlocal spelllang=en
   161	setlocal spelloptions=noplainbuffer
   162	setlocal statuscolumn=
   163	setlocal statusline=%<%#lualine_c_filename_normal#\ init.lua\ %#lualine_c_normal#%#lualine_c_progress_normal#\ \ 3%%\ %#lualine_c_normal#%#lualine_c_location_normal#\ \ 26:1\ \ %#lualine_c_normal#%#lualine_c_normal#\ %=\ %#lualine_c_filetype_DevIconLua_normal#\ \ %#lualine_c_normal#\ %#lualine_c_normal#%#lualine_c_7_normal#\ lua_ls\ %#lualine_c_normal#%#lualine_c_diagnostics_warn_normal#\ \ 106\ %#lualine_c_diagnostics_info_normal#\ 1\ %#lualine_c_diagnostics_hint_normal#󰌶\ 2\ %#lualine_c_normal#%=%#lualine_c_normal#\ \ main\ 
   164	setlocal suffixesadd=.lua
   165	setlocal noswapfile
   166	setlocal synmaxcol=3000
   167	if &syntax != ''
   168	setlocal syntax=
   169	endif
   170	setlocal tagfunc=v:lua.vim.lsp.tagfunc
   171	setlocal tabstop=6
   172	setlocal tagcase=
   173	setlocal tags=
   174	setlocal textwidth=0
   175	setlocal thesaurus=
   176	setlocal thesaurusfunc=
   177	setlocal undofile
   178	setlocal undolevels=-123456
   179	setlocal varsofttabstop=
   180	setlocal vartabstop=
   181	setlocal virtualedit=
   182	setlocal winbar=
   183	setlocal winblend=0
   184	setlocal winhighlight=
   185	setlocal nowinfixheight
   186	setlocal nowinfixwidth
   187	setlocal wrap
   188	setlocal wrapmargin=0
   189	silent! normal! zE
   190	let &fdl = &fdl
   191	let s:l = 26 - ((14 * winheight(0) + 33) / 66)
   192	if s:l < 1 | let s:l = 1 | endif
   193	keepjumps exe s:l
   194	normal! zt
   195	keepjumps 26
   196	normal! 0
   197	wincmd w
   198	argglobal
   199	if bufexists(fnamemodify("term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu", ":p")) | buffer term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu | else | edit term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu | endif
   200	if &buftype ==# 'terminal'
   201	  silent file term://~/.local/bin/flake//862168:/run/current-system/sw/bin/nu
   202	endif
   203	balt computers/modules/systems/river/config/nvim/init.lua
   204	let s:cpo_save=&cpo
   205	set cpo&vim
   206	nnoremap <buffer> �� <Cmd>noh�
   207	let &cpo=s:cpo_save
   208	unlet s:cpo_save
   209	setlocal keymap=
   210	setlocal noarabic
   211	setlocal autoindent
   212	setlocal backupcopy=
   213	setlocal nobinary
   214	setlocal breakindent
   215	setlocal breakindentopt=
   216	setlocal bufhidden=
   217	setlocal buflisted
   218	setlocal buftype=terminal
   219	setlocal cindent
   220	setlocal cinkeys=0{,0},0),0],:,0#,!^F,o,O,e
   221	setlocal cinoptions=
   222	setlocal cinwords=if,else,while,do,for,switch
   223	setlocal cinscopedecls=public,protected,private
   224	setlocal colorcolumn=
   225	setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
   226	setlocal commentstring=
   227	setlocal complete=.,w,b,u,t
   228	setlocal concealcursor=
   229	setlocal conceallevel=0
   230	setlocal completefunc=
   231	setlocal nocopyindent
   232	setlocal nocursorbind
   233	setlocal nocursorcolumn
   234	setlocal cursorline
   235	setlocal cursorlineopt=both
   236	setlocal define=
   237	setlocal dictionary=
   238	setlocal nodiff
   239	setlocal equalprg=
   240	setlocal errorformat=
   241	setlocal noexpandtab
   242	if &filetype != ''
   243	setlocal filetype=
   244	endif
   245	setlocal fillchars=
   246	setlocal fixendofline
   247	setlocal foldcolumn=0
   248	setlocal foldenable
   249	setlocal foldexpr=0
   250	setlocal foldignore=#
   251	setlocal foldlevel=0
   252	setlocal foldmarker={{{,}}}
   253	setlocal foldmethod=manual
   254	setlocal foldminlines=1
   255	setlocal foldnestmax=20
   256	setlocal foldtext=foldtext()
   257	setlocal formatexpr=
   258	setlocal formatoptions=tcqj
   259	setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
   260	setlocal formatprg=
   261	setlocal grepprg=
   262	setlocal iminsert=0
   263	setlocal imsearch=-1
   264	setlocal include=
   265	setlocal includeexpr=
   266	setlocal indentexpr=
   267	setlocal indentkeys=0{,0},0),0],:,0#,!^F,o,O,e
   268	setlocal infercase
   269	setlocal iskeyword=@,48-57,_,192-255
   270	setlocal keywordprg=
   271	setlocal nolinebreak
   272	setlocal nolisp
   273	setlocal lispoptions=
   274	setlocal lispwords=
   275	setlocal nolist
   276	setlocal listchars=
   277	setlocal makeencoding=
   278	setlocal makeprg=
   279	setlocal matchpairs=(:),{:},[:]
   280	setlocal modeline
   281	setlocal nomodifiable
   282	setlocal nrformats=bin,hex
   283	setlocal nonumber
   284	setlocal numberwidth=4
   285	setlocal omnifunc=
   286	setlocal path=
   287	setlocal nopreserveindent
   288	setlocal nopreviewwindow
   289	setlocal quoteescape=\\
   290	setlocal noreadonly
   291	setlocal norelativenumber
   292	setlocal norightleft
   293	setlocal rightleftcmd=search
   294	setlocal scrollback=10000
   295	setlocal noscrollbind
   296	setlocal scrolloff=-1
   297	setlocal shiftwidth=6
   298	setlocal showbreak=
   299	setlocal sidescrolloff=-1
   300	setlocal signcolumn=yes
   301	setlocal smartindent
   302	setlocal softtabstop=0
   303	setlocal nospell
   304	setlocal spellcapcheck=[.?!]\\_[\\])'\"\	\ ]\\+
   305	setlocal spellfile=
   306	setlocal spelllang=en
   307	setlocal spelloptions=
   308	setlocal statuscolumn=
   309	setlocal statusline=%#lualine_c_inactive#%=
   310	setlocal suffixesadd=
   311	setlocal noswapfile
   312	setlocal synmaxcol=3000
   313	if &syntax != ''
   314	setlocal syntax=
   315	endif
   316	setlocal tagfunc=
   317	setlocal tabstop=6
   318	setlocal tagcase=
   319	setlocal tags=
   320	setlocal textwidth=0
   321	setlocal thesaurus=
   322	setlocal thesaurusfunc=
   323	setlocal undofile
   324	setlocal undolevels=-1
   325	setlocal varsofttabstop=
   326	setlocal vartabstop=
   327	setlocal virtualedit=
   328	setlocal winbar=
   329	setlocal winblend=0
   330	setlocal winhighlight=
   331	setlocal nowinfixheight
   332	setlocal nowinfixwidth
   333	setlocal nowrap
   334	setlocal wrapmargin=0
   335	let s:l = 10 - ((9 * winheight(0) + 33) / 66)
   336	if s:l < 1 | let s:l = 1 | endif
   337	keepjumps exe s:l
   338	normal! zt
   339	keepjumps 10
   340	normal! 0
   341	wincmd w
   342	exe 'vert 1resize ' . ((&columns * 277 + 214) / 429)
   343	exe 'vert 2resize ' . ((&columns * 151 + 214) / 429)
   344	tabnext 1
   345	if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
   346	  silent exe 'bwipe ' . s:wipebuf
   347	endif
   348	unlet! s:wipebuf
   349	set winheight=1 winwidth=20
   350	let &shortmess = s:shortmess_save
   351	let &winminheight = s:save_winminheight
   352	let &winminwidth = s:save_winminwidth
   353	let s:sx = expand("<sfile>:p:r")."x.vim"
   354	if filereadable(s:sx)
   355	  exe "source " . fnameescape(s:sx)
   356	endif
   357	let &g:so = s:so_save | let &g:siso = s:siso_save
   358	set hlsearch
   359	nohlsearch
   360	doautoall SessionLoadPost
   361	unlet SessionLoad
   362	" vim: set ft=vim :

2

Building the lastest version of neovim fails on my distro so I don't think I can sorry.

❯ doas nixos-rebuild switch --flake '.#eleum' 
warning: Git tree '/persistent/home/user/.local/bin/flake' is dirty
building the system configuration...
warning: Git tree '/persistent/home/user/.local/bin/flake' is dirty
error: builder for '/nix/store/q5s3fyw87928aa8vglxij7vglwv3yhpb-neovim-0.10.2.drv' failed with exit code 1;
       last 8 log lines:
       > structuredAttrs is enabled
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > substituteStream() in derivation neovim-0.10.2: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. (file '/nix/store/g1amk
pvvjnc3fip51c5rl0ax5m1gmf56-neovim-0.10.2/share/applications/nvim.desktop')
       > /nix/store/550qbd6mwglsfl1kpbgdaqxjvq5y3pw6-make-shell-wrapper-hook/nix-support/setup-hook: line 116: /nix/store/nn79qqwa7rcjxal9m3w62nzlh9a
hlrz5-neovim-0.10.2/bin/nvim-python3: Permission denied
       For full logs, run 'nix log /nix/store/q5s3fyw87928aa8vglxij7vglwv3yhpb-neovim-0.10.2.drv'.
error: 1 dependencies of derivation '/nix/store/yzhligwagfn80cwhcc8nb64hnwvbkpyz-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gqmf2w8akb7fp3iv1hia2jr5xxcama06-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4s5n30ggh2bqmjwnfmbsrjld07jsj9f2-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pmx3krcj8xgsiwqyj7iyxiizkfh92j3l-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cfch6d04244amp1kk2288x24cf14af72-nixos-system-eleum-24.05.20241104.d063c1d.drv' failed to build

3

Yes when I use AutoSession search with fzf-lua
If I restore by opening nvim . in the ~/.local/bin/flake I don't get the error.

SessionSearch Doesn't work:

Error executing Lua callback: ...are/nvim/lazy/auto-session/lua/auto-session/autocmds.lua:60: attempt to index field 'args' (a nil value)                                                                                                                                                                                                                                                                                                   
stack traceback:
        ...are/nvim/lazy/auto-session/lua/auto-session/autocmds.lua:60: in function 'handle_autosession_command'
        ...are/nvim/lazy/auto-session/lua/auto-session/autocmds.lua:261: in function <...are/nvim/lazy/auto-session/lua/auto-session/autocmds.lua:254>

4

I use these keymaps but I don't have anything that would enter terminal mode on startup.

vim.keymap.set('n', '<c-t>', ':vs |:terminal<cr>')
vim.keymap.set( 't', '<esc>', '<c-\\><c-n>')

5

See 3

6

No, probably because the problem only happens when I use AutoSession search

cameronr added a commit to cameronr/auto-session that referenced this issue Nov 11, 2024
@cameronr
Copy link
Collaborator

cameronr commented Nov 11, 2024

That's very helpful!

3. Is a bug with the fallback if Telescope is not being used. Great find; I'll get that fixed.

6. This was the key that helped me reproduce and figure out how to fix the problem. It looks like there's some issue loading the session with a terminal from the Fzf ui. One interesting data point is that Fzf ui windows also seem to be in terminal mode:

Screenshot 2024-11-11 at 10 29 38

I can't tell if the error is talking about the Fzf window or the terminal window from the session. It only happens when using Fzf for the picker and the session being loaded has a terminal window in it. One possible explanation is that some state is trying to be restored for the "terminal" window and it's getting confused with the Fzf picker still being up.

The fix/work around is to just defer loading the session slightly so the picker is dismissed when the session loading happens. I'll get a PR up shortly.

If you want to test it, you can temporary change the top of your auto-session config to:

  -- 'rmagatti/auto-session',
  'cameronr/auto-session',

After changing the config, you'll have to open Lazy (or whatever plugin manager you use) and update the plugin to actually pull it down (and restart nvim just to be sure).

@leg7
Copy link
Author

leg7 commented Nov 12, 2024

Yeah that fixed it! 🥳

Thank you so much for your patience and help. You also fixed the Oil dir conflict bug I had too!

@leg7 leg7 closed this as completed Nov 12, 2024
cameronr added a commit that referenced this issue Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants