reddit / emacs

Sh +lsp and bash language server

kourie · 2022-07-30 21:38
Ok, in a script i want to encapsulate, surround an EXISTING variable with double quotes. $var to "$var" Not yet confortable with included help. thanks
thetemp_ · 2022-07-30 23:30
Get comfortable with the included help. It makes accessing information very easy. Also, use the info manuals, which you can also access in a web browser. Do `C-h f electric-pair-mode RET`. Tldr: with the mode enabled, when you select $var (which you can do by placing point in front of it and pressing C-M-SPC), inserting a double quote will surround the selection with double quotes.
kourie · 2022-07-30 23:45
Excellent and yes working on that!
kourie · 2022-08-03 18:08
Found a flexible way of creating a function (macro) which will allow me to adapt other requirements more easily. ;;You can use keyboard macros for that task. The link pretty much explains how to do it, for completeness here's what to do: Hit `C-x (` to start recording a keyboard macro. Do what the command is supposed to do (i.e. execute commands, hit keys, ...) Hit `C-x )` to stop recording the keyboard macro. Execute `M-x name-last-kbd-macro` to name the last-defined keyboard macro (i.e. the one you just defined). Execute `M-x insert-kbd-macro` to insert the code of the last defined macro at point, copy it into your init file. Put `(global-set-key (kbd "M-n") 'my-macro)` into your init file (assuming you named the macro my-macro). Profit! ​ `(fset 'duo (kmacro-lambda-form [?\C-v ?e ?c ?\" escape right ?P escape] 0 "%d"))`