1

I am writing my first vimrc and I already read help pages for hidden & nostartofline options and some other article (like that and others FAQ) But I still can't understand what the purpose of this two options (maybe I haven't any professional coding experience).

3

Perhaps examples will help you understand the features:

'hidden'

  1. Start a new instance of Vim in the terminal with the command vim -Nu NONE. This will start Vim with default configuration, and thus 'hidden' will be unset (and 'startofline' will be set).

  2. Enter insert mode by pressing i, type in some text, and then press Esc to return to normal mode,

  3. Enter the command :e anotherfile.txt to start editing a new file,

  4. Vim will display an error because you haven't written the file yet,

  5. Enter the command :set hidden to switch on the 'hidden' option

  6. Try the command again: :e anotherfile.txt.

What happens?

'nostartofline'

  1. In the same instance of Vim, enter the command :b#to return to your original buffer.

  2. Press gg to jump to the beginning of the buffer and then $ to jump to the end of the line. (If the first line is blank, first enter some text.)

  3. Press gg again. The cursor will move to the start of the line.

  4. Press $ to move back to the end of the line,

  5. Enter the command :set nostartofline.

  6. Press gg a third time.

What happens?

0

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.