1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:10:05 +08:00

Add mapping for auto detect the file encoding

This commit is contained in:
wsdjeg 2017-05-15 22:20:58 +08:00
parent ed36732d5c
commit 973116b6fc
3 changed files with 16 additions and 5 deletions

View File

@ -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 <Plug>BookmarkToggle
nmap mi <Plug>BookmarkAnnotate
nmap ma <Plug>BookmarkShowAll

View File

@ -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 <silent> [SPC]tn :<C-u>setlocal nonumber! norelativenumber!<CR>
let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number']

View File

@ -449,10 +449,18 @@ All plugins can be easily discovered via `<leader> 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
```