Is there any shortcut to close the last opened bracket for notepad++?

i.e., if I write:

if (this.variable == _variable 

and then hit the shortcut keys, it would add a ")" because that's the last opened bracket.

or if i write:

if (this.variable == _variable) { getJson({ some:data },function () { alert("something"); 

then hit the shortcut keys three times, it would know to add a "}" to close the function, then a ")" to close the getJson, then a "}" to close the IF statement.

(maybe the latter one doesn't make as much sense because one would expect a semicolon after the getJson is closed, but I guess my point is clear)

My question comes up because I am frustrated with the functionality of a closing bracket coming automatically after I open a bracket. In the end, I have to write that bracket myself anyways because I want to continue my code that comes after the bracket that was automatically added.

  • Welcome to Super User! Questions asking for software or product recommendations are off-topic for this site because they tend to become quickly outdated or attract opinion-based answers. Please either edit your question to make it on-topic or if you intend to make a software/product request, delete your question here and ask it instead on Software Recommendations. – I say Reinstate Monica Apr 23 '17 at 19:23
  • Notepad++ supports this natively. When you write a ( it will automatically write a ) after it too. Same for { and }. If you type the ) yourself, it will detect if that is the next character and prevent you from getting a )). Can be enabled/disabled from the settings. – LPChip Apr 23 '17 at 19:44
  • @LPChip, from the last paragraph, it looks like the OP is aware of the feature, but finds that the way it works interferes with the way he likes to write. Instead of jumping inside initially-produced brackets, he'd rather just dump brain to keyboard and then use a shortcut to close brackets when he's ready. – fixer1234 Apr 23 '17 at 20:01
  • @fixer1234 oh, I agree. Initially I didn't like that auto-complete either and turned it off, then I missed it, turned it on, and now I love it. He may have forgotten about it. I find it an even more lazy way to write code. – LPChip Apr 23 '17 at 20:03

I suggest you take a look at the xbrackets lite plugin. It takes care of bracket/brace closing perfectly :)

  • This is a veeeerrry old plugin. Have you tested if it still works, especially since NotePad++ natively supports this feature now from the settings? – LPChip Apr 23 '17 at 19:45
  • 1
    I hadn't realised that! I've been using it so long haha, I'll have to check the base functionality! – mayersdesign Apr 23 '17 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.