Comments (3)
Hi, glad you like the plugin!
I'm not entirely sure but this should work natively in nvim... it seems to work for me (unrelated to flatten).
If it doesn't however and what I'm experiencing is from another plugin, I think this is outside the scope of what flatten is intended to do. Using gf
to open a file in the nvim terminal doesn't open a nested instance, so this would be adding a completely separate feature to the plugin.
from flatten.nvim.
Using gf to open a file in the nvim terminal doesn't open a nested instance, so this would be adding a completely separate feature to the plugin.
@willothy supporting gf
in a terminal buffer would be useful for me so that I can have the benefit of the window: { open = "alternate" }
option for both nvim ...
as well as gf
/gF
when used in a terminal buffer. The consistency would nice. I can't seem to find another plugin that does this. I can see however that this feature is a bit orthogonal to flatten's purpose. Any pointers?
Edit: I was able to get something working using an internal API from the plugin, but I don't know how robust this will be!
vim.keymap.set("n", "gf", function()
if vim.bo.buftype == "terminal" then
-- if in a terminal, use flatten to open the file
require("flatten.core").edit_files({
files = { vim.fn.expand("<cfile>") },
stdin = {},
argv = {},
guest_cwd = vim.fn.getcwd(),
force_blocking = false,
response_pipe = "",
})
else
-- otherwise use original gf
vim.cmd("normal! gf")
end
end, { desc = "Open file" })
from flatten.nvim.
Using gf to open a file in the nvim terminal doesn't open a nested instance, so this would be adding a completely separate feature to the plugin.
@willothy supporting
gf
in a terminal buffer would be useful for me so that I can have the benefit of thewindow: { open = "alternate" }
option for bothnvim ...
as well asgf
/gF
when used in a terminal buffer. The consistency would nice. I can't seem to find another plugin that does this. I can see however that this feature is a bit orthogonal to flatten's purpose. Any pointers?
Totally, I would quite like that feature too tbh. I will have to look into gf to see if I could use autocmds to interrupt the process. If I can come up with a consistent solution that works without changing default mappings I will maybe include it as an opt-in feature or at least a config snippet.
Overriding the mapping definitely will work for some configs, nice work! In the callback, could also use vim.fn.winnr("#")
to get the alternate window and just set its buffer to vim.fn.bufnr(vim.fn.expand("<cfile>"))
I think, since that's the only thing edit_files
is really doing here as far as I can tell :)
from flatten.nvim.
Related Issues (20)
- Customizable host address detection HOT 3
- Strange behavior when using git rebase in toggleterm with flatten.nvim HOT 7
- Bug with plugins that automatically change cwd
- Provide options for when Wezterm/kitty windows should nest HOT 7
- [Bug] File opened in another nvim instance HOT 7
- Commits on August 10 Don't respect the window --> open setting HOT 1
- Use `v:parent` channel if/when merged
- When there is space in the filename the filename passed to neovim is escaped HOT 2
- Use vim.rpc* instead of vim.fn.rpc*
- Should `wezterm` and `kitty` integration be disabled by default?
- Todo: separate remote file and remote command logic
- Todo: Use libuv and async for pipes where possible
- Option to return to the terminal after closing a file HOT 19
- Breaking changes on main (flatten.nvim 1.0.0)
- How to avoid swap file warning E325? HOT 1
- Support quickfix mode HOT 6
- `nvim --cmd 'let g:flatten_wait=1' file1` does not work, neither does `-b` HOT 17
- Option to have wezterm only flatten if in the same pane HOT 1
- Doesn't seem to work when using tmux inside of the nested terminal HOT 9
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 flatten.nvim.