How can I "Untab", move a block of code to the left in nano?
In most gui editors shift+tab works but can't find anything for nano.
With an english keyboard-layout Ctrl + Alt + { should work to unindent tabs (untab) in Nano Text Editor.
If you use a keyboard-layout which needs Alt-Gr for curly braces, use ESC then { instead.
Manjaro,Year: 2022>> give "shift+tab" a try after you have mark"alt+a" your selected texts.
Related
I have mapped this feature where I put any bracket and vim autocompletes the second bracket and places the cursor inside the brackets so I can fill it. Now, does anyone of you have an idea how to avoid always hitting ESC and navigating outside the bracket again after finishing the text inside? How do you handle "skipping" the closing bracket?
You can tell vim not to auto complete by ctrl - v before typing the bracket.
Or as -> or plugin dependent as suggested by romainl
My vim misbehaves. After pressing esc + i to insert text, i can't use left, right, top and down arrow keys of to traverse through a word. Kindly help me how do i resolve.. Also i can't see any syntax also being highlighted for my C file.
After pressing esc + i to insert a text : can't Using left , right , top & down arrow keys of keyboard to traverse thru a word.
Isn't this proper behaviour anyhow? You should use hjkl instead.
However, check your vimrc file to see if they have been unmapped.
I can't see any syntax also being highlighted for my C file.
Enable syntax highlighting via syntax on in your vimrc file, or enter it as a command.
With the DelimitMate, it auto generates the closing parentheses. When I'm finished typing inside the parenthesis, what key strokes do I press to quickly go to the right of the closing parenthesis? (Right now I have to manually press ESC then 'a')
The idea of these auto-closing plugins (like the original feature implementation found in IDEs like Eclipse) is that you just type the closing character to go over it. The plugin should detect this situation and instead of inserting the character jumps over the existing, auto-inserted one.
If that's not working for you, there are several plugin alternatives on offer. The Vim Tips Wiki has a list of them.
With delimitMate, Shift-tab will jump out of the current delimiter and Control-G g will get you out of nested delimiters. No need to remap anything.
You could try auto-pairs's Fly Mode
eg:
( hello| world )
press ) at |
( hello world )|
If jump incorrect, use <M-b> to do the back insert.
eg:
(hello| world()
press ) at |
(hello world()|
press <M-b>
(hello)| world()
Repository: https://github.com/jiangmiao/auto-pairs
Plugin: http://www.vim.org/scripts/script.php?script_id=3599
add
let g:AutoPairsFlyMode=1
to .vimrc to turn Fly Mode on
You can do a custom map. I guess you want to go to the right of the closing parenthesis while you're in insert mode. Just add to your .vimrc this mapping:
:inoremap <F8> <ESC>f)a
In this way, while your in insert mode and you've finished to write inside the parenthesis, F8 will bring your cursor ad the right of the closing parenthesis.
If you want you can change the mapped key, using another key instead of F8.
As Kent said in the comment a more general solution would be:
:inoremap <F8> <ESC>%%a
Which will work for [ and { brackets.
I kinda agree with Atropo on this one: if you want to stick with DelimitMate then the least disruption to your workflow might be to make a custom imap to get to the other side of the auto inserted character.
Personally I prefer to have more control over where/when the characters are auto-inserted, and how I can navigate around the auto-inserted characters; UltiSnips or SnipMate does that for me. Maybe they're more what you're looking for.
If you typing on a new line, you try A which will append text at the end of the line.
I have autoClose installed. what I am doing currently is ("I" is cursor)
- (xxxxI)
- ( xxxxI )
- ( xxxxIxx )
- text (xxxxI) other text
- text ( xxxxI ) other text
- text ( xxxxIxx ) other text
I just make a mapping, to <esc>%%a then in above case, the cursor will move to (...)I..whatever
it doesn't work for quotes.
A little late to the party, but note that it can be done easily without any custom mappings. In insert mode, you can press <C-O> (a default mapping) to enter a "one shot" normal mode where you can enter a single normal mode command.
So to answer your question, what you could do is <C-O>a.
Usually when I code in Python, I have to create a dictionary, and I press " once and it creates "|", being | my cursor.
I'm using TAB key in the snipMate plugin to use snippets. I would like to press tab, when inside quotes after writing a string, that "exits" the quotes, but mantain snipMate. Example:
"name|", and, pressing TAB, to become "name"|. So, mainly, when in before a " in closing quotes, after pressing tab (or other combination possibly, since tab would conflict with a plugin or something), put cursor one side at right. How should I do it?
delimitMate allows you to use shift-tab to exit quotes (or any other delimiters).
To exit a delimiter I'll usually just use ctrl-o, which puts me into normal mode for one action, then A to append text after the delimiter.
This is likely not to be compatible with other plugins, but you can try the following:
~/.vimrc:
inoremap " "<c-r>=TriggerSnippet()<cr>
Wherever your snippets are defined for python add a snippit like this:
snippet "
"${1}"${2}
(the whitespace is a tab character, important when defining snippits)
This also may have probably has other side effects, I didn't test it too much.
I'm writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block. Normally I can just type << to unindent, but it takes too many keystorkes, anyone have a better idea?
Type Ctrl-D on your keyboard, removes one tabstop at a time, works for space-replaced tabs.
In Vim in Linux you can unindent multiple lines by using V to select your first line. Press the down arrow to select multiple lines. Then type < to unindent all of the lines.
If you want to indent, type > instead
Backspace will remove one level of indent at a time.
You can press Ctrl-U it will delete backwards to the beginning of line.