From 952ec7d592cf7014ddb49ffd18c844887693f877 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 7 Nov 2022 12:50:43 +0200 Subject: [vimrc] Added comments to code terminal code --- .vimrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 0746302..a15411c 100644 --- a/.vimrc +++ b/.vimrc @@ -224,13 +224,22 @@ " }}} " Code terminal {{{ + " Program in which build actions are executed. If no value, build commands are executes as bash commands. + " This is only really useful in languages with interpreters let g:codeenvs = { \ 'scheme': 'racket' \ } + + " The following two dictionaries support certain substitutions: + " %F - location of current file (relative path) + " %D - directory of current file (full path) + + " Building the current file only let g:codebuildsingle = { \ 'scheme': '(enter! "%F")', \ 'cpp' : "g++ -g -pedantic '%F' && ./a.out" \ } + " Building all files in the directory (and subdirectories) of the current file let g:codebuildproject = { \ 'cpp' : "g++ -g -pedantic '%D/'**/*.cpp && ./a.out" \ } @@ -238,19 +247,24 @@ noremap :call CodeTerminal(g:codebuildsingle) noremap :call CodeTerminal(g:codebuildproject) + let t:codetermbufnr = -1 let t:codetermft = "" let t:codetermhadenv = 0 function! OpenCodeTerminal() if !bufexists(t:codetermbufnr) term + " Latest buffer is the terminal buffer we just opened let t:codetermbufnr = bufnr("$") + " We go back to the file from which this was called wincmd p endif if &filetype != t:codetermft if t:codetermhadenv + " This is kinda bad, since certain environments might not close with this only call term_sendkeys(t:codetermbufnr, "\") + " The sleep is kinda bad, but it fixes the next term_sendkeys not working properly sleep 500m endif -- cgit v1.2.3