sudo vim files can't write to file report: Error detected while processing function <SNR>23_format:
<!-- please remove the issue template when request for a feature -->
## Expected behavior, english is recommend

sudo save file to disk ok

## Environment Information

- OS: linux
- vim version: -
- neovim version: 0.4.4
- SpaceVim version: 1.7.0-dev
- SpaceVim status: 1fe6a3da^@

```
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
```

## The reproduce ways from Vim starting (Required!)

ubuntu 18.04

```sh
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:neovim-ppa/stable
#sudo apt-get update
sudo apt-get install -y vim-nox neovim
sudo apt-get install -y python-neovim python3-neovim xxd
sudo -H pip3 install jedi

sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60

# install powerline fonts

mkdir -p ~/tmp
cd ~/tmp
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

fc-cache -vf


# install nerd hack fonts

mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/Hack.zip
unzip Hack.zip
rm -rf Hack.zip
fc-cache -vf


cd ~

# fix permissions issue

mkdir -p $HOME/{.config,.npm,.node-gyp,.local,.cache}
sudo chown -R $USER:$(id -gn $USER) $HOME/.config
sudo chown -R $USER:$(id -gn $USER) $HOME/.npm
sudo chown -R $USER:$(id -gn $USER) $HOME/.node-gyp
sudo chown -R $USER:$(id -gn $USER) $HOME/.local
sudo chown -R $USER:$(id -gn $USER) $HOME/.cache

# cleanup previous install

rm -rf ~/.cache/neomru/
rm -rf ~/.cache/neosnippet/
rm -rf ~/.cache/neoyank/
rm -rf ~/.cache/SpaceVim/
rm -rf ~/.cache/vimfiler/
rm -rf ~/.cache/vimfiles/
rm -rf ~/.SpaceVim/

rm -rf ~/.config/nvim
rm -rf ~/.vim
rm -rf ~/.viminfo
#rm -rf ~/.SpaceVim.d/

curl -sLf https://spacevim.org/install.sh | bash

# fix vimproc issue
cd ~/.vim/bundle/vimproc.vim
git pull
make

mkdir -p ~/.SpaceVim.d/
nano ~/.SpaceVim.d/init.toml
```

init.toml
```toml
#=============================================================================
# dark_powered.toml --- dark powered configuration example for SpaceVim
# Copyright (c) 2016-2017 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================

# All SpaceVim option below [option] section
[options]
    # set spacevim theme. by default colorscheme layer is not loaded,
    # if you want to use more colorscheme, please load the colorscheme
    # layer
#colorscheme = "gruvbox"
#colorscheme = "material"
#colorscheme = "hybrid"
#colorscheme = "jellybeans"
#colorscheme = "onedark"
colorscheme = "onedark"
#    colorscheme = "OceanicNext"
    colorscheme_bg = "dark"

    background = "dark"
    # Disable guicolors in basic mode, many terminal do not support 24bit
    # true colors
    enable_guicolors = true
#enable_guicolors = false
    # Disable statusline separator, if you want to use other value, please
    # install nerd fonts
    statusline_separator = "arrow"
    statusline_inactive_separator = "arrow"
    buffer_index_type = 4
    enable_tabline_filetype_icon = true
    enable_statusline_display_mode = false
    filetree_direction = "left"
    vim_help_language = "cn"

#guifont = "DejaVu\ Sans\ Mono\ for\ Powerline\ 11"
#guifont = "Hack\ Nerd\ Font\ 11"
guifont = "Hack Nerd Font:h14"
#guifont = "Hack\ Regular\ Nerd\ Font\ Complete:h11:cANSI"
#guifontwide = "Hei:h11"
#guifont = "SauceCodePro Nerd Font Mono:h11"

    number = false
    relativenumber = false

    timeoutlen = 600
    #bootstrap_after = "myinitvim#after"

#[[custom_plugins]]
#name = "mhartington/oceanic-next"
#merged = false


[[custom_plugins]]
name = "lilydjwg/colorizer"
on_cmd = ["ColorHighlight", "ColorToggle"]
merged = false

[[custom_plugins]]
name = "ryanoasis/vim-devicons"
merged = false

[[layers]]
name = "colorscheme"
##random_theme = true
##frequency = "daily"

[[layers]]
name = "default"

[[layers]]
name = "chinese"

#[[layers]]
#name = "lsp"
# npm i -g bash-language-server
# npm install -g javascript-typescript-langserver
# npm install  -g vue-language-server
# pip install --user python-language-server
# npm install -g vscode-css-languageserver-bin

# Enable autocomplete layer
[[layers]]
name = 'autocomplete'
auto-completion-return-key-behavior = "complete"
auto-completion-tab-key-behavior = "smart"

[[layers]]
name = 'shell'
default_position = 'top'
default_height = 30

[[layers]]
name = "format"

#[[layers]]
#name = "tools"

#[[layers]]
#name = "tools#dash"

#[[layers]]
#name = "checkers"
#show_cursor_error = true

#[[layers]]
#name = "debug"

[[layers]]
name = "incsearch"

[[layers]]
name = "fzf"

[[layers]]
name = "git"

#[[layers]]
#name = "github"

[[layers]]
name = "tmux"

[[layers]]
name = "sudo"

[[layers]]
name = "test"

[[layers]]
name = "gtags"
#gtagslabel = "pygments"
gtagslabel = "ctags"

#[[layers]]
#name = "lang#go"

[[layers]]
name = "lang#python"

[[layers]]
name = "lang#sh"

#[[layers]]
#name = "lang#markdown"

[[layers]]
name = "lang#toml"

[[layers]]
name = "lang#json"

[[layers]]
name = "lang#javascript"

[[layers]]
name = "lang#typescript"

[[layers]]
name = "lang#vue"

[[layers]]
name = "lang#html"

[[layers]]
name = "lang#sql"

#[[layers]]
#name = "lang#java"

#[[layers]]
#name = "lang#php"

#[[layers]]
#name = "lang#graphql"

#[[layers]]
#name = "lang#rust"

#[[layers]]
#name = "lang#dart"

#[[layers]]
#name = "lang#julia"

#[[layers]]
#name = "lang#plantuml"

```

start vim to install plugins

```sh
# install plugins 1
vim.nox
# install plugins 2
nvim
```

after i install spacevim on current user ,i repeat the steps on root user.

after restart vim edit current user file ok, both for demouser and root

but when i edit some file need sudo

```sh
sudo vim /etc/hosts
```
edit and try to save to disk
```vim
:wq
```
i got the error:

![image](https://user-images.githubusercontent.com/100613/116065692-dc4b1200-a6b9-11eb-8440-f495f86434a7.png)

and the file cannot write to disk.

i have to do:
```sh
sudo -i
vim /etc/hosts

# edit file content
# :wq

```


## Output of the `:SPDebugInfo!`

<details><summary> SpaceVim debug information </summary>

### SpaceVim options :

```toml
  auto_disable_touchpad = 1
  autocomplete_method = 'deoplete'
  autocomplete_parens = 1
  background = 'dark'
  buffer_index_type = 4
  checkinstall = 1
  colorscheme = 'onedark'
  colorscheme_bg = 'dark'
  colorscheme_default = 'desert'
  commandline_prompt = '➭'
  custom_color_palette = []
  custom_plugins = [['lilydjwg/colorizer', {'name': 'lilydjwg/colorizer', 'on_cmd': ['ColorHighlight', 'ColorToggle'], 'merged': 0, 'overwrite': 1}], ['ryanoasis/vim-devicons', {'name': 'ryanoasis/vim-devicons'
  data_dir = '/home/www/.cache/'
  debug_level = 1
  default_custom_leader = '<Space>'
  default_indent = 2
  disabled_plugins = []
  enable_bepo_layout = 0
  enable_cursorcolumn = 0
  enable_cursorline = 1
  enable_debug = 0
  enable_googlesuggest = 0
  enable_guicolors = 1
  enable_javacomplete2_py = 0
  enable_key_frequency = 0
  enable_language_specific_leader = 1
  enable_neocomplcache = 0
  enable_os_fileformat_icon = 0
  enable_powerline_fonts = 1
  enable_projects_cache = 1
  enable_statusline_bfpath = 0
  enable_statusline_display_mode = 0
  enable_statusline_mode = 0
  enable_statusline_tag = 1
  enable_tabline_filetype_icon = 1
  enable_tabline_ft_icon = 0
  enable_vimfiler_filetypeicon = 0
  enable_vimfiler_gitstatus = 0
  enable_vimfiler_welcome = 1
  enable_ycm = 0
  error_symbol = '✖'
  escape_key_binding = 'jk'
  expand_tab = 1
  filemanager = 'vimfiler'
  filetree_direction = 'left'
  filetype_icons = {}
  force_global_config = 0
  gitcommit_issue_icon = ''
  gitcommit_pr_icon = ''
  github_username = ''
  guifont = 'Hack Nerd Font:h14'
  hiddenfileinfo = 1
  home_files_number = 6
  hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
  info_symbol = 'ⓘ'
  keep_server_alive = 1
  language = ''
  leader_guide_default_group_name = ''
  leader_guide_flatten = 1
  leader_guide_hspace = 5
  leader_guide_max_size = 0
  leader_guide_position = 'botright'
  leader_guide_run_map_on_popup = 1
  leader_guide_sort_horizontal = 0
  leader_guide_submode_mappings = {'<C-C>': 'win_close'}
  leader_guide_vertical = 0
  lint_engine = 'neomake'
  lint_on_save = 1
  lint_on_the_fly = 0
  max_column = 120
  number = 0
  plugin_bundle_dir = '/home/www/.cache/vimfiles/'
  plugin_manager = 'dein'
  plugin_manager_processes = 16
  plugin_name = 'vim-dadbod'
  project_rooter_automatically = 1
  project_rooter_outermost = 1
  project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/', '.SpaceVim.d/', 'package.json']
  projects_cache_num = 20
  realtime_leader_guide = 1
  relativenumber = 0
  search_tools = ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr', 'git']
  sidebar_direction = ''
  sidebar_width = 30
  smartcloseignoreft = ['tagbar', 'vimfiler', 'defx', 'SpaceVimRunner', 'SpaceVimREPL', 'SpaceVimQuickFix', 'HelpDescribe', 'VebuggerShell', 'VebuggerTerminal', 'SpaceVimTabsManager']
  smartcloseignorewin = ['__Tagbar__', 'vimfiler:default']
  snippet_engine = 'neosnippet'
  src_root = 'E:\sources\'
  statusline_inactive_separator = 'arrow'
  statusline_iseparator = 'nil'
  statusline_left_sections = ['winnr', 'filename', 'major mode', 'search count', 'syntax checking', 'minor mode lighters']
  statusline_right_sections = ['fileformat', 'cursorpos', 'percentage']
  statusline_separator = 'arrow'
  statusline_unicode_symbols = 1
  terminal_cursor_shape = 2
  timeoutlen = 600
  todo_labels = ['@fixme', '@question', '@todo', '@idea']
  update_retry_cnt = 3
  version = '1.7.0-dev'
  vim_help_language = 'cn'
  vimcompatible = 0
  warning_symbol = '⚠'
  wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,*.ttf,*.TTF,*.png,*/target/*,.git,.svn,.hg,.DS_Store,*.svg'
  windows_index_type = 3
  windows_leader = 's'
  windows_smartclose = 'q'
```


### SpaceVim layers :

```toml
[[layers]]
  name="autocomplete"
  auto-completion-return-key-behavior='complete'
  auto-completion-tab-key-behavior='smart'
[[layers]]
  name="checkers"
[[layers]]
  name="format"
[[layers]]
  name="edit"
[[layers]]
  name="ui"
[[layers]]
  name="core"
[[layers]]
  name="core#banner"
[[layers]]
  name="core#statusline"
[[layers]]
  name="core#tabline"
[[layers]]
  name="colorscheme"
[[layers]]
  name="default"
[[layers]]
  name="chinese"
[[layers]]
  name="shell"
  default_position='top'
  default_height=30
[[layers]]
  name="incsearch"
[[layers]]
  name="fzf"
[[layers]]
  name="git"
[[layers]]
  name="tmux"
[[layers]]
  name="sudo"
[[layers]]
  name="test"
[[layers]]
  name="gtags"
  gtagslabel='ctags'
[[layers]]
  name="lang#python"
[[layers]]
  name="lang#sh"
[[layers]]
  name="lang#toml"
[[layers]]
  name="lang#json"
[[layers]]
  name="lang#javascript"
[[layers]]
  name="lang#typescript"
[[layers]]
  name="lang#vue"
[[layers]]
  name="lang#html"
[[layers]]
  name="lang#sql"
```


### SpaceVim Health checking :

SpaceVim clipboard support check report:
Checking +clipboard:
      Failed : to support +clipboard, you need has one of following clipboard tools in your $PATH:
               1. xclip
               2. xsel
               3. pbcopy/pbpaste (Mac OS X)
               4. lemonade (for SSH) https://github.com/pocke/lemonade
               5. doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
SpaceVim environment check report:
Current progpath: vim(/usr/bin/nvim)
version: 800
OS: linux
[shell, shellcmdflag, shellslash]: ['/bin/zsh', '-c', 0]
SpaceVim lua support check report:
Checking +lua:
      Failed : Known issue, neovim do not support lua now.
SpaceVim python support check report:
Checking +python3:
      SUCCEED!
Checking +python:
      SUCCEED!

### SpaceVim runtime log :

```log
[ SpaceVim ] : logger file  does not exists, only log for current process will be shown!
[ SpaceVim ] [10:11:02] [ Info ] Startup with argv: ['/etc/hosts']
[ SpaceVim ] [10:11:02] [ Info ] find local conf: /data/app/gitee.com/henglin/bizark_envsetup/mockup/client/all/.SpaceVim.d/init.toml
[ SpaceVim ] [10:11:02] [ Info ] loading cached local conf: /home/www/.cache//SpaceVim/conf/_data_app_gitee_com_henglin_bizark_envsetup_mockup_client_all__SpaceVim_d_init_toml.json
[ SpaceVim ] [10:11:02] [ Info ] start to apply config [local]
[ SpaceVim ] [10:11:02] [ Info ] the func has been added to mode:syntax-checking
[ SpaceVim ] [10:11:02] [ Info ] the func has been added to mode:spell-checking
[   rooter ] [10:11:02] [ Info ] Load projects cache from: /home/www/.cache/SpaceVim/projects.json
[   rooter ] [10:11:02] [ Info ] project_rooter_patterns option has been change, clear b:rootDir
[   rooter ] [10:11:02] [ Info ] Start to find root for: /etc/hosts
[   rooter ] [10:11:02] [ Info ] buffer name: /etc/hosts
[   rooter ] [10:11:02] [ Info ] same as current directory, no need to change.
[   rooter ] [10:11:02] [ Info ] buffer name: /etc/hosts
[   rooter ] [10:11:02] [ Info ] same as current directory, no need to change.
[ SpaceVim ] [10:11:06] [ Info ] key binding guide float statusline winid:1003
[   rooter ] [10:11:07] [ Info ] buffer name: /etc/hosts
[   rooter ] [10:11:07] [ Info ] same as current directory, no need to change.
[ SpaceVim ] [10:11:07] [ Info ] close float statusline winid:1003
[ SpaceVim ] [10:11:15] [ Info ] key binding guide float statusline winid:1005
[   rooter ] [10:11:16] [ Info ] buffer name: /etc/hosts
[   rooter ] [10:11:16] [ Info ] same as current directory, no need to change.
[ SpaceVim ] [10:11:16] [ Info ] close float statusline winid:1005
[ SpaceVim ] [10:11:16] [ Info ] key binding guide float statusline winid:1007
[   rooter ] [10:11:18] [ Info ] buffer name: /etc/hosts
[   rooter ] [10:11:18] [ Info ] same as current directory, no need to change.
[ SpaceVim ] [10:11:18] [ Info ] close float statusline winid:1007
[   rooter ] [10:11:18] [ Info ] Start to find root for: /tmp/nvimwy60XP/1/issue_report.md
[   rooter ] [10:11:18] [ Info ] buffer name: /tmp/nvimwy60XP/1/issue_report.md
[   rooter ] [10:11:18] [ Info ] same as current directory, no need to change.
```
</details>

## Screenshots

If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video  in terminal. 



