Comments (20)
@jedi04 Wow, thanks for the demo, awesome. And +1 for using kitty.
Can you give the quickfix branch another try?
from tabout.nvim.
Demo
from tabout.nvim.
This is exactly the issue I was facing in #4 (comment).
I've tested the quickfix branch and it looks like the problem does not appear now. Thanks for the fix ❤️ I don't have any smart tab feature enabled, so I am using the plugin with completion = false
from tabout.nvim.
That are great news, thanks to both of you for testing. Great work 🥇
Let me know if something else is not working..which is hopefully not the case xD
from tabout.nvim.
@jedi04 Wow, thanks for the demo, awesome. And +1 for using kitty.
Can you give the quickfix branch another try?
I tried quickfix branch. But there seems some glitch. When i set my tabout key as "<C-o>" it just shifts content to right. But when I set my key to <Tab> and use <C-o> it seems to work but it goes back to normal mode and does not stay in insert mode.
Please see below video.
2021-07-27.13-44-48.mp4
from tabout.nvim.
Hi @jedi04
thanks for your feedback 👍
Can you try completion = false
?
from tabout.nvim.
Hi @jedi04
thanks for your feedback
Can you try
completion = false
?
Still getting error
Config
require('tabout').setup {
tabkey = '<c-o>', -- key to trigger tabout
act_as_tab = true, -- shift content if tab out is not possible
completion = false,
tabouts = {
{open = "'", close = "'"},
{open = '"', close = '"'},
{open = '`', close = '`'},
{open = '(', close = ')'},
{open = '[', close = ']'},
{open = '{', close = '}'}
},
ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]]
exclude = {} -- tabout will ignore these filetypes
}
from tabout.nvim.
It could have been easy...
Could you test this quickfix branch
I try to find a solution, thanks for reporting
from tabout.nvim.
@jedi04 Classic developer: it works on my machine ;)
Can you set it to <c-o>
again and then check :imap <c-o>
if the binding is mapped to tabout or overwritten?
If it is not ovewritten, can you create a new issue please?
from tabout.nvim.
@jedi04 Classic developer: it works on my machine ;)
Can you set it to
<c-o>
again and then check:imap <c-o>
if the binding is mapped to tabout or overwritten?If it is not ovewritten, can you create a new issue please?
Sorry. But it just inserts space and never jumps the parenthesis. Don't know why.
Thank you for helping.
from tabout.nvim.
Can you move the cursor to the char you want to tab out from and hit :call feedkeys("i\<c-o>")
and :call feedkeys("i\<c-o>", 'n')
. Is one of them working at all?
from tabout.nvim.
Sorry to comment on a closed issue but I'm still encountering this problem.
Checking the value of imap <tab>
which is what the tab key is set to I get
i <Tab> * !pumvisible() ? "<Cmd>Tabout<CR>" : <Cmd>lua require'snap'.register.run('1267', 'function: 0x010c119c00')<CR>
I have a snap
(finder plugin) mapping that is <leader>fd
but really not sure why that would interact with this plugin unless it was accidentally trying to bind to tabout or my tab mapping which is actually a lua function that I use for nvim-compe
.
When I try the feedkeys you mention above it reproduces the error.
Another thing i've noted is this doesn't happen all the time, when I load nvim up it seems to be fine so not sure if it has to do with reloading modules or what triggers it exactly. Although I'm not explicitly reloading any modules.
from tabout.nvim.
@akinsho Wow, a great honor to have you here. I looked at your plugins to unterstand how lua plugins work :) I hope to find time soon to switch to bufferline...so stop finding issues xD
Your issue is a different one though.
Tabout will bind to the tab key by default. Exception: completion is set to true and something else is bound to tab already. Then, if the completion menu is open, the original function is triggered, otherwise tabout does its work.
Following that logic, I would say that when tabout initializes the tab key is already bound to that snap function. Maybe the plugin does it internally, so maybe an unmap before tabout loads does the trick?
I tried with completion-nvim and run it with compe and smarttab function, so that works. But since it does not map to your smarttab function, I would also look into some load order issue.
What happens, if you disable the snap Plugin?
Sorry for missing highlights, writing from my phone xD
from tabout.nvim.
@abecodes thanks for the kind words 😄 👍🏿. Hope there wasn't too much cruft in there, some of those need some tidying 😅.
Re. this bug, I don't actually map snap to <tab>
at all, only my completion stuff. Snap also doesn't actually do any mapping by default.
I'm not sure if it is caused by snap though because before tabout this never happened i.e. snap mappings getting called or run on tab and also some other reports here show similar output, e.g. checking the mapping shows <80>fd
, the 80 being the code for some special character and fd
which is similar to the mapping I have registered for snap i.e. <leader>fd
.
from tabout.nvim.
@akinsho No worries, it helped me from 0 lua to write a plugin, so great job 👍
<80><fd>
is the escape for <cmd>
and the later ^M
is for <CR>
.
I skimmed the snap code real quick and saw a mapping using (tab)[https://github.com/camspiers/snap/blob/1fbd674dc53401fd643a2bb8bf07dd3e7125d430/fnl/snap/view/input.fnl#L23]. The register.run('1267', 'function: 0x010c119c00')
also comes from there.Not sure if it is used, I have to look more deeply for that xD
But if you disable it for a run and just use tabout
and compe
and check the mapping, it should look like this:
Can you verify that?
Also, I am not sure why I have <CMD>
and you have <80><fd>
, are you on the latest version?
from tabout.nvim.
@abecodes I've been digging around trying to figure out what is going on and I've finally figured out the bug. At least in my case.
So this plugin works (when handling completion mappings) by checking the value of the a completion mapping using vim.fn.maparg
. The issue I'm seeing is being caused only when I trigger something like snap
or telescope
before tabout is normally loaded which happens after compe is loaded. I lazy load compe
so it doesn't load till insert enter.
The reason this bug (again in my case) is happening is because if I start neovim and then startup snap or telescope, both those plugins have mappings for <tab>
which I believe are buffer-local
but I don't think maparg
recognises if a mapping is buffer local or not. So since going into snap lazy loads compe since it's in insert mode, it also triggers tabout
. This is the point where tabout checks the mappings and it sees snap or telescopes mapping in that buffer instead of my own global mapping.
I believe the way to fix this is, that maparg
takes a fourth optional argument which is dict
which if set to true will return metadata about the mapping including if it is a buffer mapping. Presumably you can then skip any buffer local mappings to the tab key.
When {dict} is there and it is |TRUE| return a dictionary
containing all the information of the mapping with the
following items:
"lhs" The {lhs} of the mapping.
"rhs" The {rhs} of the mapping as typed.
"silent" 1 for a |:map-silent| mapping, else 0.
"noremap" 1 if the {rhs} of the mapping is not remappable.
"script" 1 if mapping was defined with <script>.
"expr" 1 for an expression mapping (|:map-|).
"buffer" 1 for a buffer local mapping (|:map-local|).
from tabout.nvim.
@akinsho awesome find 🥇
Would you mind trying this branch and check if the theory works?
from tabout.nvim.
@abecodes should we move discussion to a PR? Anyway, I tried out the branch, and it stops the buffer local mapping from being used, but it just maps tab to <cmd>Tabout<CR>
alone which means that completion is broken. I just tried using
vim.tbl_map(function(item)
if item.lhs:match("<Tab>") then
P(item) <-- this is the target, maybe?
end
end,
vim.api.nvim_get_keymap('i')
)
I think the global i
mapping needs to be grabbed instead of the buffer one but on that branch it seems to find nothing, maybe the api function will surface it correctly.
from tabout.nvim.
@akinsho I created a PR but couldn't link you. But you can start discussing there.
FYI: I installed snap and get the empty tabout mapping you just mentioned on my master branch, but with the feature branch snap, compe and tabout are working just fine...this confuses me, heavy brain time xD
from tabout.nvim.
@abecodes it might be the sequence of lazy loading I use, are you testing with all plugins as start plugins or lazy loading them
from tabout.nvim.
Related Issues (20)
- Feature request: jump to next argument HOT 1
- How can I disable jumping from open bracket HOT 3
- [Bug] Unexpected behavior to tabout `[]` in the last line. HOT 5
- Why doesn't it tab out of square brackets? HOT 7
- Standalone setup file HOT 3
- `ignore_beginning` works differently between `(` and `"` HOT 5
- <Tab> doesn't move out of parens () HOT 2
- Can't get plugin to work HOT 7
- Feature request: cmdline support HOT 1
- How to prevent keybind from being overwritten? HOT 1
- Tabout stops working after save HOT 1
- Tabout doesn't work at all HOT 3
- Won't tab multiple times? HOT 1
- Luasnip? HOT 6
- Tubout inside Rust macro HOT 1
- Could you add a lazy.vim example for installation HOT 2
- Feature: support for non-treesitter enabled buffers HOT 2
- Feature request: support nvim-treesitter next version HOT 2
- Is the example mappings wrong with "replace_termcodes"? HOT 1
- Recent change disables TAB key in shell files (bash, zsh, etc.) ... (and possibly others?) HOT 4
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 tabout.nvim.