I get E303 (Unable to open swap file for "{filename}", recovery impossible) when I open a file in vim in my Ubuntu system.
I see that the backupdir and directory environment variables are set correctly in vim -
:se backupdir
backupdir=~/tools/Vim_Files/vim_backup
:se directory
directory=~/tools/Vim_Files/vim_backup
This is the output of ls -l in the shell -
ls -l ~/tools/Vim_Files/
drwxrwxr-x 2 me me 4096 Oct 12 17:02 vim_backup
This is the relevant portion of my .vimrc setting up these variables -
se nobackup writebackup
let s:vim_cstmztn_files_dir='~/tools/Vim_Files/'
let &directory=s:vim_cstmztn_files_dir.'vim_backup'
let &backupdir=s:vim_cstmztn_files_dir.'vim_backup'