diff --git a/autoload/SpaceVim/layers/tools.vim b/autoload/SpaceVim/layers/tools.vim index efb76e189..45c8cd7c2 100644 --- a/autoload/SpaceVim/layers/tools.vim +++ b/autoload/SpaceVim/layers/tools.vim @@ -1,6 +1,7 @@ function! SpaceVim#layers#tools#plugins() abort return [ \ ['tpope/vim-scriptease'], + \ ['mbbill/fencview', { 'on_cmd' : 'FencAutoDetect'}], \ ['SpaceVim/cscope.vim'], \ ['wsdjeg/vim-cheat', { 'on_cmd' : 'Cheat'}], \ ['wsdjeg/SourceCounter.vim', { 'on_cmd' : 'SourceCounter'}], @@ -47,6 +48,8 @@ endfunction function! SpaceVim#layers#tools#config() abort call SpaceVim#mapping#space#def('nnoremap', ['a', 'c'], 'Calendar', 'vim calendar', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', 'a'], 'FencAutoDetect', + \ 'Auto detect the file encoding', 1) nmap mm BookmarkToggle nmap mi BookmarkAnnotate nmap ma BookmarkShowAll diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 256bffb9d..d77bbaf5d 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -48,7 +48,7 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp') let g:_spacevim_mappings_space.b.N = ['bN', 'previous buffer'] call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bN', 'bp') - let g:_spacevim_mappings_space.e = {'name' : '+Errors'} + let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'} let g:_spacevim_mappings_space.B = {'name' : '+Global-uffers'} nnoremap [SPC]tn :setlocal nonumber! norelativenumber! let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number'] diff --git a/docs/documentation.md b/docs/documentation.md index b8faa2f6f..dc4e958b8 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -449,10 +449,18 @@ All plugins can be easily discovered via ` l p`. SpaceVim use utf-8 as default encoding. there are four options for these case: -- fileencodings (fencs) -- fileencoding (fenc) -- encoding (enc) -- termencoding (tenc) +- fileencodings (fencs): ucs-bom,utf-8,default,latin1 +- fileencoding (fenc): utf-8 +- encoding (enc): utf-8 +- termencoding (tenc): utf-8 (only supported in vim) + +to fix messy display: `SPC e a` is the mapping for auto detect the file encoding. after detecting file encoding, you can run the command below to fix the encoding: + +```vim +set enc=utf-8 +write +``` +