Does anyone know if there's a way to make nano support auto-complete and auto-bracket closing?
3 Answers
As of at least Nano 2.9.8, autocompletion is supported.
Pressing ^] (C-]) will check for words beginning with the current prefix in the current buffer and grab the first one. Pressing ^] multiple times will cycle through the available matches. Regardless of how many times ^] is pressed consecutively, ^[u (M-u) will undo all of them as a unit.
- 473
- 1
- 4
- 12
I just downloaded and perused the source of Nano with some grepping. I can say with 95% confidence that Nano doesn't support auto-bracket or auto-complete.
Meta-] will jump to the matching bracket under the cursor though.
Sorry!
Autocompletion
If you are willing to spend some time trying setting things up, there is a modded nano version that works with autocompletion: https://github.com/orsonteodoro/nano-ycmd
However, your safest bet is probably micro
Nano built-int completion
As others have said, this is triggered by ^] (Ctrl+]), but it simply completes words using other words in the current buffer (which is still quite convenient)
Auto-brackets
You could potentially define custom keybindings to make Nano auto-close brackets or wrap text in brackets. Try to put these in your ~/.nanorc
bind M-( "(){backward}" main
bind M-) "{cut}({paste})" main
The first line binds the key Alt+( to insert opening and closing round brackets, moving the cursor inside them.
The second line binds the key Alt+) to place round brackets around currently highlighted text (essentially, it cuts text, insert parenthesis, paste text, close parenthesis). Note that without any text being highlighted, parentheses will be put around the whole line.
Love Nano <3
- 111