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

Add SPC b s key binding (#3696)

This commit is contained in:
Wang Shidong 2020-08-10 20:39:37 +08:00 committed by GitHub
parent eb75112aec
commit 9e347d96a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@
" License: GPLv3 " License: GPLv3
"============================================================================= "=============================================================================
let s:BUF = SpaceVim#api#import('vim#buffer')
let s:file = expand('<sfile>:~') let s:file = expand('<sfile>:~')
let s:funcbeginline = expand('<slnum>') + 1 let s:funcbeginline = expand('<slnum>') + 1
function! SpaceVim#mapping#space#init() abort function! SpaceVim#mapping#space#init() abort
@ -308,6 +310,10 @@ function! SpaceVim#mapping#space#init() abort
\ ] \ ]
\ ] \ ]
\ , 1) \ , 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 's'],
\ 'call call('
\ . string(function('s:switch_scratch_buffer'))
\ . ', [])', 'switch-to-scratch-buffer', 1)
let s:lnum = expand('<slnum>') + 3 let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous-buffer', call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous-buffer',
\ [ \ [
@ -659,6 +665,14 @@ function! s:create_new_named_tab() abort
endif endif
endfunction endfunction
let s:scratch_buffer = -1
function! s:switch_scratch_buffer() abort
if !bufexists(s:scratch_buffer) || !empty(getbufvar(s:scratch_buffer, '&filetype', ''))
let s:scratch_buffer = s:BUF.create_buf(1, 1)
endif
exe 'buffer' s:scratch_buffer
endfunction
function! s:windows_transient_state() abort function! s:windows_transient_state() abort
let state = SpaceVim#api#import('transient_state') let state = SpaceVim#api#import('transient_state')