In my .vimrc-file I have these commands:
" Add normal cursor-behavior on screen noremap <buffer> <silent> k gk noremap <buffer> <silent> j gj noremap <buffer> <silent> 0 g0 noremap <buffer> <silent> $ g$
So when I press
j, then it goes down one visual line on the screen. However... Sometimes when I load a document, then that doesn't always work. It's strange because sometimes it works and sometimes it doesn't.
For instance, when I created a
temp.txt-file on my desktop, copied in a long line and made a
:vsplit (to make the screen more narrow)... Then it worked as it should.
But if I used
vim ftp://username@host//, opened a file in a tab, did a
:vsplit, then it didn't work! ... Here comes the strange part. I then close that file, with the ftp-connection still open. Then I repeat the exact same procedure, and then it works.
The thing that always fixes it, is to write
:so $MYVIMRC. Regardless of where I am (FTP-server, locally, whereever), - then writing that, fixes it.
I tried to move the four lines to the bottom of my
.vimrc-file, but with no luck. My best guess is that Vim loads some other
.vimrc-file after my
$MYVIMRC-file sometimes, which overwrites this command. So I checked, by writing
:version, which gave this output:
system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/local/share/vim"
Are there a way, where I can ensure that Vim, in a way, always do a
:so $MYVIMRC as the last thing, after it has loaded?
I have Vim-version 7.4, compiled by Homebrew and are working on a Mac.