Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VIM Script development

31 views
Skip to first unread message

Johannes Koehler

unread,
Apr 4, 2021, 11:26:53 AM4/4/21
to
Hello Dev Folk,

because i never did a post in this grouplist before:

"Dear all. My name is kefko (i have
some more aliase, but thats my current
one, for computer hacking...) My real name youll find in
the Emailadress. I am not doing dangerous computer hacking
thats because iam not crypting everything and
using my real(m) name in plain text, also.
Kefko acrnym is inspired by
Kefka from the Final Fantasy Series. My gaming hobby...
Since my early ages, right now i am middle-aged,
i like computers and sports
(strange combination but math combination are
also strange ;) - sincerly"

My first post is related to a problem i currently have
with vimscript. Maybe i will find some help
here, or someone can give me an alternative #address (i.e. comp*editors?)
(yes, i did read the vim doku a lot :)

= I want to write a vimscript Plugin for VIM
to use the webservices by gnu inetutils (ftp)
together with the vimwiki Plugin to have
an centralized vimwiki. ("The hacker community
in germany (CCC) is by political principle decentralized
orientated and organized, but i am already not a member meanwhile,
so i think its ok to have an centralized vimwiki.")

VIM PLUGIN
#0: Getting Vimwiki files per FTP (tar.gz)
#0.1: Creating Vimwiki when not @FTPSERVER
#0.2: Opening and Using Vimwiki
#1: Closing Vimwiki and send/write back to FTP
#1.1: Copy a backup to a directory@FTP

Im not using vim9script because i want to
think during programming like the vimscript
Interpreter and not like a Compiler...

USING: netrw, tar, gzip, vimwiki Plugin

IDEA
Because i dont want to interfere with other
PLUGINS and SCRIPTS,

iam trying the following:

Loading the Pluginsources by runtimepath
(while development :so [...])

AfterSourcing: Only some global variables
and one START function is defined

When starting at point #0 (Plugin) by normal mode command:

Call this START function, within create and goto new BUFFER
create new LOCALDATA (nested subfunctions,
and autocommands + variable): not until with this
point, that new functions are defined (by interpreter
logic...?)

AIM
1) when wipeout this BUFFER the VIM data is also
tidy clean and i can (ie) source my Pluginsource again
- without sticking into problems with type save
2) the script is in running state (due to a while loop
waiting for an autocommand event) and can interact with the vimwiki

SOURCE OF START FUNKTION CALLED BY NORMAL MODE COMMAND

function s:Start()

if !has('vim9script')

try

let g:flag = v:true

function s:Wipe(buffer) abort
let s:command = 'bwipeout! ' .. a:buffer
:execute s:command
endfunction

function s:flagset() abort
let g:flag = v:false
endfunction

augroup ScriptAugroup
au BufLeave * call s:flagset()

let s:buffer = bufadd('ScriptBuffer')
let s:bufferName = bufname(s:buffer)
call bufload(s:bufferName)

if bufloaded(s:buffer) == v:true

"GOTO BUFFER
let b:command = 'buffer! ' .. s:buffer
:execute b:command

"NOW USING BUFFER LOCAL FUNCTIONS AND VAR

"DEFINE NEW FUNCTIONS AND Stuff
function b:Bla()
do sth
endfunction
let b:blub = "sth"

"THEN WAIT
while g:flag

"g:flag gets false when
"autocommand BufLeave is triggered by
"vimwiki during new buffer is existing

silent! execute ':VimwikiIndex'

endwhile
else
finish
endif

" Delete all Definitions
call s:Wipe(s:buffer)
augroup END
au! ScriptAugroup *
augroup! ScriptAugroup

catch /.*/
:echoerr v:exception
:echoerr v:errmsg
finally
endtry
endif
endfunction


?PROBLEM!

The while LOOP is not waiting for the g:flag getting
TRUE by autocommand. It seems like the Interpreter
is not accepting running loop after sourcing?

Maybe someone can tell me a solution for this problem.
Another idea i had during writing: Spitting it into
more functions and calling a clearance function
for doing the stuff after the terminated while loop...

THX!

--
Wonderful VIM DOCS:
When a mapping triggers itself, it will run forever
WEB www.johannes-koehler.de

Eli the Bearded

unread,
Apr 4, 2021, 7:15:32 PM4/4/21
to
In comp.editors, Johannes Koehler <Johannes...@web.de> wrote:
> Hello Dev Folk,
>
> because i never did a post in this grouplist before:

Hello. I don't know enough vim-script to help, but I'll suggest that you
try the vim mailing list. There are regular script questions there and
people answering. ":help vim-use"

Elijah
------
generally avoids vim script
0 new messages