0

For indenting there's no problem. I enter the visual-block mode, select the block, enter insert mode, press ctrl-t (or just press tab), exit the visual-block mode, and the whole block is indented.

So, for the following code:

def my_function():
print('entering my_function')
print('leaving my_function')

Results in:

def my_function():
    print('entering my_function')
    print('leaving my_function')

Taking this last piece of code, if I follow the same steps as described in the first paragraph, but pressing ctrl-d instead of ctrl-t, the result is the following:

def my_function():
    print('entering my_function')
print('leaving my_function')

Even if select both lines in the visual-block mode, only the one on which I apply the unindent command gets affected.

7

Neither Ctrl-T nor Ctrl-D (or indeed Tab) are bound to indent commands in visual mode by default. They're insert mode special keys. (See :help ins-special-keys.) That these commands work at all suggests you have something in your configuration that enables them.

The standard keystrokes for indentation in visual mode are > for indent and < for outdent. (See :help v_< and :help v_>)

If you want to investigate what's happening when you press Ctrl-T or Ctrl-D in visual mode, try running the following command:

:verbose xmap <C-T>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.