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

develop verson (#502)

* Remove black line

* Test menu

* Test menu

* remove teble title

* Update guide doc

* Add paging help info

* Add pic for unite mapping

* Add help mappings doc

* Add SPC h I: report issue of SpaceVim

* Add SPC h SPC for unite SpaceVim help

* Add doc for get root prefix

* Fix error of guide

* Fix SPC h k mappings

* Add denite group to mapping root

* Add SPC h m mappings
This commit is contained in:
Wang Shidong 2017-05-07 23:33:03 +08:00 committed by GitHub
parent cdc903627b
commit b03ca97e13
8 changed files with 140 additions and 30 deletions

View File

@ -430,12 +430,13 @@ function! SpaceVim#end() abort
if !empty(g:spacevim_denite_leader)
call SpaceVim#mapping#leader#defindDeniteLeader(g:spacevim_denite_leader)
endif
call SpaceVim#mapping#leader#defindglobalMappings()
call SpaceVim#mapping#leader#defindKEYs()
call SpaceVim#mapping#space#init()
if !SpaceVim#mapping#guide#has_configuration()
let g:leaderGuide_map = {}
call SpaceVim#mapping#guide#register_prefix_descriptions('', 'g:leaderGuide_map')
endif
call SpaceVim#mapping#leader#defindglobalMappings()
call SpaceVim#mapping#space#init()
if g:spacevim_simple_mode
let g:spacevim_plugin_groups = ['core']
else

View File

@ -0,0 +1,33 @@
function! SpaceVim#issue#report() abort
call s:open()
endfunction
function! s:open() abort
exe 'tabnew ' . tempname() . '/issue_report.md'
call setline(1, s:template())
w
endfunction
function! s:template() abort
let info = [
\ '<!-- please remove the issue template when request for a feature -->',
\ '## Expected behavior, english is recommend',
\ '',
\ '## Environment Information',
\ '',
\ '- OS:' . SpaceVim#api#import('system').name(),
\ '- vim version:' . (has('nvim') ? '' : v:version),
\ '- neovim version:' . (has('nvim') ? v:version : ''),
\ '',
\ '## The reproduce ways from Vim starting (Required!)',
\ '',
\ '## Output of the `:SPDebugInfo!`',
\ '']
\ + split(execute(':SPDebugInfo'), "\n") +
\ [
\ '## Screenshots',
\ '',
\ 'If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.'
\ ]
return info
endfunction

View File

@ -13,5 +13,11 @@ function! SpaceVim#layers#default#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
" help mappings
call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)
endfunction

View File

@ -6,6 +6,7 @@ function! SpaceVim#layers#unite#plugins() abort
\ ['ujihisa/unite-equery'],
\ ['m2mdas/unite-file-vcs'],
\ ['Shougo/neomru.vim'],
\ ['andreicristianpetcu/vim-van'],
\ ['kmnk/vim-unite-svn'],
\ ['basyura/unite-rails'],
\ ['nobeans/unite-grails'],

View File

@ -84,6 +84,9 @@ endfunction " }}}
function! s:start_parser(key, dict) " {{{
if a:key ==# '[KEYs]'
return
endif
let key = a:key ==? ' ' ? "<Space>" : a:key
let readmap = ""
redir => readmap
@ -356,7 +359,7 @@ function! s:wait_for_input() " {{{
call s:submode_mappings()
else
if inp == ' '
let inp = '<space>'
let inp = '[SPC]'
endif
let fsel = get(s:lmap, inp)
if !empty(fsel)
@ -565,6 +568,9 @@ call SpaceVim#mapping#guide#register_prefix_descriptions(
call SpaceVim#mapping#guide#register_prefix_descriptions(
\ g:spacevim_denite_leader,
\ 'g:_spacevim_mappings_denite')
call SpaceVim#mapping#guide#register_prefix_descriptions(
\ '[KEYs]',
\ 'g:_spacevim_mappings_prefixs')
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -276,7 +276,7 @@ function! SpaceVim#mapping#leader#defindUniteLeader(key) abort
\ 'unite all file and jump']
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17
\ -start-insert menu:CustomKeyMaps<CR>
let g:_spacevim_mappings_unite['<space>'] = ['Unite -silent -ignorecase' .
let g:_spacevim_mappings_unite['[SPC]'] = ['Unite -silent -ignorecase' .
\ ' -winheight=17 -start-insert menu:CustomKeyMaps',
\ 'unite customkeymaps']
endif
@ -294,4 +294,13 @@ function! SpaceVim#mapping#leader#getName(key) abort
endif
endfunction
function! SpaceVim#mapping#leader#defindKEYs() abort
let g:_spacevim_mappings_prefixs = {}
let g:_spacevim_mappings_prefixs[g:spacevim_unite_leader] = {'name' : '+Unite prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_unite_leader], g:_spacevim_mappings_unite)
let g:_spacevim_mappings_prefixs[g:spacevim_denite_leader] = {'name' : '+Denite prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_denite_leader], g:_spacevim_mappings_denite)
endfunction
" vim:set et sw=2 cc=80:

View File

@ -5,6 +5,7 @@ function! SpaceVim#mapping#space#init() abort
nnoremap <silent><nowait> [SPC] :<c-u>LeaderGuide " "<CR>
nmap <Space> [SPC]
let g:_spacevim_mappings_space = {}
let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'}
let g:_spacevim_mappings_space['?'] = ['Unite menu:CustomKeyMaps -input=[SPC]', 'show mappings']
let g:_spacevim_mappings_space.t = {'name' : '+Toggles'}
let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'}
@ -14,6 +15,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.f = {'name' : '+Files'}
let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
let g:_spacevim_mappings_space.h = {'name' : '+Help'}
" Windows
let g:_spacevim_mappings_space.w['<Tab>'] = ['wincmd w', 'alternate-window']
call SpaceVim#mapping#menu('alternate-window', '[SPC]w<Tab>', 'wincmd w')
@ -51,6 +53,7 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number']
call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'set nu!')
call SpaceVim#mapping#space#def('nnoremap', ['b', 'b'], 'Unite buffer', 'buffer list', 1)
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
endfunction
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
@ -78,6 +81,7 @@ function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
endif
call SpaceVim#mapping#menu(a:desc, '[SPC]' . join(a:keys, ''), lcmd)
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
endfunction
function! s:has_map_to_spc() abort

View File

@ -4,8 +4,6 @@ title: "Documentation"
# SpaceVim Documentation
---
- [Core Pillars](#core-pillars)
- [Mnemonic](#mnemonic)
- [Discoverable](#discoverable)
@ -24,7 +22,6 @@ title: "Documentation"
- [Automatic Generation](#automatic-generation)
- [Alternative directory](#alternative-directory)
- [Synchronization of dotfile changes](#synchronization-of-dotfile-changes)
- Testing the dotfile
- [Dotfile Contents](#dotfile-contents)
- [Configuration functions](#configuration-functions)
- [Custom variables](#custom-variables)
@ -38,7 +35,6 @@ title: "Documentation"
- [Font](#font)
- [UI Toggles](#ui-toggles)
- [statusline](#statusline)
- Features
- [Modular configuration](#modular-configuration)
- [Awesome ui](#awesome-ui)
@ -297,16 +293,70 @@ Key Binding | Description
##### Mappings guide
A guide buffer is displayed each time the prefix key is pressed in normal mode. It lists the available key bindings and their short description.
The prefix can be `[SPC]`, `[Window]`, `denite`, `<leader>` and `[unite]`.
The prefix can be `[SPC]`, `[Window]`, `[denite]`, `<leader>` and `[unite]`.
The default key of these prefix is:
Prefix name | custom option and default value | description
----------- | ------------------------------- | -----------
----------- | -------------------------------------- | -----------
`[SPC]` | NONE / `<Space>` | default mapping prefix of SpaceVim
`[Window]` | `g:spacevim_windows_leader` / `s` | window mapping prefix of SpaceVim
`[denite]` | `g:spacevim_denite_leader` / `F` | denite mapping prefix of SpaceVim
`[unite]` | `g:spacevim_unite_leader` / `f` | unite mapping prefix of SpaceVim
`<leader>` | `mapleader` / ``\`` | default leader prefix of vim/neovim
By default the guide buffer will be displayed 1000ms after the key has been pressed. You can change the delay by setting `'timeoutlen'` option to your liking (the value is in milliseconds).
for example, after pressing `<Space>` in normal mode, you will see :
![2017-05-07_1365x157](https://cloud.githubusercontent.com/assets/13142418/25778673/ae8c3168-3337-11e7-8536-ee78d59e5a9c.png)
this guide show you all the available key bindings begin with `[SPC]`, you can type `b` for all the buffer mappings, `p` for project mappings, etc. after pressing `<C-h>` in guide buffer, you will get paging and help info in the statusline.
key | description
---- | -----
`u` | undo pressing
`n` | next page of guide buffer
`p` | previous page of guide buffer
##### Unide/Denite describe key bindings
It is possible to search for specific key bindings by pressing `?` in the root of guide buffer.
To narrow the list, just insert the mapping keys or description of what mapping you want, Unite/Denite will fuzzy find the mappings, to find buffer related mappings:
![2017-05-07_1363x365](https://cloud.githubusercontent.com/assets/13142418/25779196/2f370b0a-3345-11e7-977c-a2377d23286e.png)
then use `<Tab>` or `<Up>` and `<Down>` to select the mapping, press `<Enter>` will execute that command.
#### Getting help
Denite/Unite is powerful tool to unite all interfaces. it was meant to be like [Helm](https://github.com/emacs-helm/helm) for Vim. These mappings is for getting help info about functions, variables etc:
Mappings | Description
-------- | ------------
SPC h SPC | discover SpaceVim documentation, layers and packages using unite
SPC h i | get help with the symbol at point
SPC h k | show top-level bindings with which-key
SPC h m | search available man pages
Reporting an issue:
Mappings | Description
-------- | ------------
SPC h I | Open SpaceVim GitHub issue page with pre-filled information
#### Available layers
##### Available packages in Spacemacs
##### New packages from ELPA repositories
####Toggles
# Features
## Awesome ui