summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc77
1 files changed, 77 insertions, 0 deletions
diff --git a/.vimrc b/.vimrc
new file mode 100644
index 0000000..22bb5e5
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,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>