Comments (5)
Probably it will not work for buffer number 0. Can you try to get the current buffer number with nvim_get_current_buf or you use nil for buf. When the command works then the function should work too
from nvim-treesitter-textobjects.
Can you share your config? This works for me
require'nvim-treesitter.configs'.setup {
ensure_installed = "all",
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ib"] = "@block.inner",
["ab"] = "@block.outer",
},
},
},
}
Also, you can check :map if
from nvim-treesitter-textobjects.
Can you share your config? This works for me
require'nvim-treesitter.configs'.setup { ensure_installed = "all", textobjects = { select = { enable = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", ["ib"] = "@block.inner", ["ab"] = "@block.outer", }, }, }, }Also, you can check
:map if
With this config, :map if says "No mapping found"
but Highlight, fold, indent and refactor works.
Here my sample config:
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
highlight= {
enable = true,
},
indent = {
enable = true,
},
refactor = {
highlight_definitions = { enable = true },
navigation = {
enable = true,
keymaps = {
goto_definiton = "gnd",
list_definitions = "gnD",
list_definitions_toc = "gO",
goto_next_usage = "<a-*>",
goto_previous_usage = "<a-#>",
},
},
},
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ib"] = "@block.inner",
["ab"] = "@block.outer",
},
},
},
}
EOF
Edit:
It works.
:map shows only in supported filetype.
Also, after change keymaps, restart nvim and it'll works.
from nvim-treesitter-textobjects.
Can you share your config? This works for me
require'nvim-treesitter.configs'.setup { ensure_installed = "all", textobjects = { select = { enable = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", ["ib"] = "@block.inner", ["ab"] = "@block.outer", }, }, }, }Also, you can check
:map if
With this config, :map if says "No mapping found"
but Highlight, fold, indent and refactor works.Here my sample config:
lua <<EOF require'nvim-treesitter.configs'.setup { ensure_installed = "maintained", highlight= { enable = true, }, indent = { enable = true, }, refactor = { highlight_definitions = { enable = true }, navigation = { enable = true, keymaps = { goto_definiton = "gnd", list_definitions = "gnD", list_definitions_toc = "gO", goto_next_usage = "<a-*>", goto_previous_usage = "<a-#>", }, }, }, textobjects = { select = { enable = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", ["ib"] = "@block.inner", ["ab"] = "@block.outer", }, }, }, } EOFEdit:
It works.
:map shows only in supported filetype.
Also, after change keymaps, restart nvim and it'll works.
Probably I 'm in your case. How do you change keymaps? My :map if
return no mapping found
. How do you remap
from nvim-treesitter-textobjects.
After remove duplicated line of code, my issue is solved.
from nvim-treesitter-textobjects.
Related Issues (20)
- example "scope" ]s mapping seemingly does nothing
- Add `#make-range-between!`
- Error when opening haskell buffer. HOT 2
- flatten() requires a list-like table HOT 17
- Specify if query selects last line or not
- [main] recommended setup for swap doesn't work HOT 10
- bug: slow textobject select queries for Rust HOT 1
- @comment.inner not working as expected HOT 2
- JS's generator function not recognized
- [C#] class.outer should support classes, structs, records, and enums
- Swap @function.outer doesn't work from within decorated functions in Python HOT 2
- Elixir: functions with guard clauses or no params aren't registered
- Python: augmented_assignments
- The updated R parser breaks the text object query HOT 1
- [main] moving between functions does not work HOT 3
- Bug reported by neovim when I open an R file HOT 2
- Solidity support request HOT 2
- VHDL: invalid node type "comment" HOT 1
- Mappings not working for custom filetypes HOT 1
- zig's `@function.inner` incorrectly includes curly braces HOT 1
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 nvim-treesitter-textobjects.