summaryrefslogtreecommitdiff
path: root/.vimrc
blob: 22bb5e512fa858dad3463bd95359edf493d4240b (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
" plugins
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
Plug 'NewComer00/octavetui.vim', {'branch': 'main'}
call plug#end()

" speed up making new reports
autocmd BufNewFile report.tex 0r ~/.vim/templates/skeleton.tex

" octave IDE
let g:octavetui_octave_executable = '/usr/bin/octave'
let g:octavetui_user_keymaps = {
            \ 'OctaveTUISetBreakpoint':     '',
            \ 'OctaveTUIDelBreakpoint':     '',
            \ 'OctaveTUINext':              '',
            \ 'OctaveTUIStepIn':            '',
            \ 'OctaveTUIStepOut':           '',
            \ 'OctaveTUIRun':               '<F9>',
            \ 'OctaveTUIRunStacked':        '',
            \ 'OctaveTUIQuit':              'q',
            \ 'OctaveTUIQuitStacked':       '',
            \ 'OctaveTUIContinue':          '',
            \ 'OctaveTUIAddToWatch':        '',
            \ 'OctaveTUIRemoveFromWatch':   '',
            \ 'OctaveTUIGoToLastError':     'E',
            \ }


" hotkey for viewing pdf for vimtex
function! SyncZathura()
    " Get the window ID of the CURRENT terminal (where Vim is running)
    let l:term_id = system('xdotool getactivewindow')

    " 1. Raise Zathura using its Class name (-x)
    " 2. Raise the terminal back up using the ID we just captured
    silent exec '!wmctrl -xa Zathura && wmctrl -ia ' . l:term_id
    redraw!
endfunction
nnoremap <leader>z :call SyncZathura()<CR>

" Vimtex setup
let g:vimtex_view_method = 'zathura'
let g:vimtex_view_automatic = 1
let g:vimtex_compiler_method = 'latexmk'

" basic settings
filetype plugin indent on
syntax enable
set number
set ts=4
set sw=4
set smarttab
set expandtab
set autoindent

" compile/run hotkeys (when not using make)
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!clear && python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!clear && python3' shellescape(@%, 1)<CR>

autocmd FileType python map <buffer> <F8> :!python3 -m openmc_plotter<CR>
autocmd FileType python map <buffer> <F8> <esc>:!python3 -m openmc_plotter<CR>

autocmd FileType java map <buffer> <F9> :w<CR>:exec '!clear && java' shellescape(@%, 1)<CR>
autocmd FileType java imap <buffer> <F9> <esc>:w<CR>:exec '!clear && java' shellescape(@%, 1)<CR>

autocmd FileType fortran map <buffer> <F9> :w<CR>:exec '!clear && gfortran -o prog' shellescape(@%, 1) ' && ./prog'<CR>
autocmd FileType fortran imap <buffer> <F9> <esc>:w<CR>:exec '!clear && gfortran -o prog' shellescape(@%, 1) ' && ./prog'<CR>

autocmd FileType gnuplot map <buffer> <F9> :w<CR> :!gnuplot % -e "pause mouse close,key"<CR>
autocmd FileType gnuplot imap <buffer> <F9> <esc>:w<CR> :!gnuplot % -e "pause mouse close,key"<CR>

autocmd FileType sh map <buffer> <F9> :w<CR> :!clear && ./% <CR>
autocmd FileType sh imap <buffer> <F9> <esc>:w<CR> :!clear && ./% <CR>

" big day for ZZ ZQ fans
map q: <Nop>
nnoremap Q <nop>