mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 21:19:09 +08:00
Add SPC x l key binding group (#4182)
This commit is contained in:
parent
a1909e1b69
commit
5268e5210a
@ -13,6 +13,7 @@ let s:NUMBER = SpaceVim#api#import('data#number')
|
||||
let s:LIST = SpaceVim#api#import('data#list')
|
||||
let s:VIM = SpaceVim#api#import('vim')
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
||||
|
||||
function! SpaceVim#layers#edit#plugins() abort
|
||||
let plugins = [
|
||||
@ -158,6 +159,23 @@ function! SpaceVim#layers#edit#config() abort
|
||||
\ . string(s:_function('s:join_string_with')) . ', [])',
|
||||
\ 'join-string-with', 1)
|
||||
|
||||
" line
|
||||
let g:_spacevim_mappings_space.x.l = {'name' : '+Line'}
|
||||
nnoremap <silent> <Plug>DuplicateLines :call <SID>duplicate_lines(0)<Cr>
|
||||
vnoremap <silent> <Plug>DuplicateLines :call <SID>duplicate_lines(1)<Cr>
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'l', 'd'], '<Plug>DuplicateLines',
|
||||
\ 'duplicate-line-or-region', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap' , ['x' , 'l' , 's'] , 'sort i' , 'sort lines (ignorecase)' , 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap' , ['x' , 'l' , 'S'] , 'sort' , 'sort lines (case-sensitive)' , 1)
|
||||
nnoremap <silent> <Plug>UniquifyIgnoreCaseLines :call <SID>uniquify_lines(0, 1)<Cr>
|
||||
vnoremap <silent> <Plug>UniquifyIgnoreCaseLines :call <SID>uniquify_lines(1, 1)<Cr>
|
||||
nnoremap <silent> <Plug>UniquifyCaseSenstiveLines :call <SID>uniquify_lines(0, 0)<Cr>
|
||||
vnoremap <silent> <Plug>UniquifyCaseSenstiveLines :call <SID>uniquify_lines(1, 0)<Cr>
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'l', 'u'], '<Plug>UniquifyIgnoreCaseLines',
|
||||
\ 'uniquify-lines (ignorecase)', 0, 1)
|
||||
call SpaceVim#mapping#space#def('nmap', ['x', 'l', 'U'], '<Plug>UniquifyCaseSenstiveLines',
|
||||
\ 'uniquify-lines (case-senstive)', 0, 1)
|
||||
|
||||
let g:_spacevim_mappings_space.i = {'name' : '+Insertion'}
|
||||
let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'}
|
||||
let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'}
|
||||
@ -586,6 +604,33 @@ function! s:insert_simple_password() abort
|
||||
normal! "kPl
|
||||
let @k = save_register
|
||||
endfunction
|
||||
|
||||
function! s:duplicate_lines(visual) abort
|
||||
if a:visual
|
||||
call setline('.', getline("'<"))
|
||||
else
|
||||
call setline('.', getline(line('.') - 1))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:uniquify_lines(visual, ignorecase) abort
|
||||
if a:visual
|
||||
let start_line = line("'<")
|
||||
let end_line = line("'>")
|
||||
let rst = []
|
||||
for l in range(start_line, end_line)
|
||||
if index(rst, getline(l)) ==# -1
|
||||
call add(rst, getline(l))
|
||||
endif
|
||||
endfor
|
||||
call s:BUFFER.buf_set_lines(bufnr('.'), start_line-1 , end_line, 0, rst)
|
||||
else
|
||||
if line('.') > 1 && getline('.') ==# getline(line('.') - 1)
|
||||
normal! dd
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:insert_stronger_password() abort
|
||||
let save_register = @k
|
||||
let @k = s:PASSWORD.generate_strong(v:count ? v:count : 12)
|
||||
|
@ -988,9 +988,11 @@ call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test cu
|
||||
| `SPC x j r` | 右对齐当前段落 |
|
||||
| `SPC x J` | 将当前行向下移动一行并进入临时快捷键状态 |
|
||||
| `SPC x K` | 将当前行向上移动一行并进入临时快捷键状态 |
|
||||
| `SPC x l d` | duplicate line or region (TODO) |
|
||||
| `SPC x l s` | sort lines (TODO) |
|
||||
| `SPC x l u` | uniquify lines (TODO) |
|
||||
| `SPC x l d` | 重复当前行或区域 |
|
||||
| `SPC x l s` | 排序多行文档 (忽略大小写) |
|
||||
| `SPC x l S` | 排序多行文档 (大小写敏感) |
|
||||
| `SPC x l u` | 去除重复的行 (忽略大小写) |
|
||||
| `SPC x l U` | 去除重复的行 (大小写敏感) |
|
||||
| `SPC x o` | use avy to select a link in the frame and open it (TODO) |
|
||||
| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) |
|
||||
| `SPC x t c` | 交换当前字符和前一个字符的位置 |
|
||||
@ -1287,7 +1289,7 @@ SpaceVim 选项 `window_leader` 的值来设为其它按键:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| -------------------- | ------------------------------------------------------ |
|
||||
| `SPC f /` | 使用 `find` 或者 `fd` 命令查找文件,支持参数提示 |
|
||||
| `SPC f /` | 使用 `find` 或者 `fd` 命令查找文件,支持参数提示 |
|
||||
| `SPC f b` | 跳至文件书签 |
|
||||
| `SPC f c` | copy current file to a different location(TODO) |
|
||||
| `SPC f C d` | 修改文件编码 unix -> dos |
|
||||
@ -1313,7 +1315,6 @@ SpaceVim 选项 `window_leader` 的值来设为其它按键:
|
||||
如果是使用 [scoop](https://github.com/lukesampson/scoop) 安装的这些工具,系统默认的 `C:\WINDOWS\system32` 中的命令会覆盖掉用户定义的 `$PATH`,
|
||||
解决方案是将 scoop 默认的可执行文件所在的文件夹放置在系统环境变量 `$PATH` 内 `C:\WINDOWS\system32` 的前方。
|
||||
|
||||
|
||||
按下 `SPC f /` 快捷键之后,会弹出搜索输入窗口,输入内容后回车,异步执行 `find` 或者 `fd` 命令,
|
||||
默认使用的是 `find` 命令,可以使用快捷键 `ctrl-e` 在不同工具之间切换。
|
||||
|
||||
|
@ -11,8 +11,6 @@ lang: zh
|
||||
- [模块简介](#模块简介)
|
||||
- [功能特性](#功能特性)
|
||||
- [模块选项](#模块选项)
|
||||
- [快捷键](#快捷键)
|
||||
- [多光标支持](#多光标支持)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -34,46 +32,3 @@ lang: zh
|
||||
## 模块选项
|
||||
|
||||
- `textobj`: specified a list of text opjects to be enabled, the avaliable list is: `indent`, `line`, `entire`
|
||||
|
||||
## 快捷键
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ------------------ | ---------------------- |
|
||||
| `SPC x a {分隔符}` | 基于分隔符进行文本对齐 |
|
||||
|
||||
默认的分隔符:
|
||||
|
||||
- `=`: 对齐 `===`, `==`, `!=`, `>=` 等
|
||||
- `&`: 对齐 `&`
|
||||
- `¦`: 对齐 `¦`
|
||||
- `|`: 对齐 `|`
|
||||
- `;`: 对齐 `;`
|
||||
- `:`: 对齐 `:`
|
||||
- `,`: 对齐 `,`
|
||||
- `.`: 对齐 `.`
|
||||
- `[`: 对齐 `[`
|
||||
- `(`: 对齐 `(`
|
||||
- `{`: 对齐 `{`
|
||||
- `]`: 对齐 `]`
|
||||
- `}`: 对齐 `}`
|
||||
- `)`: 对齐 `)`
|
||||
- `[SPC]`: 对齐 `[SPC]`
|
||||
- `o`: 对齐 `+ - * / % ^` 等
|
||||
- `r`: 对齐用户输入的正则表达式
|
||||
|
||||
### 多光标支持
|
||||
|
||||
在 Visual 模式下可使用 Ctrl+n 按键选择下一个匹配位置。此时文档中所有匹配项都会被高亮,选中的匹配位置会有特殊高亮。
|
||||
可使用 Ctrl+x 按键跳过当前位置。
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ----------- | ------------------------------------ |
|
||||
| `SPC x j c` | 居中对齐当前段落 |
|
||||
| `SPC x j f` | set the justification to full (TODO) |
|
||||
| `SPC x j l` | 左对齐当前段落 |
|
||||
| `SPC x j n` | set the justification to none (TODO) |
|
||||
| `SPC x j r` | 右对齐当前段落 |
|
||||
| `SPC x u` | 将选中字符串转为小写 |
|
||||
| `SPC x U` | 将选中字符串转为大写 |
|
||||
| `SPC x w c` | 统计选中区域的单词数 |
|
||||
|
||||
|
@ -288,7 +288,6 @@ You can also use the url of the repository, for example:
|
||||
merged = false
|
||||
```
|
||||
|
||||
|
||||
`on_cmd` option means this plugin will be loaded only when the following commands are called.
|
||||
|
||||
`merged` option is used for merging plugins directory. When `merged` is `true`, all files in
|
||||
@ -1062,9 +1061,11 @@ Text related commands (start with `x`):
|
||||
| `SPC x j r` | set the justification to right |
|
||||
| `SPC x J` | move down a line of text (enter transient state) |
|
||||
| `SPC x K` | move up a line of text (enter transient state) |
|
||||
| `SPC x l d` | duplicate line or region (TODO) |
|
||||
| `SPC x l s` | sort lines (TODO) |
|
||||
| `SPC x l u` | uniquify lines (TODO) |
|
||||
| `SPC x l d` | duplicate line or region |
|
||||
| `SPC x l s` | sort lines (ignorecase) |
|
||||
| `SPC x l S` | sort lines (case-senstive) |
|
||||
| `SPC x l u` | uniquify lines (ignorecase) |
|
||||
| `SPC x l U` | uniquify lines (case-senstive) |
|
||||
| `SPC x o` | use avy to select a link in the frame and open it (TODO) |
|
||||
| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) |
|
||||
| `SPC x t c` | swap (transpose) the current character with the previous one |
|
||||
@ -2076,7 +2077,7 @@ The task's properties have the following semantic:
|
||||
- **isBackground**: `true` or `false`, specifies whether background running is required,
|
||||
by default, it is `false`.
|
||||
- **description**: short description of the task
|
||||
- **problemMatcher**: problems matcher of the task
|
||||
- **problemMatcher**: problems matcher of the task
|
||||
|
||||
When start a new task, it will kill the previous task. If you want to keep the task
|
||||
run in background, set `isBackground` to `true`.
|
||||
@ -2114,7 +2115,7 @@ So you will have the following values for each variable:
|
||||
|
||||
#### Task Problems Matcher
|
||||
|
||||
Problem matcher is used to capture the message in the task output
|
||||
Problem matcher is used to capture the message in the task output
|
||||
and show a corresponding problem in quickfix windows.
|
||||
|
||||
`problemMatcher` supports `errorformat` and `pattern` property.
|
||||
|
@ -10,7 +10,6 @@ description: "Improve code edit expr in SpaceVim, provide more text objects."
|
||||
- [Description](#description)
|
||||
- [Features](#features)
|
||||
- [Options](#options)
|
||||
- [Key bindings](#key-bindings)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -31,40 +30,3 @@ This layer provides many edit key bindings for SpaceVim, and also provides more
|
||||
## Options
|
||||
|
||||
- `textobj`: specified a list of text objects to be enabled, the avaliable list is :`indent`, `line`, `entire`
|
||||
|
||||
## Key bindings
|
||||
|
||||
| Key bindings | Descraptions |
|
||||
| --------------------- | -------------------------------- |
|
||||
| `SPC x a {delimiter}` | align content based on delimiter |
|
||||
|
||||
**default delimiters**
|
||||
|
||||
- `=`: align `===`, `==`, `!=`, `>=` etc.
|
||||
- `&`: align `&`
|
||||
- `¦`: align `¦`
|
||||
- `|`: align `|`
|
||||
- `;`: align `;`
|
||||
- `:`: align `:`
|
||||
- `,`: align `,`
|
||||
- `.`: align `.`
|
||||
- `[`: align `[`
|
||||
- `(`: align `(`
|
||||
- `{`: align `{`
|
||||
- `]`: align `]`
|
||||
- `}`: align `}`
|
||||
- `)`: align `)`
|
||||
- `[SPC]`: align `[SPC]`
|
||||
- `o`: align `+ - * / % ^` etc.
|
||||
- `r`: align user specified regular expression.
|
||||
|
||||
| Key bindings | Descraptions |
|
||||
| ------------ | ------------------------------------ |
|
||||
| `SPC x j c` | set the justification to center |
|
||||
| `SPC x j f` | set the justification to full (TODO) |
|
||||
| `SPC x j l` | set the justification to left |
|
||||
| `SPC x j n` | set the justification to none (TODO) |
|
||||
| `SPC x j r` | set the justification to right |
|
||||
| `SPC x u` | set the selected text to lower case |
|
||||
| `SPC x U` | set the selected text to upper case |
|
||||
| `SPC x w c` | count the words in the select region |
|
||||
|
Loading…
x
Reference in New Issue
Block a user