major home-manager changes
This commit is contained in:
19
home/config/nvim/utils.vim
Executable file
19
home/config/nvim/utils.vim
Executable file
@@ -0,0 +1,19 @@
|
||||
" I got this part of the config from Michael Lan Source = https://www.youtube.com/watch?v=I4Rz0qoWYBl
|
||||
function! TermWrapper(command) abort
|
||||
if !exists('g:split_term_style') | let g:split_term_style = 'vertical' | endif
|
||||
if g:split_term_style ==# 'vertical'
|
||||
let buffercmd = 'vnew'
|
||||
elseif g:split_term_style ==# 'horizontal'
|
||||
let buffercmd = 'new'
|
||||
else
|
||||
echoerr 'ERROR! g:split_term_style is not a valid value (must be ''horizontal'' or ''vertical'' but is currently set to ''' . g:split_term_style . ''')'
|
||||
throw 'ERROR! g:split_term_style is not a valid value (must be ''horizontal'' or ''vertical'')'
|
||||
endif
|
||||
exec buffercmd
|
||||
exec 'term ' . a:command
|
||||
exec 'startinsert'
|
||||
endfunction
|
||||
command! -nargs=0 CompileAndRun call TermWrapper(printf('g++ -std=c++17 %s && ./a.out', expand('%')))
|
||||
autocmd FileType cpp nnoremap <F5> :CompileAndRun<CR>
|
||||
|
||||
let g:split_term_style = 'vertical'
|
Reference in New Issue
Block a user