From b1ebe04d44a198b22e67cb97c22483bceded7350 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 19 Jul 2017 07:09:41 +0800 Subject: [PATCH] Add SPC x c --- autoload/SpaceVim/layers/edit.vim | 9 +++++++++ docs/documentation.md | 30 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 2e5b08f45..26dc16b6d 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -47,6 +47,9 @@ function! SpaceVim#layers#edit#config() abort let g:_spacevim_mappings_space.x.a = {'name' : '+align'} let g:_spacevim_mappings_space.x.d = {'name' : '+delete'} let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'} + nnoremap CountSelectionRegion :call count_selection_region() + xnoremap CountSelectionRegion :call count_selection_region() + call SpaceVim#mapping#space#def('nmap', ['x', 'c'], 'CountSelectionRegion', 'cunt in the selection region', 0, 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1) @@ -119,6 +122,8 @@ function! SpaceVim#layers#edit#config() abort call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call(' \ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])', \ 'insert lorem-ipsum sentence', 1) + let g:_spacevim_mappings_space.x.g = {'name' : '+translate'} + call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1) endfunction function! s:lowerCamelCase() abort @@ -232,6 +237,10 @@ function! s:parse_symbol(symbol) abort endif endfunction +function! s:count_selection_region() abort + call feedkeys("gvg\\", 'ti') +endfunction + function! s:delete_extra_space() abort if !empty(getline('.')) diff --git a/docs/documentation.md b/docs/documentation.md index 09e04bba2..e9f047076 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1180,26 +1180,26 @@ Key Binding | Description `SPC x a ;` | align region at ; `SPC x a =` | align region at = `SPC x a ¦` | align region at ¦ -`SPC x a a` | align region (or guessed section) using default rules -`SPC x a c` | align current indentation region using default rules -`SPC x a l` | left-align with evil-lion -`SPC x a L` | right-align with evil-lion -`SPC x a r` | align region using user-specified regexp -`SPC x a m` | align region at arithmetic operators `` (+-*/) `` +`SPC x a a` | align region (or guessed section) using default rules (TODO) +`SPC x a c` | align current indentation region using default rules (TODO) +`SPC x a l` | left-align with evil-lion (TODO) +`SPC x a L` | right-align with evil-lion (TODO) +`SPC x a r` | align region using user-specified regexp (TODO) +`SPC x a m` | align region at arithmetic operators `` (+-*/) `` (TODO) `SPC x c` | cunt the number of chars/words/lines in the selection region `SPC x d w` | delete trailing whitespaces `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space -`SPC x g l` | set languages used by translate commands +`SPC x g l` | set languages used by translate commands (TODO) `SPC x g t` | translate current word using Google Translate -`SPC x g T` | reverse source and target languages -`SPC x i c` | change symbol style to lowerCamelCase -`SPC x i C` | change symbol style to UpperCamelCase +`SPC x g T` | reverse source and target languages (TODO) +`SPC x i c` | change symbol style to `lowerCamelCase` +`SPC x i C` | change symbol style to `UpperCamelCase` `SPC x i i` | cycle symbol naming styles (i to keep cycling) -`SPC x i -` | change symbol style to kebab-case -`SPC x i k` | change symbol style to kebab-case -`SPC x i _` | change symbol style to under_score -`SPC x i u` | change symbol style to under_score -`SPC x i U` | change symbol style to UP_CASE +`SPC x i -` | change symbol style to `kebab-case` +`SPC x i k` | change symbol style to `kebab-case` +`SPC x i _` | change symbol style to `under_score` +`SPC x i u` | change symbol style to `under_score` +`SPC x i U` | change symbol style to `UP_CASE` `SPC x j c` | set the justification to center `SPC x j f` | set the justification to full `SPC x j l` | set the justification to left