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

fix(chinese): change chineselinter key binding

This commit is contained in:
Eric Wong 2023-07-02 18:57:09 +08:00 committed by GitHub
parent 8f8c0838ff
commit c9cd11ff21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 68 deletions

View File

@ -40,9 +40,11 @@ function! SpaceVim#layers#chinese#plugins() abort
endfunction
function! SpaceVim#layers#chinese#config() abort
let g:_spacevim_mappings_space.x.g = {'name' : '+translate'}
call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Translate' , 'translate current word' , 1)
call SpaceVim#mapping#space#def('nnoremap', ['l', 'c'] , 'CheckChinese', 'Check with ChineseLinter', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 't'], 'Translate' , 'translate-current-word' , 1)
if !SpaceVim#layers#isLoaded('edit')
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'}
call SpaceVim#mapping#space#def('nmap', ['n', 'c', 'd'], '<Plug>ConvertChineseNumberToDigit', 'convert Chinese number to digit', 0, 1)
" do not load vimcdoc plugin

View File

@ -353,7 +353,7 @@ function! SpaceVim#layers#edit#config() abort
\ 'move-text-up(enter-transient-state)', 1)
" 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('
\ . string(s:_function('s:transpose_with_previous')) . ', ["character"])',
\ 'swap-current-character-with-previous-one', 1)
@ -405,33 +405,8 @@ function! SpaceVim#layers#edit#config() abort
endfunction
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
lua hintLines()
lua require('spacevim.plugin.hop').hintLines()
endfunction
else
function! s:jump_to_url() abort

View 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