]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Detect already loaded code with simpler <SID> check
authorSergey Matveev <stargrave@stargrave.org>
Tue, 15 Jun 2021 08:28:25 +0000 (11:28 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 15 Jun 2021 08:28:25 +0000 (11:28 +0300)
12 files changed:
vim/.vim/ftplugin/html/autos.vim
vim/.vim/plugin/buftabline.vim
vim/.vim/plugin/chnglstnav.vim
vim/.vim/plugin/ctags.vim
vim/.vim/plugin/defsplit.vim
vim/.vim/plugin/exted.vim
vim/.vim/plugin/file_line.vim
vim/.vim/plugin/ggrep.vim
vim/.vim/plugin/grep.vim
vim/.vim/plugin/lsp.vim
vim/.vim/plugin/whereami.vim
vim/.vim/plugin/zshfe.vim

index fe2fcf3e7d38ae8c0a61acd5290868f9af902ea1..3e073e69d9193b71349964c555d8add4c00345c5 100644 (file)
@@ -1 +1 @@
-abbreviate tto <tt></tt><ESC>F<i
+abbreviate tto <em></em><ESC>F<i
index 24a3547376ea0271b65b27c6ddf619ddb9e9d7a6..4fb131802a35e025c992b2a148a7b3b66307f6c8 100644 (file)
@@ -1,7 +1,6 @@
-if exists("g:loaded_mein_buftabline") | finish | endif
-let g:loaded_mein_buftabline = 1
+if exists('*<SID>BufTabLine') | finish | endif
 
-function! BufTabline()
+function! s:BufTabline()
     redir => bufsRaw
     silent buffers
     redir END
@@ -22,5 +21,9 @@ function! BufTabline()
     return join(bufs, "  ")
 endfunction
 
+function! BufTabline()
+    return s:BufTabline()
+endfunction
+
 set showtabline=2
 set tabline=%!BufTabline()
index e383743836237e974cd8337c0a48cc4afccbb7cd..dac9e95f784b38d22be7611940aa48c763507d02 100644 (file)
@@ -1,5 +1,4 @@
-if exists("g:loaded_mein_chnglstnav") | finish | endif
-let g:loaded_mein_chnglstnav = 1
+if exists('*<SID>Chng') | finish | endif
 
 function! s:Chng(...)
     if a:0 == 0 | return | endif
index fbc438c019daed3852ad058dc2679df154d18cbe..268b27e4ea67e55ba7c6275a7492b3dca51d3c24 100644 (file)
@@ -5,10 +5,9 @@
 " Create "tags" file in your project's root first.
 " Then :Ctags LANG to fill it.
 
-if exists("g:loaded_mein_ctags") | finish | endif
-let g:loaded_mein_ctags = 1
+if exists('*<SID>Ctags') | finish | endif
 
-function! s:ctags(lang, onlyCmd, verbose)
+function! s:Ctags(lang, onlyCmd, verbose)
     let dst = tagfiles()
     if len(dst) == 0
         echohl WarningMsg | echomsg "No tagfiles" | echohl None
@@ -37,6 +36,6 @@ function! s:ctags(lang, onlyCmd, verbose)
     if a:verbose != v:true | redraw! | endif
 endfunction
 
-command! -nargs=1 Ctags silent call s:ctags(<f-args>, v:false, v:false)
-command! -nargs=1 Ctagsv silent call s:ctags(<f-args>, v:true, v:false)
-command! -nargs=1 Ctagscmd call s:ctags(<f-args>, v:true, v:true)
+command! -nargs=1 Ctags silent call s:Ctags(<f-args>, v:false, v:false)
+command! -nargs=1 Ctagsv silent call s:Ctags(<f-args>, v:true, v:false)
+command! -nargs=1 Ctagscmd call s:Ctags(<f-args>, v:true, v:true)
index f995c8a072f4499927a01f576b113ab0725f45ce..7beb26bc11949cddc49ebac403d6cbde96d988b7 100644 (file)
@@ -32,9 +32,8 @@
 " Also there is :Brsplit command behaving similarly, but it splits other
 " types of brackets: "{}", "[]".
 
-if exists("g:loaded_defsplit") | finish | endif
-let g:loaded_defsplit = 1
 if !exists("g:defsplit_shift") | let g:defsplit_shift = "    " | endif
+if exists('*<SID>Defsplit') | finish | endif
 
 function! s:bracket_find(brs_allowable, line, offset)
     let possible = []
@@ -45,7 +44,7 @@ function! s:bracket_find(brs_allowable, line, offset)
     return min(possible)
 endfunction
 
-function! s:defsplit(brs_allowable, single_line_comma, ...)
+function! s:Defsplit(brs_allowable, single_line_comma, ...)
     if a:0 == 0 | let skip = 0 | else | let skip = str2nr(a:1) | endif
     let shift = g:defsplit_shift
     let line = getline(".")
@@ -95,9 +94,9 @@ function! s:defsplit(brs_allowable, single_line_comma, ...)
     normal "_dd
 endfunction
 
-command! -nargs=? Defsplit call s:defsplit(["("], v:false, <f-args>)
-command! -nargs=? Brsplit call s:defsplit(["(", "[", "{"], v:false, <f-args>)
-command! -nargs=? Defsplits call s:defsplit(["("], v:true, <f-args>)
-command! -nargs=? Brsplits call s:defsplit(["(", "[", "{"], v:true, <f-args>)
+command! -nargs=? Defsplit call s:Defsplit(["("], v:false, <f-args>)
+command! -nargs=? Brsplit call s:Defsplit(["(", "[", "{"], v:false, <f-args>)
+command! -nargs=? Defsplits call s:Defsplit(["("], v:true, <f-args>)
+command! -nargs=? Brsplits call s:Defsplit(["(", "[", "{"], v:true, <f-args>)
 
 command! Undefsplit normal ^v%$J:keepp s/^\(.*\)\([([{]\) \(.*[^,]\),\?\([)\]}]\)\(.*\)$/\1\2\3\4\5<CR>:keepp s/, \?\([)\]}]\+\)$/\1/e<CR>:<CR>
index 39114313ff439a0c093b3950b73aa0900060b440..3833a656784578012ee84943eb82966a0fed577e 100644 (file)
@@ -1,5 +1,4 @@
-if exists("g:loaded_mein_exted") | finish | endif
-let g:loaded_mein_exted = 1
+if exists('*<SID>exted') | finish | endif
 
 function! s:exted(ext)
     execute "edit %<." . a:ext
index 45e250ea59db2839658a25f59c126eb3dd5dd1c3..8d7c429b57d975d46ac4fcb8d3eb2c4b58ec5943 100644 (file)
@@ -1,8 +1,7 @@
 " Simplified version of http://www.vim.org/scripts/script.php?script_id=2184
 " that does not replace current window
 
-if exists("g:loaded_mein_file_line") | finish | endif
-let g:loaded_mein_file_line = 1
+if exists('*<SID>gotoline') | finish | endif
 
 function! s:gotoline()
     let file = bufname("%")
index 7b52921113ff525e61bca15bf3c45828d7fa4f9a..8a9bd8a5b70db4d8247446d045cf6b150be78747 100644 (file)
@@ -1,5 +1,4 @@
-if exists("g:loaded_mein_ggrep") | finish | endif
-let g:loaded_mein_ggrep = 1
+if exists('*<SID>Vmg') | finish | endif
 
 function! s:Vmg(pattern)
     silent execute 'Ggrep "' . a:pattern . '"'
index e0878e7e2186e0fad352054a25b88cb79244b270..834390a786ae2f80a39b7b5a69d73918a6532f2c 100644 (file)
@@ -1,5 +1,4 @@
-if exists("g:loaded_mein_grep") | finish | endif
-let g:loaded_mein_grep = 1
+if exists('*<SID>Vim') | finish | endif
 
 function! s:Vim(pattern)
     let ignorecase_bak=&ignorecase
index 45f903c44f2091d0c851b9dfcd9fcc8acac8b3aa..d8c9167fe9e3a9c52b6686f07995466638b055d2 100644 (file)
@@ -1,5 +1,5 @@
-if exists("g:loaded_mein_lsp") | finish | endif
-let g:loaded_mein_lsp = 1
+if exists('*<SID>on_lsp_buffer_enabled') | finish | endif
+
 let g:lsp_auto_enable = 1
 
 let g:lsp_diagnostics_echo_cursor = 1
index f3a4f3c94d94c1b80b20f0f7e998e4163598f189..a6d53365224d2298347280a6c2f39790b9c4927e 100644 (file)
@@ -1,5 +1,4 @@
-if exists("g:loaded_mein_whereami") | finish | endif
-let g:loaded_mein_whereami = 1
+if exists('*<SID>pwdLoad') | finish | endif
 
 function! s:pwdLoad()
     let g:mein_pwdL=trim(system("pwd -L"))
@@ -8,7 +7,7 @@ endfunction
 
 autocmd VimEnter * call s:pwdLoad()
 
-function! WhereAmI(fmt)
+function! s:WhereAmI(fmt)
     let fullpath = expand("%:p")
     if fullpath[:len(g:mein_pwdP)-1] ==# g:mein_pwdP
         let fullpath = g:mein_pwdL . fullpath[len(g:mein_pwdP):]
@@ -24,5 +23,5 @@ function! WhereAmI(fmt)
     echomsg where
 endfunction
 
-nmap <leader>w :call WhereAmI("gnu")<CR>
-nmap <leader>W :call WhereAmI("lldb")<CR>
+nmap <leader>w :call <SID>WhereAmI("gnu")<CR>
+nmap <leader>W :call <SID>WhereAmI("lldb")<CR>
index fd5e5b14616596802f7eaf01e804e34e0eadb936..cd9cc07d1479e154bc6f7b0274f2ccd1b96e75f0 100644 (file)
@@ -2,8 +2,7 @@
 " Maintainer: Sergey Matveev <stargrave@stargrave.org>
 " License: GNU General Public License version 3 of the License or later
 
-if exists("g:loaded_zshfe") | finish | endif
-let g:loaded_zshfe = 1
+if exists('*<SID>zshfe') | finish | endif
 if !exists("g:zshfe_path") | let g:zshfe_path=expand("~/.vim/plugin/zshfe.zsh") | endif
 
 function! s:zshfe(query, opencmd)