Issue getting tabout working #42
-
Thank you for creating this package. I've tried to follow your installation instructions carefully in my dotfiles. I'm having the same issue as here, i.e., tabout only indents inside matching pairs of parenthesis/brackets/braces, but does not tab out of them. First I added the following lines to my general packer installation: -- Lua
use({
'abecodes/tabout.nvim',
wants = { 'nvim-treesitter' }, -- or require if not used so far
after = { 'nvim-cmp' }, -- if a completion plugin is using tabs load it before
}) Next I did the setup as follows in a separate file named -- import tabout plugin safely
local tabout_status, tabout = pcall(require, 'tabout')
if not tabout_status then
return
end
tabout.setup({
tabkey = '<Tab>', -- key to trigger tabout, set to an empty string to disable
backwards_tabkey = '<S-Tab>', -- key to trigger backwards tabout, set to an empty string to disable
act_as_tab = true, -- shift content if tab out is not possible
act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
default_tab = '<C-t>', -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
default_shift_tab = '<C-d>', -- reverse shift default action,
enable_backwards = true, -- well ...
completion = true, -- if the tabkey is used in a completion pum
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
}) Lastly, I made sure that this file was called in my init.lua require('shamindras.plugins.treesitter')
require('shamindras.plugins.tabout')
require('shamindras.plugins.gitsigns') I made sure that I did a Problem When I restart nvim, it does so without any issue, but What am I doing wrong, and how should I proceed to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @shamindras Thanks for the detailed explanation 😃 Two scenarios are coming to mind for this kind of problem:
Lets start with the first one. If you enter command mode and type If you see this, tabout is running fine and smth is off with your syntax. Tabout.nvim uses treesitter to determine in which node you are and where to jump to. If that does not happen, treesitter can not translate your syntax into a correct node. This may be due to an issue on treesitter's side or you are using invalid syntax (depending on your language, this may also happen in comment strings). But not all is lost, you can try it with the branch
Let me know if that fixes your issue. If not, please provide a code sample 😄 |
Beta Was this translation helpful? Give feedback.
Hi @shamindras
Thanks for the detailed explanation 😃
Two scenarios are coming to mind for this kind of problem:
Lets start with the first one. If you enter command mode and type
:tab
and then press the key, you should see smth similar to this:If you see this, tabout is running fine and smth is off with your syntax.
Tabout.nvim uses treesitter to determine in which node you are and where to jump to. If that does not happen, treesitter can not translate your syntax into a correct node. This may be due to an issue on treesitter's side or you are using invalid syntax (depending on your language, this may also happen in comment strings).
But n…