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

Add key binding SPC p F (#4309)

This commit is contained in:
Wang Shidong 2021-07-03 21:53:20 +08:00 committed by GitHub
parent 5b7535bf80
commit ca70bd8eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 59 deletions

View File

@ -270,6 +270,18 @@ function! SpaceVim#layers#leaderf#config() abort
\ ], \ ],
\ 1) \ 1)
let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['p', 'F'],
\ 'LeaderfFileCword',
\ ['find cursor file in current project',
\ [
\ '[SPC p F] is to find cursor file in the root of the current project',
\ '',
\ 'Definition: ' . s:filename . ':' . lnum,
\ ]
\ ],
\ 1)
let lnum = expand('<slnum>') + s:lnum - 1 let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'], call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
\ 'Leaderf file --fullPath ' \ 'Leaderf file --fullPath '

View File

@ -1888,12 +1888,13 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的
#### 在工程中搜索文件 #### 在工程中搜索文件
| 快捷键 | 功能描述 | | 快捷键 | 功能描述 |
| --------- | ------------------------ | | --------- | ---------------------------- |
| `SPC p f` | 在当前工程中查找文件 | | `SPC p f` | 在当前工程中查找文件 |
| `SPC p /` | 在当前工程中搜索文本内容 | | `SPC p F` | 在当前工程中查找光标下的文件 |
| `SPC p k` | 关闭当前工程的所有缓冲区 | | `SPC p /` | 在当前工程中搜索文本内容 |
| `SPC p p` | 显示所有工程 | | `SPC p k` | 关闭当前工程的所有缓冲区 |
| `SPC p p` | 显示所有工程 |
`SPC p p` 将会列出最近使用的项目清单,默认会显示最多 20 个, `SPC p p` 将会列出最近使用的项目清单,默认会显示最多 20 个,
这一数量可以使用 `projects_cache_num` 来修改。 这一数量可以使用 `projects_cache_num` 来修改。

View File

@ -491,10 +491,10 @@ the variable `colorscheme`. For instance, to specify `desert`:
colorscheme_bg = "dark" colorscheme_bg = "dark"
``` ```
| Mappings | Descriptions | | Mappings | Descriptions |
| --------- | ---------------------------------------------------------------------------------------- | | --------- | ------------------------------------------------------------------------------------- |
| `SPC T n` | switch to a random colorscheme listed in [colorscheme layer](../layers/colorscheme/). | | `SPC T n` | switch to a random colorscheme listed in [colorscheme layer](../layers/colorscheme/). |
| `SPC T s` | select a theme using a [fuzzy finder](#fuzzy-finder). | | `SPC T s` | select a theme using a [fuzzy finder](#fuzzy-finder). |
All the included colorschemes can be found in [colorscheme layer](../layers/colorscheme/). All the included colorschemes can be found in [colorscheme layer](../layers/colorscheme/).
@ -670,8 +670,8 @@ Unicode symbols are displayed by default. Add `statusline_unicode_symbols = fals
The letters displayed in the statusline correspond to the key bindings used to toggle them. The letters displayed in the statusline correspond to the key bindings used to toggle them.
| Key Bindings | Unicode | ASCII | Mode | | Key Bindings | Unicode | ASCII | Mode |
| ------------ | ------- | ----- | ------------------------------------------------ | | ------------ | ------- | ----- | ----------------------------------------------- |
| `SPC t 8` | ⑧ | 8 | toggle character highlighting for long lines | | `SPC t 8` | ⑧ | 8 | toggle character highlighting for long lines |
| `SPC t f` | ⓕ | f | fill-column-indicator mode | | `SPC t f` | ⓕ | f | fill-column-indicator mode |
| `SPC t s` | ⓢ | s | syntax checking (neomake) | | `SPC t s` | ⓢ | s | syntax checking (neomake) |
@ -875,9 +875,9 @@ Navigation is centered on the `hjkl` keys with the hope of providing a fast navi
If only one file buffer is opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. If only one file buffer is opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file.
| Key Bindings | Descriptions | | Key Bindings | Descriptions |
| --------------- | ----------------------------------------- | | --------------- | ---------------------------------------- |
| `l` / `<Enter>` | open file in one window | | `l` / `<Enter>` | open file in one window |
| `s g` | open file in a vertically split window | | `s g` | open file in a vertically split window |
| `s v` | open file in a horizontally split window | | `s v` | open file in a horizontally split window |
@ -1062,7 +1062,7 @@ Text related commands (start with `x`):
| `SPC x g T` | reverse source and target languages (TODO) | | `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 `lowerCamelCase` |
| `SPC x i C` | change symbol style to `UpperCamelCase` | | `SPC x i C` | change symbol style to `UpperCamelCase` |
| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | | `SPC x i i` | cycle symbol naming styles (i to keep cycling) |
| `SPC x i -` | change symbol style to `kebab-case` | | `SPC x i -` | change symbol style to `kebab-case` |
| `SPC x i k` | 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 _` | change symbol style to `under_score` |
@ -1127,8 +1127,8 @@ Key bindings available in visual mode:
#### Increase/Decrease numbers #### Increase/Decrease numbers
| Key Bindings | Descriptions | | Key Bindings | Descriptions |
| ------------ | ------------------------------------------------------------------- | | ------------ | ------------------------------------------------------------------------ |
| `SPC n +` | increase the number under the cursor by one and initiate transient state | | `SPC n +` | increase the number under the cursor by one and initiate transient state |
| `SPC n -` | decrease the number under the cursor by one and initiate transient state | | `SPC n -` | decrease the number under the cursor by one and initiate transient state |
@ -1426,7 +1426,6 @@ It is `[]` by default.
The first item is the name of the tool, the second one is the default searching command. The first item is the name of the tool, the second one is the default searching command.
#### Vim and SpaceVim files #### Vim and SpaceVim files
Convenient key bindings are located under the prefix `SPC f v` to quickly navigate between Vim and SpaceVim specific files. Convenient key bindings are located under the prefix `SPC f v` to quickly navigate between Vim and SpaceVim specific files.
@ -1618,14 +1617,14 @@ The following table summurizes the search key bindings:
With `<scope>` being one of the following: With `<scope>` being one of the following:
| Scope | Description | | Scope | Description |
| ------- | -------------------------------- | | ----- | -------------------------------- |
| `b` | All open buffers | | `b` | All open buffers |
| `d` | Current buffer's directory | | `d` | Current buffer's directory |
| `f` | Arbitrary directory | | `f` | Arbitrary directory |
| `p` | Current project | | `p` | Current project |
| `s` | Current buffer | | `s` | Current buffer |
| `j` | Background search in the project | | `j` | Background search in the project |
**Notes**: **Notes**:
@ -1903,6 +1902,7 @@ Project manager commands start with `p`:
| Key Bindings | Descriptions | | Key Bindings | Descriptions |
| ------------ | ---------------------------------------- | | ------------ | ---------------------------------------- |
| `SPC p f` | find files in current project | | `SPC p f` | find files in current project |
| `SPC p F` | find cursor file in current project |
| `SPC p /` | fuzzy search for text in current project | | `SPC p /` | fuzzy search for text in current project |
| `SPC p k` | kill all buffers of current project | | `SPC p k` | kill all buffers of current project |
| `SPC p p` | list all projects | | `SPC p p` | list all projects |
@ -2031,33 +2031,33 @@ To run the task in the background, you need to set `isBackground` to `true`:
The following task properties are available: The following task properties are available:
| Name | Description | | Name | Description |
| -------------- | ------------------------------------------------------------------------------------------------------ | | -------------- | --------------------------------------------------------------------------------------- |
| command | The actual command to execute. | | command | The actual command to execute. |
| args | The arguments passed to the command, it should be a list of strings and may be omitted. | | args | The arguments passed to the command, it should be a list of strings and may be omitted. |
| options | Override the defaults for `cwd`,`env` or `shell`. | | options | Override the defaults for `cwd`,`env` or `shell`. |
| isBackground | Specifies whether the task should run in the background. by default, it is `false`. | | isBackground | Specifies whether the task should run in the background. by default, it is `false`. |
| description | Short description of the task | | description | Short description of the task |
| problemMatcher | Problems matcher of the task | | problemMatcher | Problems matcher of the task |
**Note**: When a new task is executed, it will kill the previous task. If you want to keep the task, **Note**: When a new task is executed, it will kill the previous task. If you want to keep the task,
run it in background by setting `isBackground` to `true`. run it in background by setting `isBackground` to `true`.
SpaceVim supports variable substitution in the task properties, The following predefined variables are supported: SpaceVim supports variable substitution in the task properties, The following predefined variables are supported:
| Name | Description | | Name | Description |
| -------------------------- | ------------------------------------------------------ | | --------------------------- | ------------------------------------------------------ |
| ${workspaceFolder} | The project's root directory | | \${workspaceFolder} | The project's root directory |
| ${workspaceFolderBasename} | The name of current project's root directory | | \${workspaceFolderBasename} | The name of current project's root directory |
| ${file} | The path of current file | | \${file} | The path of current file |
| ${relativeFile} | The current file relative to project root | | \${relativeFile} | The current file relative to project root |
| ${relativeFileDirname} | The current file's dirname relative to workspaceFolder | | \${relativeFileDirname} | The current file's dirname relative to workspaceFolder |
| ${fileBasename} | The current file's basename | | \${fileBasename} | The current file's basename |
| ${fileBasenameNoExtension} | The current file's basename without file extension | | \${fileBasenameNoExtension} | The current file's basename without file extension |
| ${fileDirname} | The current file's dirname | | \${fileDirname} | The current file's dirname |
| ${fileExtname} | The current file's extension | | \${fileExtname} | The current file's extension |
| ${cwd} | The task runner's current working directory on startup | | \${cwd} | The task runner's current working directory on startup |
| ${lineNumber} | The current selected line number in the active file | | \${lineNumber} | The current selected line number in the active file |
For example: Supposing that you have the following requirements: For example: Supposing that you have the following requirements:
@ -2065,18 +2065,18 @@ A file located at `/home/your-username/your-project/folder/file.ext` opened in y
The directory `/home/your-username/your-project` opened as your root workspace. The directory `/home/your-username/your-project` opened as your root workspace.
So you will have the following values for each variable: So you will have the following values for each variable:
| Name | Value | | Name | Value |
| -------------------------- | -------------------------------------------------- | | --------------------------- | -------------------------------------------------- |
| ${workspaceFolder} | `/home/your-username/your-project/` | | \${workspaceFolder} | `/home/your-username/your-project/` |
| ${workspaceFolderBasename} | `your-project` | | \${workspaceFolderBasename} | `your-project` |
| ${file} | `/home/your-username/your-project/folder/file.ext` | | \${file} | `/home/your-username/your-project/folder/file.ext` |
| ${relativeFile} | `folder/file.ext` | | \${relativeFile} | `folder/file.ext` |
| ${relativeFileDirname} | `folder/` | | \${relativeFileDirname} | `folder/` |
| ${fileBasename} | `file.ext` | | \${fileBasename} | `file.ext` |
| ${fileBasenameNoExtension} | `file` | | \${fileBasenameNoExtension} | `file` |
| ${fileDirname} | `/home/your-username/your-project/folder/` | | \${fileDirname} | `/home/your-username/your-project/folder/` |
| ${fileExtname} | `.ext` | | \${fileExtname} | `.ext` |
| ${lineNumber} | line number of the cursor | | \${lineNumber} | line number of the cursor |
#### Task Problems Matcher #### Task Problems Matcher