Skip to content

Commit

Permalink
Move scratch buffer mappings to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
yardnsm committed Oct 27, 2018
1 parent 0f73093 commit d391123
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions autoload/import_cost.vim
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ endfunction
" }}}
" Scratch buffer {{{

" Setup mappings for the scratch buffer
function! s:SetupScratchBufferMappings()
" Fast quitting
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
" Show total size
nnoremap <buffer> <silent> s :<C-U>echom b:total_size_string<CR>
endfunction

" Create a new empty scratch buffer, or focus on the currently opened one
function! s:CreateScratchBuffer()

Expand Down Expand Up @@ -132,11 +141,8 @@ function! s:CreateScratchBuffer()
setlocal nobuflisted
setlocal nowrap

" Fast quitting
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
" Show total size
nnoremap <buffer> <silent> s :<C-U>echom b:total_size_string<CR>
" Setup mappings
call s:SetupScratchBufferMappings()
endfunction

" Fill the scratch buffer with imports
Expand Down

0 comments on commit d391123

Please sign in to comment.