Home Download Buy Blog Forum Support

2 simple (small requests)

2 simple (small requests)

Postby rob49152 on Thu Jun 27, 2013 6:06 am

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 "'"
rob49152
 
Posts: 14
Joined: Sat Jun 15, 2013 10:02 pm

Re: 2 simple (small requests)

Postby iamntz on Thu Jun 27, 2013 6:22 am

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

Code: Select all
"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
iamntz
 
Posts: 917
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: 2 simple (small requests)

Postby rob49152 on Thu Jun 27, 2013 10:04 pm

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.
Code: Select all
// 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 :) 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?
rob49152
 
Posts: 14
Joined: Sat Jun 15, 2013 10:02 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 8 guests