para configurar autocomplete sublimetext2 editing brackets

autocomplete - configurar - ¿Cómo evitar que Sublime Text 2 se trague los corchetes de cierre, las comillas y los paréntesis?



configurar brackets para php (3)

Sublime tiene este comportamiento que es realmente molesto a veces cuando tienes que escribir construcciones con muchos paréntesis. Cuando escribe ( agrega () y coloca el cursor en el medio, todo bien, si sin embargo va a escribir ) se tragará silenciosamente el corchete de cierre.

Esto es realmente molesto cuando escribes expresiones regulares largas porque los corchetes se desequilibran bastante rápido y esto me está volviendo loco. Entonces terminas con construcciones como (([az]) .

Entonces la pregunta es, ¿hay alguna forma de desactivar esto? Si escribo un corchete de cierre, quiero que se quede, no que me traguen.

Revisé las configuraciones Sublime, busqué en Google, pero a nadie parece importarle este comportamiento. ¿Lo estoy usando mal?

Actualizar

Es posible que desees consultar Sublime: salta también del atajo correspondiente .

Versión completa que le permite escribir con () pero no se tragará el símbolo de cierre si ha ingresado cualquier texto:

{ "keys": ["/""], "command": "insert", "args": {"characters": "/""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^/"", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^/"]$", "match_all": true } ] }, { "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^(]$", "match_all": true } ] }, { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "//($", "match_all": true } ] }, { "keys": ["''"], "command": "insert", "args": {"characters": "''"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^''", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "''$", "match_all": true } ] }, { "keys": ["]"],"command": "insert", "args": {"characters": "]"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//]", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[$", "match_all": true } ] }, { "keys": ["}"], "command": "insert", "args": {"characters": "}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//}", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "{$", "match_all": true } ] }


Al navegar por las preferencias del archivo keybindings ''bindings / bindings'', descubrí que si seleccionas texto y escribes alguno de estos ({[. Colocará los corchetes alrededor de tu texto.


Redefina el enlace de la tecla ) :

{ "keys": [")"], "command": "insert", "args": {"characters": ")"} }

Editar : Otra forma es activar / desactivar la configuración auto_match_enabled (cambiando así el comportamiento de emparejamiento automático), puede alternarla a voluntad usando un atajo de teclado:

{ "keys": ["alt+m"], "command": "toggle_setting", "args": {"setting": "auto_match_enabled"} }


agregue esto a su archivo de enlaces de usuario

{ "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true } ] }

anulará el enlace por teclado que, en lugar de insertar un corchete de cierre, simplemente mueve el cursor una posición hacia delante. así que esencialmente debería hacer exactamente lo que quieres.

si desea deshabilitar este comportamiento por completo, para todos los tipos de corchetes y comillas, aquí está la parte completa de las combinaciones de teclas del usuario:

{ "keys": ["/""], "command": "insert", "args": {"characters": "/""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^/"", "match_all": true } ] }, { "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true } ] }, { "keys": ["''"], "command": "insert", "args": {"characters": "''"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^''", "match_all": true } ] }, { "keys": ["]"],"command": "insert", "args": {"characters": "]"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//]", "match_all": true } ] }, { "keys": ["}"], "command": "insert", "args": {"characters": "}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//}", "match_all": true } ] }

EDITAR:

En caso de que quiera omitir el corchete de cierre si el cursor está justo después de un corchete de apertura e imprimirlo en todos los demás casos, puede dividir sus combinaciones de teclas para distinguir entre estas dos posibilidades:

{ "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^(]$", "match_all": true } ] }, { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^//)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "//($", "match_all": true } ] },

El primero inserta el charcater si el texto anterior no termina con un corchete de apertura. El segundo mueve el cursor una posición hacia adelante si termina con un soporte de apertura. Si está familiarizado con las expresiones regulares, puede hacer lo mismo para todos los demás tipos de corchetes y comillas.