Comments (18)
I'm using this key binding which opens nnn in the current buffer's directory, not a replacement for remembering path but may fit your use case:
nnoremap <C-n> :NnnPicker %<CR>
from nnn.vim.
See jarun/nnn#1023.
However, the drawback of this approach is that you cannot load a session and then persist to @ session later on
Persistent session option is global. So any session which is active at quit will be persisted. I don;t want more complexity in that. The "auto session" (@) will be used to restore the last working state when a session is loaded at runtime temporarily. Also "auto session" will be used (as it is now) to persist the session if no other session is active at program quit.
from nnn.vim.
it will be wonderful if there is a nnn buffer and it keeps everything I have entered
from nnn.vim.
If it's possible, it has to be done in the plugin. nnn itself doesn't track any user details.
from nnn.vim.
@jarun thanks for you replying, I got your meaning
from nnn.vim.
@khuedoan ya. Sometime when i need to use nnn, i have call command with some args my self too 😄
from nnn.vim.
nnn
now supports sessions. See options -s
/-S
. Option -s
is probably better suited to have a specific session for the plugin.
@mcchrish @mizlan it this doable now, perhaps with an nnn.vim
flag/setting that says enable session management?
from nnn.vim.
Sure! I'll work on this. Also, this seems like an approach we can use to simulate a classic directory viewer. That would entail reopening an nnn
process with the session every time a file is chosen. We can probably do better with some change in nnn
later but that's a workaround for now I guess.
from nnn.vim.
https://github.com/mcchrish/nnn.vim/blob/master/doc/nnn.txt#L149-L159 with this option, it should be possible to make use of sessions right away. They can pass any file they want for example:
" create a session that is tied to the current vim session
let g:nnn#command = 'nnn -s ' . tempname()
Another possibility is to tweak nnn#pick()
to accept a command option, example:
call nnn#pick('~/some-files', { 'command': 'nnn -s '. tempname() })
Which is probably the most flexible direction.
from nnn.vim.
Also, this seems like an approach we can use to simulate a classic directory viewer. That would entail reopening an nnn process with the session every time a file is chosen.
Seems like a possible direction if stdout option doesn't work out #43.
from nnn.vim.
There are some annoying things with the way sessions currently work in upstream nnn
. Namely, you cannot load a non-existent session name and have it created with nnn -s <new_session_name>
. I am currently fixing this (was this behavior intentional?) and will push to nnn
soon.
Please let me know if you do not happen to experience this issue. To be specific, you will see an open failed
message in the nnn
echo area for 1 second after opening nnn
with a nonexistent session.
from nnn.vim.
Actually, I am understanding sessions incorrectly. I think it would be less suitable to call them "sessions" since they are more like "snapshots" that can be arbitrarily loaded and saved. What we would need is an option for named sessions to be saved on quit. All that needs to be done is to take the existing code for auto-saving the @
default session and modify it for named sessions. However, we'd also have to either:
- introduce a new program option to specify whether sessions should be "replaced" on quit.
- make a breaking change that changes the meaning of sessions from "snapshots" to more like real "sessions".
- (this is the one I think makes the most sense) modify the behavior of
-S
so that if both-s <name>
and-S
are provided, then it will persist (auto-save on quit) to the named session. If only-s <name>
is provided, then load session initially but do not save on quit. If only-S
is provided then use the default@
session. Edit: However, the drawback of this approach is that you cannot load a session and then persist to@
session later on...
I am currently working on making the third choice here work.
from nnn.vim.
https://github.com/mcchrish/nnn.vim/blob/master/doc/nnn.txt#L149-L159 with this option, it should be possible to make use of sessions right away. They can pass any file they want for example:
" create a session that is tied to the current vim session let g:nnn#command = 'nnn -s ' . tempname()
Did you happen to test this? Because to my knowledge this isn't actually possible yet, read my prior comments for details.
from nnn.vim.
I have not. I assumed the behavior of nnn
that it will automatically save the session on quit (or sync the session to the file every navigation). My bad.
from nnn.vim.
However, the drawback of this approach is that you cannot load a session and then persist to
@
session later on...
This isn't really an issue to be concerned with as this isn't the default behavior anyway. Take a look at jarun/nnn#1023 (comment) for more details.
from nnn.vim.
May I assign myself this task? I think the interface should be kept simple. Maybe have a g:nnn#session
variable which can have values 'none'
(default), 'global'
(the @
session which allows syncing in and out of vim), or 'vim'
(a session named "vim" that only syncs within vim).
from nnn.vim.
Sure!
from nnn.vim.
Fixed at #96.
from nnn.vim.
Related Issues (20)
- It takes forever to open, is it normal? HOT 10
- Action setting not working on vim 8.1 HOT 4
- Not saving context state after opening a file HOT 4
- Typo in README HOT 1
- nnn changes the vim PWD to the directory which it quitted HOT 8
- Problem open file with l HOT 1
- `:NnnExplorer` bugs and additional features HOT 33
- Error when using fzopen after changing directory HOT 14
- Explorer window does not close properly when multi tabs have their own opened explorer window HOT 1
- Picker picks the wrong file if a directory with similar name exists HOT 1
- clipboard does not work HOT 3
- ftplugin sets a global option (`noshowmode`)
- When NnnExplorer is invoked via <Leader> key combination the first 10 entries are already tagged ???? HOT 2
- Unexpected behavior when "NnnExplorer" is invoked via a <leader>key combination. HOT 3
- Error when mapping action to <backspace> HOT 3
- Error when exiting nnn picker without choosing a file. HOT 3
- Undefined variable: g:nnn#action in ftplugin/nnn.vim
- Unknown function: term_getstatus in ftplugin/nnn.vim HOT 1
- Colors in nnn.vim don't seem to work always HOT 1
- local sessions not working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nnn.vim.