1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 11:20:06 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Eric Wong
0d66e31934 feat(git): update git-tag completion 2024-12-21 19:53:38 +08:00
Eric Wong
9584d22101 feat(markdown): add SPC l f to format code block 2024-12-21 16:33:22 +08:00
5 changed files with 27 additions and 8 deletions

View File

@ -152,7 +152,11 @@ function! s:mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'],
\ 'call call('
\ . string(function('s:run_code_in_block'))
\ . ', [])', 'run code in block', 1)
\ . ', [])', 'run-code-bl', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'f'],
\ 'call call('
\ . string(function('s:format_code_block'))
\ . ', [])', 'format-code-block', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','c'], 'GenTocGFM', 'create content at cursor', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','C'], 'RemoveToc', 'remove content', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','u'], 'UpdateToc', 'update content', 1)
@ -236,6 +240,15 @@ function! s:run_code_in_block() abort
endif
endfunction
function! s:format_code_block() abort
let cf = context_filetype#get()
if cf.filetype !=# 'markdown'
let command = printf('%s,%sFormat! %s', cf.range[0][0], cf.range[1][0], cf.filetype)
exe command
endif
endfunction
function! SpaceVim#layers#lang#markdown#health() abort
call SpaceVim#layers#lang#markdown#plugins()

View File

@ -38,9 +38,9 @@ require('format').setup({
lua = {
exe = 'stylua',
args = { '-' },
stdin = true
stdin = true,
},
},
}
})
```

View File

@ -72,12 +72,16 @@ function M.run(argv)
end
end
local function get_all_tags()
return vim.fn.systemlist('git tag')
end
function M.complete(ArgLead, CmdLine, CursorPos)
local str = string.sub(CmdLine, 1, CursorPos)
if vim.regex([[^Git\s\+tag\s\+-\+$]]):match_str(str) then
return table.concat({'--list'}, '\n')
return table.concat({'--list', '-l', '-m', '-a', '-d'}, '\n')
else
return ''
return table.concat(get_all_tags(), '\n')
end
end

View File

@ -99,7 +99,8 @@ npm install --global prettier
| `SPC l C` | Normal/Visual | 删除目录 |
| `SPC l k` | Normal/Visual | 为光标下的单词或者选中文本增加 URL 链接 |
| `SPC l K` | Normal/Visual | 为光标下的单词或者选中文本增加图片链接 |
| `SPC l r` | Normal/Visual | 运行区块中的代码 |
| `SPC l r` | Normal/Visual | 运行 Markdown 中当前代码块 |
| `SPC l f` | Normal/Visual | 格式化 Markdown 中当前代码块 |
| `SPC l u` | Normal/Visual | 更新目录 |
| `SPC l p` | Normal | 通过浏览器实时预览当前文件 |
| `SPC l t` | Normal | 切换待办事项状态 |

View File

@ -99,7 +99,8 @@ If you don't want to install php, you can use [mdctags](https://github.com/wsdje
| `SPC l C` | Normal/Visual | Remove content |
| `SPC l k` | Normal/Visual | Add URL link for word under cursor or slected word |
| `SPC l K` | Normal/Visual | Add picture link for word under cursor or slected word |
| `SPC l r` | Normal/Visual | Run code in block |
| `SPC l r` | Normal/Visual | Run code block |
| `SPC l f` | Normal/Visual | Format code block |
| `SPC l u` | Normal/Visual | Update content |
| `SPC l p` | Normal | Real-time markdown preview |
| `SPC l t` | Normal | toggle todo status |