Comments (7)
Agreed! I'll look into this ASAP :)
EDIT: Not able to reproduce with my config, but I'll try your minimal config later today.
from flatten.nvim.
Awesome, glad I could help!
from flatten.nvim.
@willothy Maybe it can be solved by changing the config of flattrn.nvim. I actually don't consider it bug since there's no errors nor warning, just the behavior is a little strange.
from flatten.nvim.
@willothy Maybe it can be solved by changing the config of flattrn.nvim. I actually don't consider it bug since there's no errors nor warning, just the behavior is a little strange.
Yeah, likely can be resolved in the config but I'll still take a look. Might be worth adding the solution to the readme in case others experience this.
from flatten.nvim.
Not able to reproduce with my config
Mind sharing your config? Is it still the same as the config your shared in the READE? I tried to use that config but get errors when I save the gitrebase file, so I removed all the togglterm.toggle(0)
calls -- then the errors are gone but I get the strange behavior in the screen recording.
from flatten.nvim.
Not able to reproduce with my config
Mind sharing your config? Is it still the same as the config your shared in the READE? I tried to use that config but get errors when I save the gitrebase file, so I removed all the
togglterm.toggle(0)
calls -- then the errors are gone but I get the strange behavior in the screen recording.
My config is not the same anymore - here's the link.
I use a custom toggleterm terminal but hopefully it will still work? It may be related to the open
setting.
Note that I also have $VISUAL
set to nvim -b
for blocking.
Let me know if that helps!
from flatten.nvim.
@willothy Thanks for sharing your config.
After some small modification it works like a charm -- the terminal now automatically reopens itself after blocking and no more error is thrown. Not sure how it functions exactly but for future references the following is a config that Just Woks:
local ok, toggleterm = pcall(require, 'toggleterm')
if not ok then
print('flatten: toggleterm not found')
toggleterm = {
toggle = function(_) end,
}
end
require('flatten').setup({
window = {
open = 'alternate',
},
callbacks = {
should_block = function(argv)
for _, arg in ipairs(argv) do
if (arg:find('.git/rebase-merge', 1, true)) then
return true
end
end
return false
end,
post_open = function(bufnr, winnr, ft, is_blocking)
if is_blocking or ft == 'gitcommit' or ft == 'gitrebase' then
-- Hide the terminal while it's blocking
toggleterm.toggle(0)
else
-- If it's a normal file, just switch to its window
vim.api.nvim_set_current_win(winnr)
end
-- If the file is a git commit or git rebase, create one-shot autocmd to
-- delete its buffer on write
if ft == 'gitcommit' or ft == 'gitrebase' then
vim.api.nvim_create_autocmd('BufWritePost', {
buffer = bufnr,
once = true,
callback = function()
-- This is a bit of a hack, but if you run bufdelete
-- immediately the shell can occasionally freeze
vim.defer_fn(function()
vim.api.nvim_buf_delete(bufnr, {})
end, 50)
end,
})
end
end,
block_end = function()
-- After blocking ends (for a git commit, etc), reopen the terminal
vim.defer_fn(function()
toggleterm.toggle(0)
end, 50)
end,
},
})
from flatten.nvim.
Related Issues (20)
- Should avoid opening files in windows containing special buffers (`&buftype != ''`) HOT 1
- Errors out when calling `setup` without any parameters HOT 1
- post_open shall provide bufnr and winnr for newly opened file HOT 4
- Customizable host address detection HOT 3
- 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
- Combining with `gf` HOT 3
- Breaking changes on main (flatten.nvim 1.0.0)
- How to avoid swap file warning E325? HOT 1
- Support quickfix mode HOT 6
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.