-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation in C++ file #209
Comments
Good question, and the answer is no. I have this noted down in my todo-file, that is: "provide a way to navigate with just specific pair". Something akin to the symbol/pair/tag prefix arguments, but it would probably be some macro to generate functions users would bind to a key. The best aproximation now is If you aren't afraid of a bit of a programing, you can define your own functions by using dynamic scoping in elisp: (defun my-curly-sp-down-sexp (&optional arg)
(interactive "P")
(let ((sp-pair-list '(("{" . "}"))))
(sp-down-sexp arg))) This pattern can be used to "augument" all the other similar functions to work just on curly brackets. You can also check |
The original The function you suggested I am not sure about how to implement your other suggestion on changing the let binding on |
…ing of navigation functions to specific pairs/objects
@Rchella I've added some functions to make these restrictions as easy as possible
Check the documentation strings, if something isn't clear, please let me know so I'll rewrite the docs better. |
I tried to implement some navigation functions using the newly defined functions.
seem to work as expected. But
seem to work OK when adjacent to one of the {, but from inside a sexp the restriction to { does not seem to be observed. Perhaps I did not set them up correctly. |
What you mean "from inside a sexp"? Can you give an example? |
Referring back to this line in the example file I first posted
if the cursor is before K, then the first M-> (defined as indicated above) moves the cursor to the end of the word Kinetic and the next M-> places the cursor before the (. I would expect M-> to go to the following {. |
I see. You will need to compose it with "object restrictor", because (define-key c++-mode-map (kbd "M->") (sp-restrict-to-object-interactive
'sp-prefix-pair-object
(sp-restrict-to-pairs-interactive "{" 'sp-forward-sexp))) I treat them in a special way because it allows greater flexibility. |
I've written some documentation here: https://github.com/Fuco1/smartparens/wiki/Working-with-expressions#wiki-decorators |
OK, this works fine now. Thanks for the quick response and the detailed documentation of how to use the new functions. |
Is it possible to navigate conveniently forward (and backward) between successive curly braces
{
. The functions sp- forward-sexp and sp-next-sexp don't seem suitable. For example, if the cursor is before the first opening brace it jumps to after the last closing brace.The text was updated successfully, but these errors were encountered: