Sublime Forum

2 simple (small requests)

#1

I don’t know maybe there’s a setting for these things. But they’re two litle things that really bug me about ST

  • Can it be set that if no text is high-lighted then ctrl-c doesn’t copy? same with control-x?
    Sometimes I double-tap by mistake and wipe out the clipboard after doing a ctrl-x

  • if the only text selected is " or ’ then don’t wrap them if I type " or ‘. Just replace them. Otherwise the auto wrapping is awesome!
    A good deal of the time I have to manually go through a lot of code and change " to ’ (or vice-versa) or make them ". I’m used to the standard text-editor way of selecting text and when you type it replaces what was selected. So I’ll select the ’ and type " then I end up with "’"

0 Likes

#2

For first question: in your sublime-settings file, add this:

"copy_with_empty_selection": false

As for the second one… Well, you should be able to tweak the default keymap and make it work. See here

0 Likes

#3

Thanks for the pointer on where to go. I’ve added this to my user key-bindings. Everything seems to work the way I’d expect now.

// if selected text is \" and user type \" user only get one \"
    { "keys": "\""], "command": "insert_snippet", "args": {"contents": "\""}, "context":
        
            { "key": "text", "operator": "regex_contains", "operand": "\"", "match_all": true }
        ]
    },
// if selected text is \" and user type ' user only get one '
    { "keys": "'"], "command": "insert_snippet", "args": {"contents": "'"}, "context":
        
            { "key": "text", "operator": "regex_contains", "operand": "\"", "match_all": true }
        ]
    },
// if selected text is ' and user type \" user only get one \"
    { "keys": "\""], "command": "insert_snippet", "args": {"contents": "\""}, "context":
        
            { "key": "text", "operator": "regex_contains", "operand": "'", "match_all": true }
        ]
    },
// if selected text is ' and user type ' user only get one '
    { "keys": "'"], "command": "insert_snippet", "args": {"contents": "'"}, "context":
        
            { "key": "text", "operator": "regex_contains", "operand": "'", "match_all": true }
        ]
    }

Everyday I use ST I am getting more happy that I purchased it :smile: and now I want to add more customizing to it

question: I’ve looked at all the key binding options and can’t seem to find anything like I’m needing, but is there context operand that will find the first regex match after the caret? but not necessarily in a selection? I’d like to be able to select (or put the caret beside) a " or a ’ and if I type \ it will turn it into a " or a ’ (depending on the the character next to the caret is) then find the next instance " or ’ and change that to a " or a ’

If thats even possible?

0 Likes