Blog: 2024-03-31

From razwiki
Jump to navigation Jump to search

Sigh... haven't got this vim help menu thing working, but it's maybe a good idea, to the extent that vim customization ideas can be good ideas.

.vim $ cat ftplugin/help.vim
set timeout timeoutlen=200
nnoremap <silent> <buffer> q :q<cr>

Fan of this

Continuing with my little python scheme wrapper. It hangs when you hit enter, I guess the scheme subprocess can't handle it

from subprocess import Popen, PIPE
from pexpect.replwrap import REPLWrapper

def safe_input(prompt):
        return input(prompt)
    except EOFError:
        return None

def main():
    scheme = REPLWrapper('scheme', 'ts> ', prompt_change=None)

    line = ''
    prompt = '> '

    while True:
        expression = safe_input(prompt)
        if expression is None:

        print('expression is: ' + repr(expression))
        line += ' ' + expression

        if line.count('(') == line.count(')'):
            print('EQ line is: ' + repr(line))

            result = scheme.run_command(line)

            print('so result is is: ' + result)

            line = ''
            prompt = '> '
            print('line is: ' + line)
            prompt = ' '