Skip to content

Commit

Permalink
Add cpo guard
Browse files Browse the repository at this point in the history
Close #3
  • Loading branch information
liuchengxu committed Sep 29, 2019
1 parent 95fc330 commit a29c79e
Show file tree
Hide file tree
Showing 27 changed files with 159 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autoload/clap.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Primiary code path for the plugin.

let s:save_cpo = &cpo
set cpo&vim

if has('nvim')
let s:has_features = has('nvim-0.4')
else
Expand Down Expand Up @@ -189,3 +192,6 @@ function! clap#(bang, ...) abort

call clap#for(provider_id_or_alias)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/debugging.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Gather some info useful for debugging.

let s:save_cpo = &cpo
set cpo&vim

function! s:get_global_variables() abort
let variable_list = []

Expand Down Expand Up @@ -54,3 +57,6 @@ function! clap#debugging#info_to_clipboard() abort
echohl Function | echon 'Vim-clap info' | echohl NONE
echohl Normal | echon ' copied to your clipboard' | echohl NONE
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/floating_win.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Neovim floating_win UI.

let s:save_cpo = &cpo
set cpo&vim

let g:clap#floating_win#input = {}
let g:clap#floating_win#display = {}
let g:clap#floating_win#spinner = {}
Expand Down Expand Up @@ -196,3 +199,6 @@ function! clap#floating_win#close() abort
" thus I have to go back to the start window in grep.vim
noautocmd call clap#util#nvim_win_close_safe(g:clap.display.winid)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/handler.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Handle the movement.

let s:save_cpo = &cpo
set cpo&vim

let s:old_input = ''
let s:support_multi_selection = v:false
let s:use_multi_selection = v:false
Expand Down Expand Up @@ -125,3 +128,6 @@ function! clap#handler#select_toggle() abort

return ''
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
3 changes: 3 additions & 0 deletions autoload/clap/icon.vim
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,6 @@ function! clap#icon#get_all() abort
call add(all, g:clap#icon#default)
return uniq(all)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/impl.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Default implementation for various hooks.

let s:save_cpo = &cpo
set cpo&vim

let s:is_nvim = has('nvim')

let s:NO_MATCHES = 'NO MATCHES FOUND'
Expand Down Expand Up @@ -85,3 +88,6 @@ function! clap#impl#on_typed() abort

call g:clap.display.add_highlight()
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/indicator.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Matches indicator.

let s:save_cpo = &cpo
set cpo&vim

if has('nvim')
let s:ns_id = nvim_create_namespace('clap')

Expand Down Expand Up @@ -36,3 +39,6 @@ function! clap#indicator#set_matches(indicator) abort
" endif
call s:apply_indicator(a:indicator)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/init.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Initialize and make a compatible layer between neovim and vim.

let s:save_cpo = &cpo
set cpo&vim

let s:is_nvim = has('nvim')

function! s:_goto_win() dict abort
Expand Down Expand Up @@ -448,3 +451,6 @@ function! clap#init#() abort
let g:clap.close_win = function('clap#popup#close')
endif
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/popup.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Vim popup UI and interaction.

let s:save_cpo = &cpo
set cpo&vim

let s:input = ''
let s:input_timer = -1

Expand Down Expand Up @@ -376,3 +379,6 @@ function! clap#popup#close() abort
call s:hide_all()
silent autocmd! ClapEnsureAllClosed
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/bcommits.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the buffer commits.

let s:save_cpo = &cpo
set cpo&vim

let s:bcommits = {}

function! s:bcommits.source() abort
Expand All @@ -12,3 +15,6 @@ function! s:bcommits.sink(line) abort
endfunction

let g:clap#provider#bcommits# = s:bcommits

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/blines.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the buffer lines.

let s:save_cpo = &cpo
set cpo&vim

let s:blines = {}

function! s:blines.sink(selected) abort
Expand All @@ -22,3 +25,6 @@ function! s:blines.on_enter() abort
endfunction

let g:clap#provider#blines# = s:blines

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/buffers.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the open buffers.

let s:save_cpo = &cpo
set cpo&vim

" TODO more fancy buffers, e.g., append icon.
function! s:buffers() abort
redir => l:buffers
Expand All @@ -27,3 +30,6 @@ let s:buffers.source = function('s:buffers')
let s:buffers.on_enter = function('s:buffers_on_enter')

let g:clap#provider#buffers# = s:buffers

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/colors.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the colorschemes.

let s:save_cpo = &cpo
set cpo&vim

let s:colors = {}

" Derived from fzf.vim
Expand Down Expand Up @@ -46,3 +49,6 @@ function! s:colors.on_exit() abort
endfunction

let g:clap#provider#colors# = s:colors

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/command_history.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the command history.

let s:save_cpo = &cpo
set cpo&vim

" Derived from fzf.vim
function! s:command_history() abort
let max = histnr(':')
Expand Down Expand Up @@ -35,3 +38,6 @@ let s:command_history.source = function('s:command_history_source')
let s:command_history.on_enter = { -> g:clap.display.setbufvar('&ft', 'clap_command_history') }

let g:clap#provider#command_history# = s:command_history

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/commits.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the commits.

let s:save_cpo = &cpo
set cpo&vim

let s:commits = {}

function! s:commits.source() abort
Expand Down Expand Up @@ -38,3 +41,6 @@ endfunction
let s:commits.on_enter = { -> g:clap.display.setbufvar('&ft', 'clap_commits') }

let g:clap#provider#commits# = s:commits

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/files.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the files.

let s:save_cpo = &cpo
set cpo&vim

let s:files = {}

function! s:chain_try() abort
Expand All @@ -27,3 +30,6 @@ endif
let s:files.sink = 'e'

let g:clap#provider#files# = s:files

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/filetypes.vim
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the filetypes.

let s:save_cpo = &cpo
set cpo&vim

let s:filetypes = {}

let s:filetypes.source = uniq(sort(map(split(globpath(&rtp, 'syntax/*.vim'), '\n'), 'fnamemodify(v:val, ":t:r")')))
let s:filetypes.sink = 'setf'

let g:clap#provider#filetypes# = s:filetypes

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/git_files.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the files managed by git.

let s:save_cpo = &cpo
set cpo&vim

let s:git_files = {}

if executable('git')
Expand All @@ -12,3 +15,6 @@ endif
let s:git_files.sink = 'e'

let g:clap#provider#git_files# = s:git_files

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/grep.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: Grep on the fly with smart cache strategy in async way.

let s:save_cpo = &cpo
set cpo&vim

let s:grep_delay = get(g:, 'clap_provider_grep_delay', 500)

let s:old_query = ''
Expand Down Expand Up @@ -330,3 +333,6 @@ let s:grep.jobstop = function('s:jobstop')
let s:grep.on_exit = function('s:grep_exit')

let g:clap#provider#grep# = s:grep

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/jumps.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the jump list with the preview.

let s:save_cpo = &cpo
set cpo&vim

let s:jumps = {}

function! s:jumps.source() abort
Expand Down Expand Up @@ -31,3 +34,6 @@ function! s:jumps.sink(line) abort
endfunction

let g:clap#provider#jumps# = s:jumps

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/marks.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the marks.

let s:save_cpo = &cpo
set cpo&vim

let s:marks = {}

function! s:format_mark(line)
Expand All @@ -20,3 +23,6 @@ function! s:marks.sink(line)
endfunction

let g:clap#provider#marks# = s:marks

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/registers.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the register list with the preview.

let s:save_cpo = &cpo
set cpo&vim

let s:registers = {}

function! s:registers.source() abort
Expand All @@ -12,3 +15,6 @@ function! s:registers.sink(line) abort
endfunction

let g:clap#provider#registers# = s:registers

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/tags.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the tags based on vista.vim.

let s:save_cpo = &cpo
set cpo&vim

let s:tags = {}

function! s:tags.source(...) abort
Expand All @@ -17,3 +20,6 @@ let s:tags.sink = function('vista#finder#fzf#sink')
let s:tags.on_enter = { -> g:clap.display.setbufvar('&ft', 'clap_tags') }

let g:clap#provider#tags# = s:tags

let &cpo = s:save_cpo
unlet s:save_cpo
6 changes: 6 additions & 0 deletions autoload/clap/provider/windows.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Description: List the windows.

let s:save_cpo = &cpo
set cpo&vim

let s:windows = {}

function! s:jump(t, w)
Expand Down Expand Up @@ -39,3 +42,6 @@ function! s:windows.sink(line)
endfunction

let g:clap#provider#windows# = s:windows

let &cpo = s:save_cpo
unlet s:save_cpo
Loading

0 comments on commit a29c79e

Please sign in to comment.