mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:30:04 +08:00
fix(chinese): change chineselinter key binding
This commit is contained in:
parent
8f8c0838ff
commit
c9cd11ff21
@ -40,9 +40,11 @@ function! SpaceVim#layers#chinese#plugins() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#chinese#config() abort
|
function! SpaceVim#layers#chinese#config() abort
|
||||||
let g:_spacevim_mappings_space.x.g = {'name' : '+translate'}
|
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 't'], 'Translate' , 'translate-current-word' , 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Translate' , 'translate current word' , 1)
|
if !SpaceVim#layers#isLoaded('edit')
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['l', 'c'] , 'CheckChinese', 'Check with ChineseLinter', 1)
|
let g:_spacevim_mappings_space.x.g = {'name' : '+Grammarous'}
|
||||||
|
endif
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 'c'] , 'CheckChinese', 'check-with-ChineseLinter', 1)
|
||||||
let g:_spacevim_mappings_space.n.c = {'name' : '+Convert'}
|
let g:_spacevim_mappings_space.n.c = {'name' : '+Convert'}
|
||||||
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'd'], '<Plug>ConvertChineseNumberToDigit', 'convert Chinese number to digit', 0, 1)
|
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'd'], '<Plug>ConvertChineseNumberToDigit', 'convert Chinese number to digit', 0, 1)
|
||||||
" do not load vimcdoc plugin
|
" do not load vimcdoc plugin
|
||||||
@ -128,20 +130,20 @@ function! s:Chinese2Digit(cnDigitString)
|
|||||||
let x = remove(parse, -1)
|
let x = remove(parse, -1)
|
||||||
if type(x) == type("")
|
if type(x) == type("")
|
||||||
if x == 'w'
|
if x == 'w'
|
||||||
let tmp *= 10000
|
let tmp *= 10000
|
||||||
let result += tmp
|
let result += tmp
|
||||||
let tmp = 0
|
let tmp = 0
|
||||||
elseif x == 'y'
|
elseif x == 'y'
|
||||||
let tmp *= 100000000
|
let tmp *= 100000000
|
||||||
let result += tmp
|
let result += tmp
|
||||||
let tmp = 0
|
let tmp = 0
|
||||||
elseif x == 'z'
|
elseif x == 'z'
|
||||||
let tmp *= 1000000000000
|
let tmp *= 1000000000000
|
||||||
let result += tmp
|
let result += tmp
|
||||||
let tmp = 0
|
let tmp = 0
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let tmp += x
|
let tmp += x
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
let result += tmp
|
let result += tmp
|
||||||
|
@ -154,7 +154,7 @@ function! SpaceVim#layers#edit#config() abort
|
|||||||
\ 'backupdir' : s:autosave_location,
|
\ 'backupdir' : s:autosave_location,
|
||||||
\ 'event' : s:autosave_events,
|
\ 'event' : s:autosave_events,
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
if has('nvim-0.7.0')
|
if has('nvim-0.7.0')
|
||||||
lua require('spacevim.plugin.autosave').config(vim.api.nvim_eval('autosave_opt'))
|
lua require('spacevim.plugin.autosave').config(vim.api.nvim_eval('autosave_opt'))
|
||||||
else
|
else
|
||||||
@ -170,12 +170,12 @@ function! SpaceVim#layers#edit#config() abort
|
|||||||
let g:user_emmet_mode='a'
|
let g:user_emmet_mode='a'
|
||||||
let g:user_emmet_settings = {
|
let g:user_emmet_settings = {
|
||||||
\ 'javascript': {
|
\ 'javascript': {
|
||||||
\ 'extends': 'jsx',
|
\ 'extends': 'jsx',
|
||||||
\ },
|
\ },
|
||||||
\ 'jsp' : {
|
\ 'jsp' : {
|
||||||
\ 'extends': 'html',
|
\ 'extends': 'html',
|
||||||
\ },
|
\ },
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
"noremap <SPACE> <Plug>(wildfire-fuel)
|
"noremap <SPACE> <Plug>(wildfire-fuel)
|
||||||
vnoremap <C-SPACE> <Plug>(wildfire-water)
|
vnoremap <C-SPACE> <Plug>(wildfire-water)
|
||||||
@ -353,7 +353,7 @@ function! SpaceVim#layers#edit#config() abort
|
|||||||
\ 'move-text-up(enter-transient-state)', 1)
|
\ 'move-text-up(enter-transient-state)', 1)
|
||||||
|
|
||||||
" transpose
|
" transpose
|
||||||
let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'}
|
let g:_spacevim_mappings_space.x.t = {'name' : '+Transpose/Translate'}
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call('
|
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call('
|
||||||
\ . string(s:_function('s:transpose_with_previous')) . ', ["character"])',
|
\ . string(s:_function('s:transpose_with_previous')) . ', ["character"])',
|
||||||
\ 'swap-current-character-with-previous-one', 1)
|
\ 'swap-current-character-with-previous-one', 1)
|
||||||
@ -405,33 +405,8 @@ function! SpaceVim#layers#edit#config() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if has('nvim-0.6.0')
|
if has('nvim-0.6.0')
|
||||||
" Hop
|
|
||||||
lua << EOF
|
|
||||||
-- Like hop.jump_target.regex_by_line_start_skip_whitespace() except it also
|
|
||||||
-- marks empty or whitespace only lines
|
|
||||||
function regexLines()
|
|
||||||
return {
|
|
||||||
oneshot = true,
|
|
||||||
match = function(str)
|
|
||||||
return vim.regex("http[s]*://"):match_str(str)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Like :HopLineStart except it also jumps to empty or whitespace only lines
|
|
||||||
function hintLines(opts)
|
|
||||||
-- Taken from override_opts()
|
|
||||||
opts = setmetatable(opts or {}, {__index = require'hop'.opts})
|
|
||||||
|
|
||||||
local gen = require'hop.jump_target'.jump_targets_by_scanning_lines
|
|
||||||
require'hop'.hint_with(gen(regexLines()), opts)
|
|
||||||
end
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
" See `:h forced-motion` for these operator-pending mappings
|
|
||||||
function! s:jump_to_url() abort
|
function! s:jump_to_url() abort
|
||||||
lua hintLines()
|
lua require('spacevim.plugin.hop').hintLines()
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function! s:jump_to_url() abort
|
function! s:jump_to_url() abort
|
||||||
@ -559,27 +534,27 @@ function! s:text_transient_state() abort
|
|||||||
call state.set_title('Move Text Transient State')
|
call state.set_title('Move Text Transient State')
|
||||||
call state.defind_keys(
|
call state.defind_keys(
|
||||||
\ {
|
\ {
|
||||||
\ 'layout' : 'vertical split',
|
\ 'layout' : 'vertical split',
|
||||||
\ 'left' : [
|
\ 'left' : [
|
||||||
\ {
|
\ {
|
||||||
\ 'key' : 'J',
|
\ 'key' : 'J',
|
||||||
\ 'desc' : 'move text down',
|
\ 'desc' : 'move text down',
|
||||||
\ 'func' : '',
|
\ 'func' : '',
|
||||||
\ 'cmd' : 'noautocmd silent! m .+1',
|
\ 'cmd' : 'noautocmd silent! m .+1',
|
||||||
\ 'exit' : 0,
|
\ 'exit' : 0,
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ 'right' : [
|
\ 'right' : [
|
||||||
\ {
|
\ {
|
||||||
\ 'key' : 'K',
|
\ 'key' : 'K',
|
||||||
\ 'func' : '',
|
\ 'func' : '',
|
||||||
\ 'desc' : 'move text up',
|
\ 'desc' : 'move text up',
|
||||||
\ 'cmd' : 'noautocmd silent! m .-2',
|
\ 'cmd' : 'noautocmd silent! m .-2',
|
||||||
\ 'exit' : 0,
|
\ 'exit' : 0,
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
call state.open()
|
call state.open()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
22
lua/spacevim/plugin/hop.lua
Normal file
22
lua/spacevim/plugin/hop.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
local M = {}
|
||||||
|
-- Like hop.jump_target.regex_by_line_start_skip_whitespace() except it also
|
||||||
|
-- marks empty or whitespace only lines
|
||||||
|
local function regexLines()
|
||||||
|
return {
|
||||||
|
oneshot = true,
|
||||||
|
match = function(str)
|
||||||
|
return vim.regex('http[s]*://'):match_str(str)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Like :HopLineStart except it also jumps to empty or whitespace only lines
|
||||||
|
function M.hintLines(opts)
|
||||||
|
-- Taken from override_opts()
|
||||||
|
opts = setmetatable(opts or {}, { __index = require('hop').opts })
|
||||||
|
|
||||||
|
local gen = require('hop.jump_target').jump_targets_by_scanning_lines
|
||||||
|
require('hop').hint_with(gen(regexLines()), opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in New Issue
Block a user