Skip to content

Commit

Permalink
feat: abort when try to enable/disable without initializing
Browse files Browse the repository at this point in the history
  • Loading branch information
kawarimidoll committed Nov 30, 2023
1 parent 2e173a5 commit 718170d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions k.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ function! s:is_completed() abort
return get(complete_info(), 'selected', -1) >= 0
endfunction

let s:is_enable = v:false
let s:keys_to_remaps = []

function! k#is_enable() abort
return s:is_enable
return get(s:, 'is_enable', v:false)
endfunction

function! k#enable() abort
if !exists('s:is_enable')
call utils#echoerr('[k#enable] not initialized')
call utils#echoerr('[k#enable] abort')
return
endif
if s:is_enable
return
endif
Expand Down Expand Up @@ -55,6 +57,11 @@ function! k#enable() abort
endfunction

function! k#disable() abort
if !exists('s:is_enable')
call utils#echoerr('[k#enable] not initialized')
call utils#echoerr('[k#enable] abort')
return
endif
call inline_mark#clear()
if !s:is_enable
return
Expand Down Expand Up @@ -90,6 +97,8 @@ function! k#initialize(opts = {}) abort
return
endtry

let s:is_enable = v:false

" TODO 使用箇所で直接getすればよい
let s:henkan_marker = opts#get('henkan_marker')
let s:select_marker = opts#get('select_marker')
Expand Down

0 comments on commit 718170d

Please sign in to comment.