mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 04:30:04 +08:00
Merge branch 'windows/mappings' into dev
This commit is contained in:
commit
90ad032a1a
@ -8,5 +8,5 @@ endfunction
|
||||
|
||||
function! SpaceVim#layers#core#config() abort
|
||||
let g:rooter_silent_chdir = 1
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
|
||||
endfunction
|
||||
|
@ -17,3 +17,7 @@ function! SpaceVim#layers#format#plugins() abort
|
||||
\ ['sbdchd/neoformat', {'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1}],
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#format#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Neoformat', 'format-codo', 1)
|
||||
endfunction
|
||||
|
@ -12,11 +12,14 @@ function! SpaceVim#mapping#space#init() abort
|
||||
let g:_spacevim_mappings_space.b = {'name' : '+Buffers'}
|
||||
let g:_spacevim_mappings_space.f = {'name' : '+Files'}
|
||||
let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
|
||||
let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
|
||||
" Windows
|
||||
let g:_spacevim_mappings_space.w['<Tab>'] = ['wincmd w', 'alternate-window']
|
||||
call SpaceVim#mapping#menu('alternate-window', '[SPC]w<Tab>', 'wincmd w')
|
||||
let g:_spacevim_mappings_space.w['+'] = ['wincmd w', 'windows-layout-toggle']
|
||||
call SpaceVim#mapping#menu('window-layout-toggle', '[SPC]w+', 'wincmd w')
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', '+'],
|
||||
\ 'call call('
|
||||
\ . string(function('s:windows_layout_toggle'))
|
||||
\ . ', [])', 'windows-layout-toggle', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'h'], 'wincmd h', 'window-left', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'j'], 'wincmd j', 'window-down', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'k'], 'wincmd k', 'window-up', 1)
|
||||
@ -25,6 +28,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'J'], 'wincmd J', 'window-far-down', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'K'], 'wincmd K', 'window-far-up', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'L'], 'wincmd L', 'window-far-right', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', '/'], 'bel vs | wincmd w', 'split-window-right', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'v'], 'bel vs | wincmd w', 'split-window-right', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'V'], 'bel vs', 'split-window-right-focus', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', '='], 'wincmd =', 'balance-windows', 1)
|
||||
nnoremap <silent> [SPC]bn :bnext<CR>
|
||||
let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer']
|
||||
call SpaceVim#mapping#menu('Open next buffer', '[SPC]bn', 'bp')
|
||||
@ -57,7 +64,7 @@ function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
|
||||
let lcmd = 'call feedkeys("' . a:cmd . '", "' . feedkey_m . '")'
|
||||
endif
|
||||
endif
|
||||
exe a:m . ' <silent> [SPC]' . join(a:keys, '') . ' ' . cmd
|
||||
exe a:m . ' <silent> [SPC]' . join(a:keys, '') . ' ' . substitute(cmd, '|', '\\|', 'g')
|
||||
if len(a:keys) == 2
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
|
||||
elseif len(a:keys) == 1
|
||||
@ -69,3 +76,26 @@ endfunction
|
||||
function! s:has_map_to_spc() abort
|
||||
return get(g:, 'mapleader', '\') == ' '
|
||||
endfunction
|
||||
|
||||
function! s:windows_layout_toggle() abort
|
||||
if winnr('$') != 2
|
||||
echohl WarningMsg
|
||||
echom "Can't toggle window layout when the number of windows isn't two."
|
||||
echohl None
|
||||
else
|
||||
if winnr() == 1
|
||||
let b = winbufnr(2)
|
||||
else
|
||||
let b = winbufnr(1)
|
||||
endif
|
||||
if winwidth(1) == &columns
|
||||
only
|
||||
vsplit
|
||||
else
|
||||
only
|
||||
split
|
||||
endif
|
||||
exe 'b'.b
|
||||
wincmd w
|
||||
endif
|
||||
endfunction
|
||||
|
@ -8,9 +8,10 @@ title: "Documentation"
|
||||
|
||||
- Features
|
||||
- [Modular configuration](#modular-configuration)
|
||||
- [Awesome ui](#awesome-ui)
|
||||
- [Mnemonic key bindings](#mnemonic-key-bindings)
|
||||
- [Neovim centric - Dark powered mode](#neovim-centric---dark-powered-mode-of-spacevim)
|
||||
- [Language specific mode](#language-specific-mode)
|
||||
- [Awesome ui](#awesome-ui)
|
||||
- [Unite centric work-flow](#unite-centric-work-flow)
|
||||
- [multiple leader mode](#multiple-leader-mode)
|
||||
- [Custom configuration](#custom-configuration)
|
||||
@ -24,6 +25,10 @@ title: "Documentation"
|
||||
- outline + filemanager + checker
|
||||
![2017-02-01_1360x721](https://cloud.githubusercontent.com/assets/13142418/22506638/84705532-e8bc-11e6-8b72-edbdaf08426b.png)
|
||||
|
||||
## Mnemonic key bindings
|
||||
|
||||
Key bindings are organized using mnemonic prefixes like b for buffer, p for project, s for search, h for help, etc…
|
||||
|
||||
## Language specific mode
|
||||
|
||||
## Key Mapping
|
||||
|
Loading…
Reference in New Issue
Block a user