Re: Language-specific replacement for `formatter`
Anthony Sottile <[email protected]>
| Newsgroups | gmane.editors.nano.general |
|---|---|
| Message-ID | <CA+dzEB=qdQyTgU=yPqQq96SOYy7aGXrs0c-V08eaXLhZBOS8rQ@mail.gmail.com> |
today when I have a file open and I type ^T it runs the formatter or the linter (depending on the file type). If I understand correctly, I can't bind to ^T to restore formatter in a hacky way because it is already bound by linter. How would a simple bash script work? If I'm understanding correctly I'd have to reimplement the nanorc logic for detecting file types, which seems a pain when nano already does this for me! Anthony On Fri, Sep 28, 2018 at 9:44 AM Viechtbauer, Wolfgang (SP) <[email protected]> wrote: > > You can write a simple bash script that does language-specific things and that you bind to a single key. > > Not sure what you mean by 'bind to a name that already has another meaning'. If you mean that ^T is already bound to another function, then change the binding. > > Best, > Wolfgang > > -----Original Message----- > From: Anthony Sottile [mailto:[email protected]] > Sent: Wednesday, 26 September, 2018 22:40 > To: Viechtbauer, Wolfgang (SP) > Cc: [email protected]; [email protected] > Subject: Re: [Help-nano] Language-specific replacement for `formatter` > > On Wed, Sep 26, 2018 at 1:35 PM Viechtbauer, Wolfgang (SP) > <[email protected]> wrote: > > > > Maybe I am misunderstanding, but you can bind ^R^X... to a key. See: > > > > https://www.nano-editor.org/dist/v3/nano.html > > > > and search for "If you use such a formatting command regularly". > > > > Best, > > Wolfgang > > Right, but I can't do that _per language_, I'd need to have N key > bindings (and remember each of them separately) for the N languages I > have formatters for. Plus I can't bind to a name that already has > another meaning (I'd want to bind to ^T so I don't have to "oh is this > a linter or a formatter" each time). > > Anthony > > > -----Original Message----- > > From: Help-nano [mailto:help-nano-bounces+wolfgang.viechtbauer=maastrichtuniversity.nl@gnu.org] On Behalf Of Anthony Sottile > > Sent: Wednesday, 26 September, 2018 21:45 > > To: [email protected] > > Cc: [email protected] > > Subject: Re: [Help-nano] Language-specific replacement for `formatter` > > > > On Wed, Sep 26, 2018 at 12:37 PM Anthony Sottile <[email protected]> wrote: > > > > > > On Wed, Sep 26, 2018 at 11:31 AM Benno Schulenberg <[email protected]> wrote: > > > > > > > > > > > > Hello Anthony, > > > > > > > > Op 25-09-18 om 22:23 schreef Anthony Sottile: > > > > > Hi! I've noticed that `formatter` has been removed in nano 3.x, > > > > > however I've previously found it pretty useful for running things like > > > > > `go fmt` (or sorting for gitignore for example). > > > > > > > > The formatter command was "made" for Go, so that you used it for that > > > > is no surprise. But... how often do you need to re-sort a .gitignore > > > > file? And if you really need to, how hard is it to type: ^R ^X |sort > > > > <Enter>? > > > > > > > > > > Any time I'm changing a .gitignore I run this. And really any time > > > I'm editing _any_ file I'll instinctively hit ^T to run the formatter > > > / linter. `^R^X|sort` is a *lot* to type over and over. > > > Additionally, if `^R^X` replaces `formatter` surely it also replaces > > > `linter` but that seems to remain? > > > > > > > > Whether I had a formatter or linter I could run ^T and it would > > > > > usually do what I want. With the removal of `formatter` from nanorc > > > > > is there a way to restore that behaviour? > > > > > > > > No. Not now. > > > > > > > > > I work on a _ton_ of different file types (20+) so setting up a > > > > > shortcut for each formatter for each language is really not feasible. > > > > > > > > For how many of those syntaxes have you found a useful use of the > > > > formatter command? (Judging from your Github stuff, you have nanorc > > > > files for just four syntaxes, and just one of them contains formatter.) > > > > > > > > > > Ah yeah, those are just the ones I have posted publicly because they > > > work "universally" on all the machines I install those dotfiles on -- > > > I have 10-15 other nanorc files that I don't have checked in there > > > (with most of them containing formatters / linters). > > > > > > > > I'd be sad to see this feature removed permanently > > > > > > > > > > (maybe this is an email asking for restoration of `formatter`) > > > > > > > > Then please post a feature request on Savannah: > > > > https://savannah.gnu.org/bugs/?group=nano > > > > > > > > In that request you may want to reference another complaint: > > > > https://savannah.gnu.org/bugs/?54651 > > > > > > It seems that link is exactly what I'm asking for as well, either > > > restoration of ^T -> `formatter` or an equivalent replacement. Though > > > it is marked as `wontfix` :( > > > > > > > > > > > Benno