mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-14 02:35:41 +08:00
Fix visual mode code format (#3866)
This commit is contained in:
parent
3f28bf4b87
commit
e41ffa575f
@ -12,8 +12,14 @@
|
|||||||
" format layer provides code formation for SpaceVim, the default formatting
|
" format layer provides code formation for SpaceVim, the default formatting
|
||||||
" plugin is |neoformat|.
|
" plugin is |neoformat|.
|
||||||
" @subsection options
|
" @subsection options
|
||||||
" format_on_save: disabled by default.
|
|
||||||
"
|
"
|
||||||
|
" `format_on_save`: disabled by default.
|
||||||
|
"
|
||||||
|
" @subsection key bindings
|
||||||
|
" >
|
||||||
|
" Key binding Description
|
||||||
|
" SPC b f format current buffer or selection lines
|
||||||
|
" <
|
||||||
"
|
"
|
||||||
|
|
||||||
if exists('s:format_on_save')
|
if exists('s:format_on_save')
|
||||||
@ -30,7 +36,7 @@ function! SpaceVim#layers#format#plugins() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#format#config() abort
|
function! SpaceVim#layers#format#config() abort
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Neoformat', 'format-code', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], ":Neoformat\<Enter>", 'format-code', 0, 1)
|
||||||
augroup spacevim_layer_format
|
augroup spacevim_layer_format
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePre * call s:format()
|
autocmd BufWritePre * call s:format()
|
||||||
|
@ -1452,8 +1452,15 @@ FORMAT *SpaceVim-layer-format*
|
|||||||
format layer provides code formation for SpaceVim, the default formatting
|
format layer provides code formation for SpaceVim, the default formatting
|
||||||
plugin is |neoformat|.
|
plugin is |neoformat|.
|
||||||
OPTIONS
|
OPTIONS
|
||||||
format_on_save: disabled by default.
|
|
||||||
|
|
||||||
|
`format_on_save`: disabled by default.
|
||||||
|
|
||||||
|
KEY BINDINGS
|
||||||
|
|
||||||
|
>
|
||||||
|
Key binding Description
|
||||||
|
SPC b f format current buffer or selection lines
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -6,7 +6,6 @@ lang: zh
|
|||||||
|
|
||||||
# [可用模块](../) >> format
|
# [可用模块](../) >> format
|
||||||
|
|
||||||
|
|
||||||
<!-- vim-markdown-toc GFM -->
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
- [模块简介](#模块简介)
|
- [模块简介](#模块简介)
|
||||||
@ -14,6 +13,7 @@ lang: zh
|
|||||||
- [模块设置](#模块设置)
|
- [模块设置](#模块设置)
|
||||||
- [模块选项](#模块选项)
|
- [模块选项](#模块选项)
|
||||||
- [全局选项](#全局选项)
|
- [全局选项](#全局选项)
|
||||||
|
- [快捷键](#快捷键)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
@ -60,11 +60,9 @@ lang: zh
|
|||||||
|
|
||||||
### 全局选项
|
### 全局选项
|
||||||
|
|
||||||
neoformat 是一个格式化框架插件,该插件的所有自身选项可以在启动函数中进行设置,可以预读 `:help neoformat`
|
`neoformat` 是一个格式化框架插件,该插件的所有自身选项可以在启动函数中进行设置,可以预读 `:help neoformat`
|
||||||
获取完整帮助。
|
获取完整帮助。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
以下是一个为 Java 文件设置格式化命令的配置,以下配置已经包含在 `lang#java` 模块内了:
|
以下是一个为 Java 文件设置格式化命令的配置,以下配置已经包含在 `lang#java` 模块内了:
|
||||||
|
|
||||||
```viml
|
```viml
|
||||||
@ -75,3 +73,9 @@ let g:neoformat_java_googlefmt = {
|
|||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 快捷键
|
||||||
|
|
||||||
|
| 快捷键 | 功能描述 |
|
||||||
|
| --------- | -------------------------- |
|
||||||
|
| `SPC b f` | 格式化当前文件或者选中内容 |
|
||||||
|
@ -12,6 +12,7 @@ description: "Code formatting layer for SpaceVim, includes a variety of formatte
|
|||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Layer options](#layer-options)
|
- [Layer options](#layer-options)
|
||||||
- [Global options](#global-options)
|
- [Global options](#global-options)
|
||||||
|
- [Key bindings](#key-bindings)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
@ -72,3 +73,9 @@ let g:neoformat_java_googlefmt = {
|
|||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Key bindings
|
||||||
|
|
||||||
|
| Key binding | Description |
|
||||||
|
| ----------- | ------------------------------------- |
|
||||||
|
| `SPC b f` | format whole buffer or selected lines |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user