'Vim Editor .vimrc error during customizaiton [duplicate]
I has suffered while customizing my vim editor.
Specifically, I add function which store cursor location.
Below is my .vimrc file.
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "norm g`\"" |
\ endif
And Error content is below :
au: command not found
-bash: /home/ubuntu/.vimrc: line 24: syntax error near unexpected token `('
-bash: /home/ubuntu/.vimrc: line 24: `\ if line("'\"") > 0 && line("'\"") <= line("$") |'
Could you give me the solution ? Take care of your health during COVID-19. Thanks !
I found solution that change file authority.
chmod +777 ~/.viminfo
.vimsrc file compiled still suffering error.
But function that restore cursor position is working.
Reference : https://askubuntu.com/questions/202075/how-do-i-get-vim-to-remember-the-line-i-was-on-when-i-reopen-a-file
Solution 1:[1]
You don't need to source .vimrc from the command line, this will be done automatically by vim. Just make sure it's in the right place ($HOME/.vimrc)
Then when you open vim, it will source automatically.
You can view how to debug, where you will see if your file has been sourced in this answer How to see which plugins are making Vim slow?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hayden |