-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc_sample_setup
53 lines (48 loc) · 1.42 KB
/
vimrc_sample_setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
" An example of Vim settings to make it work with minicomp.
" Not very generic, must be considered a PoC only.
" Assumes 'xa' to be the assembler used.
set number
set hlsearch
syntax on
filetype on
filetype plugin indent on
" Now starting everything up locally:
" The function must begin with a capital letter.
function CompileThis()
" %:r extracts filename
:!xa -o %:r.bin %
" This is how I detect that shell has not erred:
if v:shell_error != 0
return 1
endif
return 0
endfunction
function CompileAndReloadThis()
let result = CompileThis()
if result == 0
:let binname="reload ".expand('%:t:r').".bin\nreset\n"
" Sends binname to running minicomp instance:
:call term_sendkeys(2, binname)
endif
endfunction
function Set_up_env()
" sets terminal to be 63 symbols wide and as high as the
" current window:
set termwinsize=0x63
" opens terminal with the size above in a vertical split:
" splits to bo[ttomright]
vert bo ter
" and executes a couple of commands to position windows correctly
" :exe "normal \<C-w>\<C-r>"
:call term_sendkeys(2, "./runem\n")
:exe "normal \<C-w>h"
:Lex 20
" And go back to the main window
:exe "normal \<C-w>l"
" Ctrl-F9 compiles and reloads, keeps focus in minicomp
nnoremap <C-F9> :call CompileAndReloadThis()<CR>
" F9 just compiles
nnoremap <F9> :call CompileThis()<CR>
endfunction
" An autocommand to set up the environment when entering Vim.
autocmd VimEnter * call Set_up_env()