A simple remember open files function for neovim + neo-tree.
<p>I always liked that vscode remembered open files, however for some reason in (neo)vim that seems too complicated.</p>
<p>Session managers do a lot more than just remembering opened files and often broke my neo-tree setup.</p>
<p>So I ended up writing a little lua function in <code>init.lua</code> that only works if you open neovim by passing a directory to it.</p>
<p>ex: <code>nvim ~/code/somethingCool</code></p>
<p>Basically it first sets the cwd to the passed directory, then adds an autocommand to save the list of open files on exit.</p>
<p>The generated file is saved in <code>{dir}/.git/lastsession.lua</code> which has commands to reopen the files using <a href="https://github.com/nvim-neo-tree/neo-tree.nvim" rel="noopener ugc nofollow" target="_blank">neo-tree</a>.</p>
<p><a href="https://medium.com/@oneofone/a-simple-remember-open-files-function-for-neovim-neo-tree-45b83c89da71">Website</a></p>