Is it possible to easily switch between tabs and spaces in nano?

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
Normally I want nano to replace tabs with spaces, so I use set tabstospaces in my .nanorc file. Occasionally I'd like to use nano to make a quick edit to makefiles where I need real tab characters.
Is there any way to dynamically toggle tabstospaces? Most of the other options have keys to toggle them, but I can't find something for this. I've also tried using ^I (which by default is bound to the tab function) to insert a tab, but that honors the tabstospaces setting.
My current workaround is to take set tabstospaces out of my .nanorc file and to add shell aliases instead:
alias nanotabs="$(which nano)"
alias nano="$(which nano) --tabstospaces"
nano
add a comment |Â
up vote
5
down vote
favorite
Normally I want nano to replace tabs with spaces, so I use set tabstospaces in my .nanorc file. Occasionally I'd like to use nano to make a quick edit to makefiles where I need real tab characters.
Is there any way to dynamically toggle tabstospaces? Most of the other options have keys to toggle them, but I can't find something for this. I've also tried using ^I (which by default is bound to the tab function) to insert a tab, but that honors the tabstospaces setting.
My current workaround is to take set tabstospaces out of my .nanorc file and to add shell aliases instead:
alias nanotabs="$(which nano)"
alias nano="$(which nano) --tabstospaces"
nano
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
Normally I want nano to replace tabs with spaces, so I use set tabstospaces in my .nanorc file. Occasionally I'd like to use nano to make a quick edit to makefiles where I need real tab characters.
Is there any way to dynamically toggle tabstospaces? Most of the other options have keys to toggle them, but I can't find something for this. I've also tried using ^I (which by default is bound to the tab function) to insert a tab, but that honors the tabstospaces setting.
My current workaround is to take set tabstospaces out of my .nanorc file and to add shell aliases instead:
alias nanotabs="$(which nano)"
alias nano="$(which nano) --tabstospaces"
nano
Normally I want nano to replace tabs with spaces, so I use set tabstospaces in my .nanorc file. Occasionally I'd like to use nano to make a quick edit to makefiles where I need real tab characters.
Is there any way to dynamically toggle tabstospaces? Most of the other options have keys to toggle them, but I can't find something for this. I've also tried using ^I (which by default is bound to the tab function) to insert a tab, but that honors the tabstospaces setting.
My current workaround is to take set tabstospaces out of my .nanorc file and to add shell aliases instead:
alias nanotabs="$(which nano)"
alias nano="$(which nano) --tabstospaces"
nano
nano
edited 11 mins ago
asked Jan 15 '15 at 18:16
jamesdlin
334312
334312
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
The shortcut that toggles tabstospaces is
Shift+Alt+Q (or Meta+Q).
You will see the prompt changing to:
[ Conversion of typed tabs to spaces disabled ]
or
[ Conversion of typed tabs to spaces enabled ]
respectively.
Another way (only for nano 1.3.1 or newer):
You can insert a literal tab if you enter Verbatim Input mode with Shift+Alt+V (or Meta+V).
If you then type Tab, nano will insert a literal tab character, irrespective of your .nanorc settings. It will then revert to regular input mode (so you'll have to enter Verbatim Input mode again if you need to type a second literal tab and so on).
You can also add your own Verbatim Input mode shortcut to .nanorc, e.g. Ctrl+T:
#Edit
bind ^T verbatim main
Aha! I don't know how I missed seeingM-Qin the built-in help (curses at the inability to search nano's help).
â jamesdlin
Jan 15 '15 at 21:34
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
The shortcut that toggles tabstospaces is
Shift+Alt+Q (or Meta+Q).
You will see the prompt changing to:
[ Conversion of typed tabs to spaces disabled ]
or
[ Conversion of typed tabs to spaces enabled ]
respectively.
Another way (only for nano 1.3.1 or newer):
You can insert a literal tab if you enter Verbatim Input mode with Shift+Alt+V (or Meta+V).
If you then type Tab, nano will insert a literal tab character, irrespective of your .nanorc settings. It will then revert to regular input mode (so you'll have to enter Verbatim Input mode again if you need to type a second literal tab and so on).
You can also add your own Verbatim Input mode shortcut to .nanorc, e.g. Ctrl+T:
#Edit
bind ^T verbatim main
Aha! I don't know how I missed seeingM-Qin the built-in help (curses at the inability to search nano's help).
â jamesdlin
Jan 15 '15 at 21:34
add a comment |Â
up vote
4
down vote
accepted
The shortcut that toggles tabstospaces is
Shift+Alt+Q (or Meta+Q).
You will see the prompt changing to:
[ Conversion of typed tabs to spaces disabled ]
or
[ Conversion of typed tabs to spaces enabled ]
respectively.
Another way (only for nano 1.3.1 or newer):
You can insert a literal tab if you enter Verbatim Input mode with Shift+Alt+V (or Meta+V).
If you then type Tab, nano will insert a literal tab character, irrespective of your .nanorc settings. It will then revert to regular input mode (so you'll have to enter Verbatim Input mode again if you need to type a second literal tab and so on).
You can also add your own Verbatim Input mode shortcut to .nanorc, e.g. Ctrl+T:
#Edit
bind ^T verbatim main
Aha! I don't know how I missed seeingM-Qin the built-in help (curses at the inability to search nano's help).
â jamesdlin
Jan 15 '15 at 21:34
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
The shortcut that toggles tabstospaces is
Shift+Alt+Q (or Meta+Q).
You will see the prompt changing to:
[ Conversion of typed tabs to spaces disabled ]
or
[ Conversion of typed tabs to spaces enabled ]
respectively.
Another way (only for nano 1.3.1 or newer):
You can insert a literal tab if you enter Verbatim Input mode with Shift+Alt+V (or Meta+V).
If you then type Tab, nano will insert a literal tab character, irrespective of your .nanorc settings. It will then revert to regular input mode (so you'll have to enter Verbatim Input mode again if you need to type a second literal tab and so on).
You can also add your own Verbatim Input mode shortcut to .nanorc, e.g. Ctrl+T:
#Edit
bind ^T verbatim main
The shortcut that toggles tabstospaces is
Shift+Alt+Q (or Meta+Q).
You will see the prompt changing to:
[ Conversion of typed tabs to spaces disabled ]
or
[ Conversion of typed tabs to spaces enabled ]
respectively.
Another way (only for nano 1.3.1 or newer):
You can insert a literal tab if you enter Verbatim Input mode with Shift+Alt+V (or Meta+V).
If you then type Tab, nano will insert a literal tab character, irrespective of your .nanorc settings. It will then revert to regular input mode (so you'll have to enter Verbatim Input mode again if you need to type a second literal tab and so on).
You can also add your own Verbatim Input mode shortcut to .nanorc, e.g. Ctrl+T:
#Edit
bind ^T verbatim main
edited Jan 15 '15 at 21:07
answered Jan 15 '15 at 19:15
don_crissti
48k15126155
48k15126155
Aha! I don't know how I missed seeingM-Qin the built-in help (curses at the inability to search nano's help).
â jamesdlin
Jan 15 '15 at 21:34
add a comment |Â
Aha! I don't know how I missed seeingM-Qin the built-in help (curses at the inability to search nano's help).
â jamesdlin
Jan 15 '15 at 21:34
Aha! I don't know how I missed seeing
M-Q in the built-in help (curses at the inability to search nano's help).â jamesdlin
Jan 15 '15 at 21:34
Aha! I don't know how I missed seeing
M-Q in the built-in help (curses at the inability to search nano's help).â jamesdlin
Jan 15 '15 at 21:34
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f179313%2fis-it-possible-to-easily-switch-between-tabs-and-spaces-in-nano%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password