summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2022-11-07 12:50:43 +0200
committerSyndamia <kamen@syndamia.com>2022-11-07 12:50:43 +0200
commit952ec7d592cf7014ddb49ffd18c844887693f877 (patch)
tree15c4246e0d43d1e62d36dada1856a2226a6af8fc /.vimrc
parent6c715d2cbe290e1868f96bba4b3b184ecee558ee (diff)
downloaddotfiles-952ec7d592cf7014ddb49ffd18c844887693f877.tar
dotfiles-952ec7d592cf7014ddb49ffd18c844887693f877.tar.gz
dotfiles-952ec7d592cf7014ddb49ffd18c844887693f877.zip
[vimrc] Added comments to code terminal code
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc14
1 files changed, 14 insertions, 0 deletions
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 <F3> :call CodeTerminal(g:codebuildsingle)<CR>
noremap <F4> :call CodeTerminal(g:codebuildproject)<CR>
+
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, "\<C-D>")
+ " The sleep is kinda bad, but it fixes the next term_sendkeys not working properly
sleep 500m
endif