diff --git a/autoload/spelunker/get_buffer.vim b/autoload/spelunker/get_buffer.vim new file mode 100644 index 0000000..ab06b5a --- /dev/null +++ b/autoload/spelunker/get_buffer.vim @@ -0,0 +1,33 @@ +scriptencoding utf-8 + +let s:save_cpo = &cpo +set cpo&vim + +function! spelunker#get_buffer#all() + let l:window_text_list = getline(1, '$') + let l:window_text = join(l:window_text_list, "\n") + + let l:window_text = s:filter_uri(l:window_text) + let l:window_text = s:filter_back_quoted_string(l:window_text) + + echo l:window_text +endfunction + +function! s:filter_uri(text) + if g:spelunker_disable_url = 1 + return + endif + + " FYI: https://vi.stackexchange.com/questions/3990/ignore-urls-and-email-addresses-in-spell-file/24534#24534 + return substitute(a:text, '\w\+:\/\/[^[:space:]]\+', '', 'g') +endfunction + +function! s:filter_back_quoted_string(text) + " for shell command + " ex) `ls -la` + if g:spelunker_disable_back_quoted_string = 1 + return + endif + + return substitute(a:text, '`\_.\+`', '', 'g') +endfunction diff --git a/plugin/spelunker.vim b/plugin/spelunker.vim index 44642b3..8d8e6ad 100644 --- a/plugin/spelunker.vim +++ b/plugin/spelunker.vim @@ -42,6 +42,15 @@ if !exists('g:spelunker_disable_auto_group') let g:spelunker_disable_auto_group = 0 endif +if !exists('g:spelunker_disable_back_quoted_string') + let g:spelunker_disable_back_quoted_string = 0 +endif + +if !exists('g:spelunker_disable_url') + let g:spelunker_disable_url = 0 +endif + + let g:spelunker_check_type_buf_lead_write = 1 let g:spelunker_check_type_cursor_hold = 2