How to move to function/class name instead of keyword #753
              
                
                  
                  
                    Answered
                  
                  by
                    kiyoon
                  
              
          
                  
                    
                      rbhanot4739
                    
                  
                
                  asked this question in
                Q&A
              
            -
| 
         Hi there, I have the config textobjects = {
      move = {
        enable = true,
        set_jumps = true, -- whether to set jumps in the jumplist
        goto_next_start = {
          ["]f"] = "@function.outer",
          ["]c"] = "@class.outer",
        },
        goto_next_end = {
          ["]F"] = "@function.outer",
          ["]C"] = "@class.outer",
        },
        goto_previous_start = {
          ["[f"] = "@function.outer",
          ["[c"] = "@class.outer",
        },
        goto_previous_end = {
          ["[F"] = "@function.outer",
          ["[C"] = "@class.outer",
        },
      },
    }With this config when i press   | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            kiyoon
          
      
      
        Apr 17, 2025 
      
    
    Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
      Answer selected by
        rbhanot4739
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
:InspectTreein a python file.oin the tree to open a query editor@function.name~/.config/nvim/after/queries/python/textobjects.scmThis is your custom query.
Note
If you name it to
@function.name, it will prefer to select the range within@function.outer. So even inside a function body, if you want to change the function name, you can do it and it will look backwards to find the name.If you don't like this behaviour, name it to
@function_nameor something else.