diff --git a/Linux/ginit.vim b/Linux/ginit.vim deleted file mode 100755 index 12bf60a..0000000 --- a/Linux/ginit.vim +++ /dev/null @@ -1,6 +0,0 @@ -set nocompatible - -if g:use_font==1 - set guifont=Hack:h14 - Guifont! Hack:h14 -endif diff --git a/Linux/init.vim b/Linux/init.vim deleted file mode 100755 index bfd4bef..0000000 --- a/Linux/init.vim +++ /dev/null @@ -1,1077 +0,0 @@ -set nocompatible - -set notermguicolors - -set mouse=a - -autocmd VimLeave * set guicursor=a:ver35-blinkon0 -set guicursor= -tnoremap - -let mapleader="-" -let maplocalleader="-" - -set wrap linebreak nolist -set breakindent -set breakindentopt=shift:4 - -set showbreak=↳ -set list -set listchars=tab:•\ ,trail:•,extends:⟩,precedes:⟨ -set shortmess=a -set tabstop=4 -set shiftwidth=4 -set smartindent -set autoindent -set diffopt=filler,vertical - -let g:use_javacomplete=0 - -let g:use_smooth_scroll=0 -let g:use_python=1 -let g:use_async=1 -let g:use_airline=1 -let g:use_sound=0 -let g:use_deoplete=1 -let g:use_pandoc_markdown=1 -let g:compile_on_save=0 -let g:open_pdf=0 -let g:pdf_viewer="sumatrapdf" -let g:pandoc_output="pandoc_output" -let g:pandoc_default="md-to-pdf" -let g:latexmk_use=1 -let g:latexmk_clean=1 -let g:latex_use_outdir=0 -let g:latex_outdir="output" - -let g:tex_indent_items=0 -let g:tex_items='' - -let g:manual_fold_autoload=1 - -let g:jobs=[] - -let g:http_server='' - -let g:indentguides_tabchar = '│' - -call plug#begin() -Plug 'scrooloose/nerdcommenter' -Plug 'shime/vim-livedown' - -if g:use_sound==1 - Plug 'https://github.com/timeyyy/orchestra.nvim.git' - Plug 'https://github.com/timeyyy/bubbletrouble.symphony.git' - Plug 'https://github.com/timeyyy/clackclack.symphony' -endif - -if g:use_airline==1 - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' -endif - -if g:use_deoplete==1 - if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif -endif -"Plug 'thaerkh/vim-indentguides' - -Plug 'ap/vim-buftabline' - -if g:use_pandoc_markdown==1 - Plug 'vim-pandoc/vim-pandoc-syntax' -endif -Plug 'vim-pandoc/vim-pandoc' -Plug 'sheerun/vim-polyglot' -Plug 'scrooloose/nerdtree' -if g:use_python==1 - Plug 'dhruvasagar/vim-table-mode' -endif -if g:use_async==1 - Plug 'skywind3000/asyncrun.vim' -endif - -if g:use_javacomplete==1 - Plug 'artur-shaik/vim-javacomplete2' -endif - -Plug 'lervag/vimtex' -" Plug 'LaTeX-Box-Team/LaTeX-Box' -Plug 'tomtom/templator_vim' -"Plug 'xuhdev/vim-latex-live-preview' - -if g:use_smooth_scroll == 1 - Plug 'yuttie/comfortable-motion.vim' -endif - -" Colorschemes -Plug 'haishanh/night-owl.vim' -Plug 'BrainDeath0/Hypsteria' -Plug 'sts10/vim-pink-moon' -Plug 'nightsense/snow' -Plug 'edouardp/myob-colorscheme' -Plug 'kaicataldo/material.vim' -Plug 'phanviet/vim-monokai-pro' -Plug 'aradunovic/perun.vim' -Plug 'jacoborus/tender.vim' -Plug 'mkarmona/materialbox' -Plug 'ajmwagar/vim-deus' -Plug 'rhysd/vim-color-spring-night' -Plug 'nightsense/carbonized' -Plug 'nightsense/forgotten' -Plug 'nightsense/seagrey' -Plug 'nightsense/vrunchbang' -Plug 'mhartington/oceanic-next' -Plug 'rakr/vim-two-firewatch' -Plug 'zeis/vim-kolor' -Plug 'sjl/badwolf' -Plug 'tomasr/molokai' -Plug 'fmoralesc/molokayo' -Plug 'junegunn/seoul256.vim' -Plug 'w0ng/vim-hybrid' -Plug 'goatslacker/mango.vim' -Plug 'dracula/vim', { 'as': 'dracula' } -Plug 'morhetz/gruvbox' -Plug 'ayu-theme/ayu-vim' -Plug 'jnurmine/Zenburn' -Plug 'nanotech/jellybeans.vim' -Plug 'altercation/vim-colors-solarized' -Plug 'lifepillar/vim-solarized8' -Plug 'NLKNguyen/papercolor-theme' - -call plug#end() - -let g:use_font=1 - -"colorscheme badwolf -colorscheme snow - -"autocmd SwapExists * let v:swapchoice="o" -function! DeleteFileSwaps() - write - let l:output = '' - redir => l:output - silent exec ':sw' - redir END - let l:current_swap_file = substitute(l:output, '\n', '', '') - let l:base = substitute(l:current_swap_file, '\v\.\w+$', '', '') - let l:swap_files = split(glob(l:base.'\.s*')) - " delete all except the current swap file - for l:swap_file in l:swap_files - if !empty(glob(l:swap_file)) && l:swap_file != l:current_swap_file - call delete(l:swap_file) - echo "swap file removed: ".l:swap_file - endif - endfor - " Reset swap file extension to `.swp`. - set swf! | set swf! - echo "Reset swap file extension for file: ".expand('%') -endfunction -command! DeleteFileSwaps :call DeleteFileSwaps() - - -nnoremap cd :lcd %:p:h - -tnoremap - -if g:use_smooth_scroll == 1 - let g:comfortable_motion_no_default_key_mappings = 1 - let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value. - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 1) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -1) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2) -endif - -"set scrolloff=2 - -function! FullScreenToggle() - if g:GuiWindowFullScreen==1 - call GuiWindowFullScreen(0) - else - call GuiWindowFullScreen(1) - endif -endfunction - -function! MaximizedToggle() - if g:GuiWindowMaximized==1 - call GuiWindowMaximized(0) - else - call GuiWindowMaximized(1) - endif -endfunction - -nnoremap :call MaximizedToggle() -nnoremap :call FullScreenToggle() -nnoremap = - - -let $NVIM_TUI_ENABLE_TRUE_COLOR=1 - -"let g:LatexBox_latexmk_async=1 - -"let g:LatexBox_latexmk_options="-synctex=1 -shell-escape" - -"let g:LatexBox_quickfix=2 - -"let g:LatexBox_viewer="SumatraPDF -reuse-instance" - -let g:polyglot_disabled = ['latex'] - -let g:vimtex_compiler_latexmk = { - \ 'backend' : 'nvim', - \ 'background' : 1, - \ 'build_dir' : '', - \ 'callback' : 1, - \ 'continuous' : 0, - \ 'executable' : 'latexmk', - \ 'options' : [ - \ '-verbose', - \ '-file-line-error', - \ '-synctex=1', - \ '-interaction=nonstopmode', - \ '-shell-escape', - \ ], - \} - -"augroup vimtex_config - "au! - "au User VimtexEventQuit call vimtex#compiler#clean(0) -"augroup END -let g:vimtex_quickfix_mode = 1 -let g:vimtex_quickfix_open_on_warning = 0 -let g:vimtex_view_enabled = 0 -let g:vimtex_view_general_viewer = '' -" let g:vimtex_view_general_options = '' -" let g:vimtex_view_general_options_latexmk = '-reuse-instance' - -if g:use_pandoc_markdown - let g:pandoc#syntax#conceal#use = 0 - let g:pandoc#formatting#mode="sa" - let g:pandoc#formatting#smart_autoformat_on_cursormoved=1 -endif - -if g:use_javacomplete==1 - autocmd FileType java setlocal omnifunc=javacomplete#Complete -endif -if g:use_deoplete==1 - let g:deoplete#enable_at_startup = 1 -endif - -if g:use_python == 1 - let g:table_mode_corner_corner='+' - let g:table_mode_header_fillchar='=' -endif - -if g:use_airline==1 - " air-line - - let g:airline_powerline_fonts = 1 - if !exists('g:airline_symbols') - let g:airline_symbols = {} - if g:use_font==0 - let g:airline_left_sep = '' - let g:airline_right_sep = '' - let g:airline_symbols.linenr = '␊' - let g:airline_symbols.linenr = '␤' - let g:airline_symbols.linenr = '¶' - let g:airline_symbols.branch = '⎇' - let g:airline_symbols.paste = 'ρ' - let g:airline_symbols.paste = 'Þ' - let g:airline_symbols.paste = '∥' - let g:airline_symbols.whitespace = 'Ξ' - endif - endif - - "" unicode symbols - "let g:airline_left_sep = '»' - "let g:airline_left_sep = '▶' - "let g:airline_right_sep = '«' - "let g:airline_right_sep = '◀' - "let g:airline_symbols.linenr = '␊' - "let g:airline_symbols.linenr = '␤' - "let g:airline_symbols.linenr = '¶' - "let g:airline_symbols.branch = '⎇' - "let g:airline_symbols.paste = 'ρ' - "let g:airline_symbols.paste = 'Þ' - "let g:airline_symbols.paste = '∥' - "let g:airline_symbols.whitespace = 'Ξ' - "" airline symbols - "let g:airline_left_sep = '' - "let g:airline_left_alt_sep = '' - "let g:airline_right_sep = '' - "let g:airline_right_alt_sep = '' - "let g:airline_symbols.branch = '' - "let g:airline_symbols.readonly = '' - "let g:airline_symbols.linenr = '' - - "let g:airline_theme = "badwolf" - let g:airline_theme = "deus" -endif - -if g:use_sound==1 - call orchestra#prelude() - - call orchestra#set_tune('bubbletrouble') -endif - -let g:livedown_autorun = 0 - -let g:livedown_open = 1 - -let g:livedown_port = 1337 - -let g:livedown_browser = "firefox -P livedown" - -let g:confirm_new_file = 1 - -let g:wiki_history = {} - -"nmap Ox -"nmap ox -"inoremap `^ - -map n :NERDTreeToggle - -"nmap >> -"nmap << - -"vmap >> -"vmap << - -" nnoremap o o -" nnoremap O O - -nnoremap Q - -nmap m :LivedownToggle - -let g:data = [] -function! g:JobHandler(job_id, data, event) - if a:event == 'stdout' || a:event == 'stderr' - echom '>> ' . substitute(join(a:data), "\^M", "\r", "g") - else - echom 'Job ' . a:job_id . ' finished' - - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - if item == a:job_id - call remove(g:jobs, index) - endif - let index = index + 1 - endwhile - - if string(a:data) != "0" - echoerr 'Program terminated with exit code ' . string(a:data) - endif - endif - - "call append(line('$'), str) -endfunction - -let g:callbacks = { - \ 'on_stdout': function('g:JobHandler'), - \ 'on_stderr': function('g:JobHandler'), - \ 'on_exit': function('g:JobHandler') - \ } - -let g:callbacks_no_out = { - \ 'on_exit': function('g:JobHandler') - \ } - -"function! Stdout(job_id, data, event) - "echom 'Job ' . a:job_id . ': >>' . join(a:data) - "" echom 'stdout: ' . a:data[0] -"endfunction - -" function! Stderr(job_id, data, event) -" echoerr 'Job ' . a:job_id . ': >>' . join(a:data) -" endfunction - -"function! PrintFinished(job_id, data, event) - "echom 'Job ' . a:job_id . ' finished with exit code: ' . string(a:data) -"endfunction - -function! OpenPdf() - if g:use_async==1 - let pdf_path = "" - - if g:latex_use_outdir==1 - let pdf_path = expand('%:r') . "_" . g:latex_outdir . "/" . expand('%:t:r') . ".pdf" - else - let pdf_path = expand('%:r') . ".pdf" - endif - - let pdf_job = jobstart(g:pdf_viewer . " " . pdf_path) - echom "Started PDF-Viewer with job_id " . pdf_job - "execute("AsyncRun " . g:pdf_viewer . " " . expand('%:r') . ".pdf") - let g:open_pdf=0 - else - execute("!" . g:pdf_viewer. " " . expand('%:r') . ".pdf") - endif -endfunction - -function! ConvertPandoc(attr) - let command = "" - if a:attr == "md-to-pdf" - let command = "pandoc -s " . @% . " --from=markdown+escaped_line_breaks -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-html-to-pdf" - let command = "pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-to-html" - let command = "pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" - elseif a:attr == "latex-to-pdf" - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" - endif - - " if g:use_async==1 - " execute("AsyncRun " . command) - " else - "let g:pandoc#command#autoexec_command="call jobstart('pandoc -s " . @% . " --from=markdown -o " . expand('%:r') . ".pdf')" - if g:use_async==1 - " let g:current_job = jobstart('pandoc -s ' . expand('%') . ' --from=markdown -o ' . expand('%:r') . '.pdf', {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'on_stdout': function('Stdout'), 'on_stderr': function('Stdout'), 'on_exit': function('PrintFinished')}) - " - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - else - execute("!" . command) - echom "Compilation finished" - endif - " endif - - if g:open_pdf==1 - call OpenPdf() normal - endif -endfunction - -function! g:ExitedWithCode(job_id, data, event) - echom "Job " . a:job_id . " exited with code: " . string(a:data) -endfunction - -function! ConvertPandocPdfLatexDebug() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPandocPdfLatex() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - if g:use_async==1 - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Conversion from " . @% . " to " . expand('%:r') . ".tex finished" - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if result[0]==-1 - echom "Generation of " . expand('%:r') . ".pdf timed out" - elseif result[0]==-2 - echom "Generation of " . expand('%:r') . ".pdf terminated" - elseif result[0]==-3 - echom "INVALID JOB-ID: Generation of " . expand('%:r') . ".pdf terminated" - else - echom "Generation of " . expand('%:r') . ".pdf finished" - - if g:latexmk_use==1 - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif - endif - endif - else - execute("!" . command) - echom "Conversion finished" - execute("!" . pdf_command) - echom "Compilation finished" - - if g:latexmk_use==1 - execute("!" . pdf_cleanup) - echom "Cleanup finished" - endif - endif -endfunction - -"nmap pm :execute "! pandoc " . @% . " --from=markdown -o " . expand('%:r') . ".pdf" -"nmap pM :execute "! pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" -"nmap ph :execute "! pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" -"nmap pl :execute "! pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" -au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us - -nmap pm :call ConvertPandoc("md-to-pdf") -nmap pM :call ConvertPandoc("md-html-to-pdf") -nmap ph :call ConvertPandoc("md-to-html") -nmap pl :call ConvertPandocPdfLatex() -nmap pd :call ConvertPandocPdfLatexDebug() -nmap pp :AsyncStop:call OpenPdf() -nmap po :AsyncStop:AsyncRunsumatrapdf - - -function! AsciiDoctor() - execute("!asciidoctor " . expand('%')) -endfunction - -nmap a :call AsciiDoctor() - - -function! ConvertPdfLatexDebug() - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPdfLatex() - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . expand('%:r') . ".tex" - - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif -endfunction - -function! CleanLatexDir(full) - if a:full==0 - let clean="c" - else - let clean="C" - endif - - let curr_dir = getcwd() - execute("cd " . expand('%:p:h')) - - "let pdf_cleanup = "latexmk -" . clean . " " . expand('%:r') . ".tex" - - let pdf_cleanup = "latexmk -" . clean - - execute("!" . pdf_cleanup) - execute("cd " . curr_dir) -endfunction - -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -nnoremap lc :call CleanLatexDir(0) -nnoremap lC :call CleanLatexDir(1) -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -"nnoremap lc :! latexmk -c -"nnoremap lC :! latexmk -C - -function! NewLatexTemplate() - let filename = input('Please specify the filename: ') - if filename!="" - let command = "Templator " . expand('%:p:h') . "/latex " . filename - echom command - execute(command) - endif -endfunction - -nnoremap ln :call NewLatexTemplate() -nnoremap pn :call NewLatexTemplate() - -function! ToggleCompileOnSave() - if g:compile_on_save == 1 - let g:compile_on_save=0 - echom "Compile on save is now turned OFF" - else - let g:compile_on_save=1 - echom "Compile on save is now turned ON" - endif -endfunction - -nmap pc :call ToggleCompileOnSave() - -function! ConvertPandocOnSave(args) - if g:compile_on_save == 1 - call ConvertPandoc(a:args) - execute "normal \" - endif -endfunction - -"autocmd FileType pandoc autocmd BufWritePost call ConvertPandoc(g:pandoc_default) | execute("normal \") -autocmd FileType pandoc silent autocmd BufWritePost silent! call ConvertPandocOnSave(g:pandoc_default) -" autocmd FileType tex silent autocmd BufWritePost silent! call ConvertPandoc("latex-to-pdf") - -function! AsciidoctorConvert() - execute("!asciidoctor " . expand('%')) -endfunction -function! AsciidoctorPdfConvert() - execute("!asciidoctor-pdf " . expand('%')) -endfunction -function! AsciidoctorEpubConvert() - execute("!asciidoctor-epub3 " . expand('%')) -endfunction - -nmap aa :call AsciidoctorConvert() -nmap ap :call AsciidoctorPdfConvert() -nmap ae :call AsciidoctorEpubConvert() - -function! TermuxOpenFile() - execute("!termux-open " . expand('%')) -endfunction - -function! TermuxOpenHTML() - execute("!firefox " . expand('%:r') . ".html") -endfunction - -function! TermuxOpenPdf() - execute("!sumatrapdf " . expand('%:r') . ".pdf") -endfunction - -function! TermuxOpenEpub() - execute("!ebook-viewer " . expand('%:r') . ".epub") -endfunction - -nmap oo :call TermuxOpenFile() -nmap oh :call TermuxOpenHTML() -nmap op :call TermuxOpenPdf() -nmap oe :call TermuxOpenEpub() - -function! ConvertMarkdownToAsciidoc() - execute ("%s/\\!\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/image:\\2[\\1]/gc") - execute ("%s/\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/link:\\2[\\1]/gc") - execute("%s/\\#/=/gc") - execute("%s/image:\\(.\\{-}\\) ".\\{-}"\\[/image:\\1[/gc") -endfunction - -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap + + -nnoremap - - -nnoremap < < -nnoremap > > -nnoremap _ _ -nnoremap -nnoremap = = -nnoremap T T - -nnoremap e :e -nnoremap t :tabe - -set splitbelow -set splitright - -nmap gB :buffers -nmap gb :buffer - -nnoremap § ` - -filetype plugin on -syntax on - - -" vimwiki stuff " -" Run multiple wikis " - -let g:vimwiki_list = [ - \{'path': "D:/Projects/BrainWiki", - \ 'syntax': 'markdown', 'ext': '.wiki'} - \] - -"au BufRead,BufNewFile *.wiki set filetype=vimwiki -"function! ToggleCalendar() -"execute ":Calendar" -"if exists("g:calendar_open") -"if g:calendar_open == 1 -"execute "q" -"unlet g:calendar_open -"else -"g:calendar_open = 1 -"end -"else -"let g:calendar_open = 1 -"end -"endfunction -":autocmd FileType vimwiki map c :call ToggleCalendar() - -function! GetSelection() range - echo a:firstline - echo a:lastline - let selectedText = getline(a:firstline,a:lastline) - echo selectedText - call FilterSelection(join(selectedText)) -endfunction - -function! FilterSelection(text) - if a:text =~ ">>>" - call FileHandler(a:text) - else - let text_no_spaces = substitute(a:text, "[ \n]", "", "g") - call FileHandler(text_no_spaces) - endif -endfunction - -function! BuffersList() - let all = range(0, bufnr('$')) - let res = [] - for b in all - if bufexists(b) - call add(res, bufname(b)) - endif - endfor - return res -endfunction - -function! IsInBuffersList(text) - for b in BuffersList() - if b =~ a:text - return 1 - endif - endfor - return 0 -endfunction - -function! FileHandler(text) - if a:text =~ "(" && a:text =~ ")" - let filename = matchstr(a:text, '(.\{-})') - let substituted = matchstr(filename, '[^\(].*[^\)]') - if substituted =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - try - let confirmed = 1 - let buffer_exists = 0 - if IsInBuffersList(substituted) == 1 - let buffer_exists = 1 - endif - if empty(glob(substituted)) && buffer_exists == 0 - echom "File does not exist" - let g:confirm_new_file = 1 - else - let g:confirm_new_file = 0 - endif - - echom g:confirm_new_file - - if g:confirm_new_file == 1 - let val = input('Do you want to create a new file "'. substituted . '" [y]es/[N]o? ') - if val !~? '^y' - let confirmed = 0 - else - let confirmed = 1 - endif - endif - - echom "File exists or is open" - if confirmed == 1 - let g:wiki_history[substituted] = expand('%:p') - execute('e %:h/' . substituted) - else - echom "You aborted the file creation! please also remove the link from the document!" - endif - catch /./ - echoerr 'An error occured during file creation: ' . v:exception - endtry - endif - else - if a:text =$ "\\$" - let substituted = substitute(a:text, ".*\\$", "", "g") - echom substituted - "let substituted = matchstr(substituted, '[^>>>].*') - let text_no_spaces = substitute(substituted, "[\n]", "", "g") - let text_no_spaces = substitute(text_no_spaces, "[ ]", "_", "g") - if text_no_spaces !~ ".md" - let text_no_spaces .= ".md" - endif - if text_no_spaces =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - "call setline(".", "[" . substituted . "](" . substituted . ")") - "execute("normal! ddO[" . substituted . "](" . text_no_spaces . ")") - execute("normal! 0f$c$[" . substituted . "](" . text_no_spaces . ")") - "call FileHandler("(" . text_no_spaces . ")") - endif - endif - endif -endfunction - -function! GetLine() - let currentLine = getline(".") - call FilterSelection(currentLine) -endfunction - -function! GoBackNew() - echom expand('%:t') - if has_key(g:wiki_history, expand('%:t')) - let parent = remove(g:wiki_history, expand('%:t')) - echom parent - execute("e " . parent) - else - echom "Nothing to go back to!" - endif -endfunction - -function! GoBack() - execute('e#') -endfunction - -command! -range GetSelectionInRange ,call GetSelection() - -nmap :silent :call GetLine() -vmap :GetSelectionInRange - -map :silent :call GoBackNew() - -function! StartHttp() - if g:http_server != '' - echom "A server seems to be running already with process id " . g:http_server - echom "Stopping it first" - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server -endfunction - -function! StopHttp() - if g:http_server == '' - echoerr "There seems to be no server running" - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -function! ToggleHttp() - if g:http_server == '' - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -command! StartHttp call StartHttp() -command! StopHttp call StopHttp() -command! ToggleHttp call ToggleHttp() - -map s :ToggleHttp - -function! CodeBlock() - let val = input('Choose your coding language - leave blank for no syntax-highlighting: ') - execute("normal! S```" . val . "o```Ox") -endfunction - -function! MakeTable() - let count = input('How many columns would you like to have? ') - if count == "" - return - endif - let col_nr = str2nr(count) - let col_headers = [] - while col_nr > 0 - let val = input('Enter the column heading: ') - while len(val) < 3 - let val .= " " - endwhile - call add(col_headers, val) - let col_nr -= 1 - endwhile - let headings = "| " - let divider = "| " - let i = 0 - for heading in col_headers - let headings .= col_headers[i] . " | " - let j = 0 - let div_tmp = "" - while j < len(col_headers[i]) - let div_tmp .= "-" - let j += 1 - endwhile - let div_tmp .= " | " - let divider .= div_tmp - let i += 1 - endfor - execute("normal! S" . headings) - execute("normal! o" . divider) -endfunction - -inoremap :silent :call CodeBlock() -nmap :silent :call CodeBlock() - -" inoremap :silent :call MakeTable() -" nmap :silent :call MakeTable() -inoremap :TableModeToggle -nmap :TableModeToggle - -function! Heading() - execute("normal! O[ Back to the landing page](index.md)") - execute("normal! o# BrainOdin") - execute("normal! o") - execute("normal! j") -endfunction - -"inoremap :silent :call Heading() -nmap :silent :call Heading() -map :set relativenumber! -nmap c -vmap c - -set number -set relativenumber - -autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber -autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber - -"hi LineNr guifg=#B0BEC5 -"hi CursorLineNr guifg=#64FFDA - -set ignorecase -set smartcase -set backspace=indent,eol,start -set confirm - -function! WriteFolds() - let filename=expand('%:r') . ".fold" - execute("mkview! " . filename) -endfunction - -function! SaveFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("mkview! " . filename) - endif -endfunction - -function! ReadFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("source " . filename) - endif -endfunction - -let g:vimtex_fold_enabled=1 -"if g:manual_fold_autoload==1 - "set foldmethod=manual - "autocmd BufWinLeave,WinLeave,BufWritePost * call SaveFolds() - "autocmd BufWinEnter * call ReadFolds() - "autocmd InsertLeave,WinEnter * setlocal foldmethod=manual - "autocmd InsertEnter,WinLeave * setlocal foldmethod=manual -"else - "set foldmethod=indent - "set foldlevel=1 - ""set foldclose=all -"endif - -nmap fw :call WriteFolds() -" nmap fl :source expand('%:r') . ".fold" - -set incsearch - -set clipboard=unnamedplus - -nmap h :noh - -nmap . :bnext -nmap , :bprev - -inoremap p unique_ptr<>i -nnoremap p iunique_ptr<>i - -inoremap m make_unique<>i -noremap m imake_unique<>i - -set background=dark diff --git a/Termux/init.vim b/Termux/init.vim deleted file mode 100755 index bfd4bef..0000000 --- a/Termux/init.vim +++ /dev/null @@ -1,1077 +0,0 @@ -set nocompatible - -set notermguicolors - -set mouse=a - -autocmd VimLeave * set guicursor=a:ver35-blinkon0 -set guicursor= -tnoremap - -let mapleader="-" -let maplocalleader="-" - -set wrap linebreak nolist -set breakindent -set breakindentopt=shift:4 - -set showbreak=↳ -set list -set listchars=tab:•\ ,trail:•,extends:⟩,precedes:⟨ -set shortmess=a -set tabstop=4 -set shiftwidth=4 -set smartindent -set autoindent -set diffopt=filler,vertical - -let g:use_javacomplete=0 - -let g:use_smooth_scroll=0 -let g:use_python=1 -let g:use_async=1 -let g:use_airline=1 -let g:use_sound=0 -let g:use_deoplete=1 -let g:use_pandoc_markdown=1 -let g:compile_on_save=0 -let g:open_pdf=0 -let g:pdf_viewer="sumatrapdf" -let g:pandoc_output="pandoc_output" -let g:pandoc_default="md-to-pdf" -let g:latexmk_use=1 -let g:latexmk_clean=1 -let g:latex_use_outdir=0 -let g:latex_outdir="output" - -let g:tex_indent_items=0 -let g:tex_items='' - -let g:manual_fold_autoload=1 - -let g:jobs=[] - -let g:http_server='' - -let g:indentguides_tabchar = '│' - -call plug#begin() -Plug 'scrooloose/nerdcommenter' -Plug 'shime/vim-livedown' - -if g:use_sound==1 - Plug 'https://github.com/timeyyy/orchestra.nvim.git' - Plug 'https://github.com/timeyyy/bubbletrouble.symphony.git' - Plug 'https://github.com/timeyyy/clackclack.symphony' -endif - -if g:use_airline==1 - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' -endif - -if g:use_deoplete==1 - if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif -endif -"Plug 'thaerkh/vim-indentguides' - -Plug 'ap/vim-buftabline' - -if g:use_pandoc_markdown==1 - Plug 'vim-pandoc/vim-pandoc-syntax' -endif -Plug 'vim-pandoc/vim-pandoc' -Plug 'sheerun/vim-polyglot' -Plug 'scrooloose/nerdtree' -if g:use_python==1 - Plug 'dhruvasagar/vim-table-mode' -endif -if g:use_async==1 - Plug 'skywind3000/asyncrun.vim' -endif - -if g:use_javacomplete==1 - Plug 'artur-shaik/vim-javacomplete2' -endif - -Plug 'lervag/vimtex' -" Plug 'LaTeX-Box-Team/LaTeX-Box' -Plug 'tomtom/templator_vim' -"Plug 'xuhdev/vim-latex-live-preview' - -if g:use_smooth_scroll == 1 - Plug 'yuttie/comfortable-motion.vim' -endif - -" Colorschemes -Plug 'haishanh/night-owl.vim' -Plug 'BrainDeath0/Hypsteria' -Plug 'sts10/vim-pink-moon' -Plug 'nightsense/snow' -Plug 'edouardp/myob-colorscheme' -Plug 'kaicataldo/material.vim' -Plug 'phanviet/vim-monokai-pro' -Plug 'aradunovic/perun.vim' -Plug 'jacoborus/tender.vim' -Plug 'mkarmona/materialbox' -Plug 'ajmwagar/vim-deus' -Plug 'rhysd/vim-color-spring-night' -Plug 'nightsense/carbonized' -Plug 'nightsense/forgotten' -Plug 'nightsense/seagrey' -Plug 'nightsense/vrunchbang' -Plug 'mhartington/oceanic-next' -Plug 'rakr/vim-two-firewatch' -Plug 'zeis/vim-kolor' -Plug 'sjl/badwolf' -Plug 'tomasr/molokai' -Plug 'fmoralesc/molokayo' -Plug 'junegunn/seoul256.vim' -Plug 'w0ng/vim-hybrid' -Plug 'goatslacker/mango.vim' -Plug 'dracula/vim', { 'as': 'dracula' } -Plug 'morhetz/gruvbox' -Plug 'ayu-theme/ayu-vim' -Plug 'jnurmine/Zenburn' -Plug 'nanotech/jellybeans.vim' -Plug 'altercation/vim-colors-solarized' -Plug 'lifepillar/vim-solarized8' -Plug 'NLKNguyen/papercolor-theme' - -call plug#end() - -let g:use_font=1 - -"colorscheme badwolf -colorscheme snow - -"autocmd SwapExists * let v:swapchoice="o" -function! DeleteFileSwaps() - write - let l:output = '' - redir => l:output - silent exec ':sw' - redir END - let l:current_swap_file = substitute(l:output, '\n', '', '') - let l:base = substitute(l:current_swap_file, '\v\.\w+$', '', '') - let l:swap_files = split(glob(l:base.'\.s*')) - " delete all except the current swap file - for l:swap_file in l:swap_files - if !empty(glob(l:swap_file)) && l:swap_file != l:current_swap_file - call delete(l:swap_file) - echo "swap file removed: ".l:swap_file - endif - endfor - " Reset swap file extension to `.swp`. - set swf! | set swf! - echo "Reset swap file extension for file: ".expand('%') -endfunction -command! DeleteFileSwaps :call DeleteFileSwaps() - - -nnoremap cd :lcd %:p:h - -tnoremap - -if g:use_smooth_scroll == 1 - let g:comfortable_motion_no_default_key_mappings = 1 - let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value. - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 1) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -1) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2) - nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2) -endif - -"set scrolloff=2 - -function! FullScreenToggle() - if g:GuiWindowFullScreen==1 - call GuiWindowFullScreen(0) - else - call GuiWindowFullScreen(1) - endif -endfunction - -function! MaximizedToggle() - if g:GuiWindowMaximized==1 - call GuiWindowMaximized(0) - else - call GuiWindowMaximized(1) - endif -endfunction - -nnoremap :call MaximizedToggle() -nnoremap :call FullScreenToggle() -nnoremap = - - -let $NVIM_TUI_ENABLE_TRUE_COLOR=1 - -"let g:LatexBox_latexmk_async=1 - -"let g:LatexBox_latexmk_options="-synctex=1 -shell-escape" - -"let g:LatexBox_quickfix=2 - -"let g:LatexBox_viewer="SumatraPDF -reuse-instance" - -let g:polyglot_disabled = ['latex'] - -let g:vimtex_compiler_latexmk = { - \ 'backend' : 'nvim', - \ 'background' : 1, - \ 'build_dir' : '', - \ 'callback' : 1, - \ 'continuous' : 0, - \ 'executable' : 'latexmk', - \ 'options' : [ - \ '-verbose', - \ '-file-line-error', - \ '-synctex=1', - \ '-interaction=nonstopmode', - \ '-shell-escape', - \ ], - \} - -"augroup vimtex_config - "au! - "au User VimtexEventQuit call vimtex#compiler#clean(0) -"augroup END -let g:vimtex_quickfix_mode = 1 -let g:vimtex_quickfix_open_on_warning = 0 -let g:vimtex_view_enabled = 0 -let g:vimtex_view_general_viewer = '' -" let g:vimtex_view_general_options = '' -" let g:vimtex_view_general_options_latexmk = '-reuse-instance' - -if g:use_pandoc_markdown - let g:pandoc#syntax#conceal#use = 0 - let g:pandoc#formatting#mode="sa" - let g:pandoc#formatting#smart_autoformat_on_cursormoved=1 -endif - -if g:use_javacomplete==1 - autocmd FileType java setlocal omnifunc=javacomplete#Complete -endif -if g:use_deoplete==1 - let g:deoplete#enable_at_startup = 1 -endif - -if g:use_python == 1 - let g:table_mode_corner_corner='+' - let g:table_mode_header_fillchar='=' -endif - -if g:use_airline==1 - " air-line - - let g:airline_powerline_fonts = 1 - if !exists('g:airline_symbols') - let g:airline_symbols = {} - if g:use_font==0 - let g:airline_left_sep = '' - let g:airline_right_sep = '' - let g:airline_symbols.linenr = '␊' - let g:airline_symbols.linenr = '␤' - let g:airline_symbols.linenr = '¶' - let g:airline_symbols.branch = '⎇' - let g:airline_symbols.paste = 'ρ' - let g:airline_symbols.paste = 'Þ' - let g:airline_symbols.paste = '∥' - let g:airline_symbols.whitespace = 'Ξ' - endif - endif - - "" unicode symbols - "let g:airline_left_sep = '»' - "let g:airline_left_sep = '▶' - "let g:airline_right_sep = '«' - "let g:airline_right_sep = '◀' - "let g:airline_symbols.linenr = '␊' - "let g:airline_symbols.linenr = '␤' - "let g:airline_symbols.linenr = '¶' - "let g:airline_symbols.branch = '⎇' - "let g:airline_symbols.paste = 'ρ' - "let g:airline_symbols.paste = 'Þ' - "let g:airline_symbols.paste = '∥' - "let g:airline_symbols.whitespace = 'Ξ' - "" airline symbols - "let g:airline_left_sep = '' - "let g:airline_left_alt_sep = '' - "let g:airline_right_sep = '' - "let g:airline_right_alt_sep = '' - "let g:airline_symbols.branch = '' - "let g:airline_symbols.readonly = '' - "let g:airline_symbols.linenr = '' - - "let g:airline_theme = "badwolf" - let g:airline_theme = "deus" -endif - -if g:use_sound==1 - call orchestra#prelude() - - call orchestra#set_tune('bubbletrouble') -endif - -let g:livedown_autorun = 0 - -let g:livedown_open = 1 - -let g:livedown_port = 1337 - -let g:livedown_browser = "firefox -P livedown" - -let g:confirm_new_file = 1 - -let g:wiki_history = {} - -"nmap Ox -"nmap ox -"inoremap `^ - -map n :NERDTreeToggle - -"nmap >> -"nmap << - -"vmap >> -"vmap << - -" nnoremap o o -" nnoremap O O - -nnoremap Q - -nmap m :LivedownToggle - -let g:data = [] -function! g:JobHandler(job_id, data, event) - if a:event == 'stdout' || a:event == 'stderr' - echom '>> ' . substitute(join(a:data), "\^M", "\r", "g") - else - echom 'Job ' . a:job_id . ' finished' - - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - if item == a:job_id - call remove(g:jobs, index) - endif - let index = index + 1 - endwhile - - if string(a:data) != "0" - echoerr 'Program terminated with exit code ' . string(a:data) - endif - endif - - "call append(line('$'), str) -endfunction - -let g:callbacks = { - \ 'on_stdout': function('g:JobHandler'), - \ 'on_stderr': function('g:JobHandler'), - \ 'on_exit': function('g:JobHandler') - \ } - -let g:callbacks_no_out = { - \ 'on_exit': function('g:JobHandler') - \ } - -"function! Stdout(job_id, data, event) - "echom 'Job ' . a:job_id . ': >>' . join(a:data) - "" echom 'stdout: ' . a:data[0] -"endfunction - -" function! Stderr(job_id, data, event) -" echoerr 'Job ' . a:job_id . ': >>' . join(a:data) -" endfunction - -"function! PrintFinished(job_id, data, event) - "echom 'Job ' . a:job_id . ' finished with exit code: ' . string(a:data) -"endfunction - -function! OpenPdf() - if g:use_async==1 - let pdf_path = "" - - if g:latex_use_outdir==1 - let pdf_path = expand('%:r') . "_" . g:latex_outdir . "/" . expand('%:t:r') . ".pdf" - else - let pdf_path = expand('%:r') . ".pdf" - endif - - let pdf_job = jobstart(g:pdf_viewer . " " . pdf_path) - echom "Started PDF-Viewer with job_id " . pdf_job - "execute("AsyncRun " . g:pdf_viewer . " " . expand('%:r') . ".pdf") - let g:open_pdf=0 - else - execute("!" . g:pdf_viewer. " " . expand('%:r') . ".pdf") - endif -endfunction - -function! ConvertPandoc(attr) - let command = "" - if a:attr == "md-to-pdf" - let command = "pandoc -s " . @% . " --from=markdown+escaped_line_breaks -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-html-to-pdf" - let command = "pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-to-html" - let command = "pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" - elseif a:attr == "latex-to-pdf" - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" - endif - - " if g:use_async==1 - " execute("AsyncRun " . command) - " else - "let g:pandoc#command#autoexec_command="call jobstart('pandoc -s " . @% . " --from=markdown -o " . expand('%:r') . ".pdf')" - if g:use_async==1 - " let g:current_job = jobstart('pandoc -s ' . expand('%') . ' --from=markdown -o ' . expand('%:r') . '.pdf', {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'on_stdout': function('Stdout'), 'on_stderr': function('Stdout'), 'on_exit': function('PrintFinished')}) - " - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - else - execute("!" . command) - echom "Compilation finished" - endif - " endif - - if g:open_pdf==1 - call OpenPdf() normal - endif -endfunction - -function! g:ExitedWithCode(job_id, data, event) - echom "Job " . a:job_id . " exited with code: " . string(a:data) -endfunction - -function! ConvertPandocPdfLatexDebug() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPandocPdfLatex() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - if g:use_async==1 - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Conversion from " . @% . " to " . expand('%:r') . ".tex finished" - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if result[0]==-1 - echom "Generation of " . expand('%:r') . ".pdf timed out" - elseif result[0]==-2 - echom "Generation of " . expand('%:r') . ".pdf terminated" - elseif result[0]==-3 - echom "INVALID JOB-ID: Generation of " . expand('%:r') . ".pdf terminated" - else - echom "Generation of " . expand('%:r') . ".pdf finished" - - if g:latexmk_use==1 - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif - endif - endif - else - execute("!" . command) - echom "Conversion finished" - execute("!" . pdf_command) - echom "Compilation finished" - - if g:latexmk_use==1 - execute("!" . pdf_cleanup) - echom "Cleanup finished" - endif - endif -endfunction - -"nmap pm :execute "! pandoc " . @% . " --from=markdown -o " . expand('%:r') . ".pdf" -"nmap pM :execute "! pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" -"nmap ph :execute "! pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" -"nmap pl :execute "! pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" -au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us - -nmap pm :call ConvertPandoc("md-to-pdf") -nmap pM :call ConvertPandoc("md-html-to-pdf") -nmap ph :call ConvertPandoc("md-to-html") -nmap pl :call ConvertPandocPdfLatex() -nmap pd :call ConvertPandocPdfLatexDebug() -nmap pp :AsyncStop:call OpenPdf() -nmap po :AsyncStop:AsyncRunsumatrapdf - - -function! AsciiDoctor() - execute("!asciidoctor " . expand('%')) -endfunction - -nmap a :call AsciiDoctor() - - -function! ConvertPdfLatexDebug() - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPdfLatex() - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . expand('%:r') . ".tex" - - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif -endfunction - -function! CleanLatexDir(full) - if a:full==0 - let clean="c" - else - let clean="C" - endif - - let curr_dir = getcwd() - execute("cd " . expand('%:p:h')) - - "let pdf_cleanup = "latexmk -" . clean . " " . expand('%:r') . ".tex" - - let pdf_cleanup = "latexmk -" . clean - - execute("!" . pdf_cleanup) - execute("cd " . curr_dir) -endfunction - -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -nnoremap lc :call CleanLatexDir(0) -nnoremap lC :call CleanLatexDir(1) -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -"nnoremap lc :! latexmk -c -"nnoremap lC :! latexmk -C - -function! NewLatexTemplate() - let filename = input('Please specify the filename: ') - if filename!="" - let command = "Templator " . expand('%:p:h') . "/latex " . filename - echom command - execute(command) - endif -endfunction - -nnoremap ln :call NewLatexTemplate() -nnoremap pn :call NewLatexTemplate() - -function! ToggleCompileOnSave() - if g:compile_on_save == 1 - let g:compile_on_save=0 - echom "Compile on save is now turned OFF" - else - let g:compile_on_save=1 - echom "Compile on save is now turned ON" - endif -endfunction - -nmap pc :call ToggleCompileOnSave() - -function! ConvertPandocOnSave(args) - if g:compile_on_save == 1 - call ConvertPandoc(a:args) - execute "normal \" - endif -endfunction - -"autocmd FileType pandoc autocmd BufWritePost call ConvertPandoc(g:pandoc_default) | execute("normal \") -autocmd FileType pandoc silent autocmd BufWritePost silent! call ConvertPandocOnSave(g:pandoc_default) -" autocmd FileType tex silent autocmd BufWritePost silent! call ConvertPandoc("latex-to-pdf") - -function! AsciidoctorConvert() - execute("!asciidoctor " . expand('%')) -endfunction -function! AsciidoctorPdfConvert() - execute("!asciidoctor-pdf " . expand('%')) -endfunction -function! AsciidoctorEpubConvert() - execute("!asciidoctor-epub3 " . expand('%')) -endfunction - -nmap aa :call AsciidoctorConvert() -nmap ap :call AsciidoctorPdfConvert() -nmap ae :call AsciidoctorEpubConvert() - -function! TermuxOpenFile() - execute("!termux-open " . expand('%')) -endfunction - -function! TermuxOpenHTML() - execute("!firefox " . expand('%:r') . ".html") -endfunction - -function! TermuxOpenPdf() - execute("!sumatrapdf " . expand('%:r') . ".pdf") -endfunction - -function! TermuxOpenEpub() - execute("!ebook-viewer " . expand('%:r') . ".epub") -endfunction - -nmap oo :call TermuxOpenFile() -nmap oh :call TermuxOpenHTML() -nmap op :call TermuxOpenPdf() -nmap oe :call TermuxOpenEpub() - -function! ConvertMarkdownToAsciidoc() - execute ("%s/\\!\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/image:\\2[\\1]/gc") - execute ("%s/\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/link:\\2[\\1]/gc") - execute("%s/\\#/=/gc") - execute("%s/image:\\(.\\{-}\\) ".\\{-}"\\[/image:\\1[/gc") -endfunction - -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap + + -nnoremap - - -nnoremap < < -nnoremap > > -nnoremap _ _ -nnoremap -nnoremap = = -nnoremap T T - -nnoremap e :e -nnoremap t :tabe - -set splitbelow -set splitright - -nmap gB :buffers -nmap gb :buffer - -nnoremap § ` - -filetype plugin on -syntax on - - -" vimwiki stuff " -" Run multiple wikis " - -let g:vimwiki_list = [ - \{'path': "D:/Projects/BrainWiki", - \ 'syntax': 'markdown', 'ext': '.wiki'} - \] - -"au BufRead,BufNewFile *.wiki set filetype=vimwiki -"function! ToggleCalendar() -"execute ":Calendar" -"if exists("g:calendar_open") -"if g:calendar_open == 1 -"execute "q" -"unlet g:calendar_open -"else -"g:calendar_open = 1 -"end -"else -"let g:calendar_open = 1 -"end -"endfunction -":autocmd FileType vimwiki map c :call ToggleCalendar() - -function! GetSelection() range - echo a:firstline - echo a:lastline - let selectedText = getline(a:firstline,a:lastline) - echo selectedText - call FilterSelection(join(selectedText)) -endfunction - -function! FilterSelection(text) - if a:text =~ ">>>" - call FileHandler(a:text) - else - let text_no_spaces = substitute(a:text, "[ \n]", "", "g") - call FileHandler(text_no_spaces) - endif -endfunction - -function! BuffersList() - let all = range(0, bufnr('$')) - let res = [] - for b in all - if bufexists(b) - call add(res, bufname(b)) - endif - endfor - return res -endfunction - -function! IsInBuffersList(text) - for b in BuffersList() - if b =~ a:text - return 1 - endif - endfor - return 0 -endfunction - -function! FileHandler(text) - if a:text =~ "(" && a:text =~ ")" - let filename = matchstr(a:text, '(.\{-})') - let substituted = matchstr(filename, '[^\(].*[^\)]') - if substituted =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - try - let confirmed = 1 - let buffer_exists = 0 - if IsInBuffersList(substituted) == 1 - let buffer_exists = 1 - endif - if empty(glob(substituted)) && buffer_exists == 0 - echom "File does not exist" - let g:confirm_new_file = 1 - else - let g:confirm_new_file = 0 - endif - - echom g:confirm_new_file - - if g:confirm_new_file == 1 - let val = input('Do you want to create a new file "'. substituted . '" [y]es/[N]o? ') - if val !~? '^y' - let confirmed = 0 - else - let confirmed = 1 - endif - endif - - echom "File exists or is open" - if confirmed == 1 - let g:wiki_history[substituted] = expand('%:p') - execute('e %:h/' . substituted) - else - echom "You aborted the file creation! please also remove the link from the document!" - endif - catch /./ - echoerr 'An error occured during file creation: ' . v:exception - endtry - endif - else - if a:text =$ "\\$" - let substituted = substitute(a:text, ".*\\$", "", "g") - echom substituted - "let substituted = matchstr(substituted, '[^>>>].*') - let text_no_spaces = substitute(substituted, "[\n]", "", "g") - let text_no_spaces = substitute(text_no_spaces, "[ ]", "_", "g") - if text_no_spaces !~ ".md" - let text_no_spaces .= ".md" - endif - if text_no_spaces =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - "call setline(".", "[" . substituted . "](" . substituted . ")") - "execute("normal! ddO[" . substituted . "](" . text_no_spaces . ")") - execute("normal! 0f$c$[" . substituted . "](" . text_no_spaces . ")") - "call FileHandler("(" . text_no_spaces . ")") - endif - endif - endif -endfunction - -function! GetLine() - let currentLine = getline(".") - call FilterSelection(currentLine) -endfunction - -function! GoBackNew() - echom expand('%:t') - if has_key(g:wiki_history, expand('%:t')) - let parent = remove(g:wiki_history, expand('%:t')) - echom parent - execute("e " . parent) - else - echom "Nothing to go back to!" - endif -endfunction - -function! GoBack() - execute('e#') -endfunction - -command! -range GetSelectionInRange ,call GetSelection() - -nmap :silent :call GetLine() -vmap :GetSelectionInRange - -map :silent :call GoBackNew() - -function! StartHttp() - if g:http_server != '' - echom "A server seems to be running already with process id " . g:http_server - echom "Stopping it first" - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server -endfunction - -function! StopHttp() - if g:http_server == '' - echoerr "There seems to be no server running" - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -function! ToggleHttp() - if g:http_server == '' - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -command! StartHttp call StartHttp() -command! StopHttp call StopHttp() -command! ToggleHttp call ToggleHttp() - -map s :ToggleHttp - -function! CodeBlock() - let val = input('Choose your coding language - leave blank for no syntax-highlighting: ') - execute("normal! S```" . val . "o```Ox") -endfunction - -function! MakeTable() - let count = input('How many columns would you like to have? ') - if count == "" - return - endif - let col_nr = str2nr(count) - let col_headers = [] - while col_nr > 0 - let val = input('Enter the column heading: ') - while len(val) < 3 - let val .= " " - endwhile - call add(col_headers, val) - let col_nr -= 1 - endwhile - let headings = "| " - let divider = "| " - let i = 0 - for heading in col_headers - let headings .= col_headers[i] . " | " - let j = 0 - let div_tmp = "" - while j < len(col_headers[i]) - let div_tmp .= "-" - let j += 1 - endwhile - let div_tmp .= " | " - let divider .= div_tmp - let i += 1 - endfor - execute("normal! S" . headings) - execute("normal! o" . divider) -endfunction - -inoremap :silent :call CodeBlock() -nmap :silent :call CodeBlock() - -" inoremap :silent :call MakeTable() -" nmap :silent :call MakeTable() -inoremap :TableModeToggle -nmap :TableModeToggle - -function! Heading() - execute("normal! O[ Back to the landing page](index.md)") - execute("normal! o# BrainOdin") - execute("normal! o") - execute("normal! j") -endfunction - -"inoremap :silent :call Heading() -nmap :silent :call Heading() -map :set relativenumber! -nmap c -vmap c - -set number -set relativenumber - -autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber -autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber - -"hi LineNr guifg=#B0BEC5 -"hi CursorLineNr guifg=#64FFDA - -set ignorecase -set smartcase -set backspace=indent,eol,start -set confirm - -function! WriteFolds() - let filename=expand('%:r') . ".fold" - execute("mkview! " . filename) -endfunction - -function! SaveFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("mkview! " . filename) - endif -endfunction - -function! ReadFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("source " . filename) - endif -endfunction - -let g:vimtex_fold_enabled=1 -"if g:manual_fold_autoload==1 - "set foldmethod=manual - "autocmd BufWinLeave,WinLeave,BufWritePost * call SaveFolds() - "autocmd BufWinEnter * call ReadFolds() - "autocmd InsertLeave,WinEnter * setlocal foldmethod=manual - "autocmd InsertEnter,WinLeave * setlocal foldmethod=manual -"else - "set foldmethod=indent - "set foldlevel=1 - ""set foldclose=all -"endif - -nmap fw :call WriteFolds() -" nmap fl :source expand('%:r') . ".fold" - -set incsearch - -set clipboard=unnamedplus - -nmap h :noh - -nmap . :bnext -nmap , :bprev - -inoremap p unique_ptr<>i -nnoremap p iunique_ptr<>i - -inoremap m make_unique<>i -noremap m imake_unique<>i - -set background=dark diff --git a/Termux/init_termux.vim b/Termux/init_termux.vim deleted file mode 100755 index 67b0699..0000000 --- a/Termux/init_termux.vim +++ /dev/null @@ -1,1020 +0,0 @@ -set nocompatible - -set termguicolors - -set mouse=a - -autocmd VimLeave * set guicursor=a:ver35-blinkon0 -tnoremap - -let mapleader="-" -let maplocalleader="-" - -set wrap linebreak nolist -set breakindent -set breakindentopt=shift:4 - -set showbreak=↳ -set list -set listchars=tab:•\ ,trail:•,extends:⟩,precedes:⟨ -set shortmess=a -set tabstop=4 -set shiftwidth=4 -set smartindent -set autoindent -set diffopt=filler,vertical - -let g:use_javacomplete=0 - -let g:use_python=1 -let g:use_async=1 -let g:use_airline=1 -let g:use_sound=0 -let g:use_deoplete=1 -let g:use_pandoc_markdown=1 -let g:compile_on_save=0 -let g:open_pdf=0 -let g:pdf_viewer="sumatrapdf" -let g:pandoc_output="pandoc_output" -let g:pandoc_default="md-to-pdf" -let g:latexmk_use=1 -let g:latexmk_clean=1 -let g:latex_use_outdir=0 -let g:latex_outdir="output" - -let g:tex_indent_items=0 -let g:tex_items='' - -let g:manual_fold_autoload=1 - -let g:jobs=[] - -let g:http_server='' - -let g:indentguides_tabchar = '│' - -call plug#begin() -Plug 'scrooloose/nerdcommenter' -Plug 'shime/vim-livedown' - -if g:use_sound==1 - Plug 'https://github.com/timeyyy/orchestra.nvim.git' - Plug 'https://github.com/timeyyy/bubbletrouble.symphony.git' - Plug 'https://github.com/timeyyy/clackclack.symphony' -endif - -if g:use_airline==1 - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' -endif - -if g:use_deoplete==1 - if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif -endif -"Plug 'thaerkh/vim-indentguides' - -Plug 'ap/vim-buftabline' - -if g:use_pandoc_markdown==1 - Plug 'vim-pandoc/vim-pandoc-syntax' -endif -Plug 'vim-pandoc/vim-pandoc' -Plug 'sheerun/vim-polyglot' -Plug 'scrooloose/nerdtree' -if g:use_python==1 - Plug 'dhruvasagar/vim-table-mode' -endif -if g:use_async==1 - Plug 'skywind3000/asyncrun.vim' -endif - -if g:use_javacomplete==1 - Plug 'artur-shaik/vim-javacomplete2' -endif - -Plug 'lervag/vimtex' -" Plug 'LaTeX-Box-Team/LaTeX-Box' -Plug 'tomtom/templator_vim' -"Plug 'xuhdev/vim-latex-live-preview' - -Plug 'yuttie/comfortable-motion.vim' - -" Colorschemes -Plug 'haishanh/night-owl.vim' -Plug 'BrainDeath0/Hypsteria' -Plug 'sts10/vim-pink-moon' -Plug 'nightsense/snow' -Plug 'edouardp/myob-colorscheme' -Plug 'kaicataldo/material.vim' -Plug 'phanviet/vim-monokai-pro' -Plug 'aradunovic/perun.vim' -Plug 'jacoborus/tender.vim' -Plug 'mkarmona/materialbox' -Plug 'ajmwagar/vim-deus' -Plug 'rhysd/vim-color-spring-night' -Plug 'nightsense/carbonized' -Plug 'nightsense/forgotten' -Plug 'nightsense/seagrey' -Plug 'nightsense/vrunchbang' -Plug 'mhartington/oceanic-next' -Plug 'rakr/vim-two-firewatch' -Plug 'zeis/vim-kolor' -Plug 'sjl/badwolf' -Plug 'tomasr/molokai' -Plug 'fmoralesc/molokayo' -Plug 'junegunn/seoul256.vim' -Plug 'w0ng/vim-hybrid' -Plug 'goatslacker/mango.vim' -Plug 'dracula/vim', { 'as': 'dracula' } -Plug 'morhetz/gruvbox' -Plug 'ayu-theme/ayu-vim' -Plug 'jnurmine/Zenburn' -Plug 'nanotech/jellybeans.vim' -Plug 'altercation/vim-colors-solarized' -Plug 'lifepillar/vim-solarized8' -Plug 'NLKNguyen/papercolor-theme' - -call plug#end() - - -set background=dark -"colorscheme badwolf -colorscheme snow - -"autocmd SwapExists * let v:swapchoice="o" -function! DeleteFileSwaps() - write - let l:output = '' - redir => l:output - silent exec ':sw' - redir END - let l:current_swap_file = substitute(l:output, '\n', '', '') - let l:base = substitute(l:current_swap_file, '\v\.\w+$', '', '') - let l:swap_files = split(glob(l:base.'\.s*')) - " delete all except the current swap file - for l:swap_file in l:swap_files - if !empty(glob(l:swap_file)) && l:swap_file != l:current_swap_file - call delete(l:swap_file) - echo "swap file removed: ".l:swap_file - endif - endfor - " Reset swap file extension to `.swp`. - set swf! | set swf! - echo "Reset swap file extension for file: ".expand('%') -endfunction -command! DeleteFileSwaps :call DeleteFileSwaps() - - -nnoremap cd :lcd %:p:h - -tnoremap - -let g:comfortable_motion_no_default_key_mappings = 1 -let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value. -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 1) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -1) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2) - -"set scrolloff=2 - -function! FullScreenToggle() - if g:GuiWindowFullScreen==1 - call GuiWindowFullScreen(0) - else - call GuiWindowFullScreen(1) - endif -endfunction - -function! MaximizedToggle() - if g:GuiWindowMaximized==1 - call GuiWindowMaximized(0) - else - call GuiWindowMaximized(1) - endif -endfunction - -nnoremap :call MaximizedToggle() -nnoremap :call FullScreenToggle() -nnoremap = - - -let $NVIM_TUI_ENABLE_TRUE_COLOR=1 - -"let g:LatexBox_latexmk_async=1 - -"let g:LatexBox_latexmk_options="-synctex=1 -shell-escape" - -"let g:LatexBox_quickfix=2 - -"let g:LatexBox_viewer="SumatraPDF -reuse-instance" - -let g:polyglot_disabled = ['latex'] - -let g:vimtex_compiler_latexmk = { - \ 'backend' : 'nvim', - \ 'background' : 1, - \ 'build_dir' : '', - \ 'callback' : 1, - \ 'continuous' : 0, - \ 'executable' : 'latexmk', - \ 'options' : [ - \ '-verbose', - \ '-file-line-error', - \ '-synctex=1', - \ '-interaction=nonstopmode', - \ '-shell-escape', - \ ], - \} - -"augroup vimtex_config - "au! - "au User VimtexEventQuit call vimtex#compiler#clean(0) -"augroup END -let g:vimtex_quickfix_mode = 1 -let g:vimtex_quickfix_open_on_warning = 0 -let g:vimtex_view_enabled = 1 -let g:vimtex_view_general_viewer = 'termux-open' -" let g:vimtex_view_general_options = '--chooser' -" let g:vimtex_view_general_options_latexmk = '-reuse-instance' - -if g:use_pandoc_markdown - let g:pandoc#syntax#conceal#use = 0 - let g:pandoc#formatting#mode="sa" - let g:pandoc#formatting#smart_autoformat_on_cursormoved=1 -endif - -if g:use_javacomplete==1 - autocmd FileType java setlocal omnifunc=javacomplete#Complete -endif -if g:use_deoplete==1 - let g:deoplete#enable_at_startup = 1 -endif - -if g:use_python == 1 - let g:table_mode_corner_corner='+' - let g:table_mode_header_fillchar='=' -endif - -if g:use_airline==1 - " air-line - - let g:airline_powerline_fonts = 1 - if !exists('g:airline_symbols') - let g:airline_symbols = {} - if g:use_font==0 - let g:airline_left_sep = '' - let g:airline_right_sep = '' - let g:airline_symbols.linenr = '␊' - let g:airline_symbols.linenr = '␤' - let g:airline_symbols.linenr = '¶' - let g:airline_symbols.branch = '⎇' - let g:airline_symbols.paste = 'ρ' - let g:airline_symbols.paste = 'Þ' - let g:airline_symbols.paste = '∥' - let g:airline_symbols.whitespace = 'Ξ' - endif - endif - - "" unicode symbols - "let g:airline_left_sep = '»' - "let g:airline_left_sep = '▶' - "let g:airline_right_sep = '«' - "let g:airline_right_sep = '◀' - "let g:airline_symbols.linenr = '␊' - "let g:airline_symbols.linenr = '␤' - "let g:airline_symbols.linenr = '¶' - "let g:airline_symbols.branch = '⎇' - "let g:airline_symbols.paste = 'ρ' - "let g:airline_symbols.paste = 'Þ' - "let g:airline_symbols.paste = '∥' - "let g:airline_symbols.whitespace = 'Ξ' - "" airline symbols - "let g:airline_left_sep = '' - "let g:airline_left_alt_sep = '' - "let g:airline_right_sep = '' - "let g:airline_right_alt_sep = '' - "let g:airline_symbols.branch = '' - "let g:airline_symbols.readonly = '' - "let g:airline_symbols.linenr = '' - - "let g:airline_theme = "badwolf" - let g:airline_theme = "deus" -endif - -if g:use_sound==1 - call orchestra#prelude() - - call orchestra#set_tune('bubbletrouble') -endif - -let g:livedown_autorun = 0 - -let g:livedown_open = 1 - -let g:livedown_port = 1337 - -let g:livedown_browser = "firefox -P livedown" - -let g:confirm_new_file = 1 - -let g:wiki_history = {} - -"nmap Ox -"nmap ox -"inoremap `^ - -map n :NERDTreeToggle - -"nmap >> -"nmap << - -"vmap >> -"vmap << - -" nnoremap o o -" nnoremap O O - -nnoremap Q - -nmap m :LivedownToggle - -let g:data = [] -function! g:JobHandler(job_id, data, event) - if a:event == 'stdout' || a:event == 'stderr' - echom '>> ' . substitute(join(a:data), "\^M", "\r", "g") - else - echom 'Job ' . a:job_id . ' finished' - - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - if item == a:job_id - call remove(g:jobs, index) - endif - let index = index + 1 - endwhile - - if string(a:data) != "0" - echoerr 'Program terminated with exit code ' . string(a:data) - endif - endif - - "call append(line('$'), str) -endfunction - -let g:callbacks = { - \ 'on_stdout': function('g:JobHandler'), - \ 'on_stderr': function('g:JobHandler'), - \ 'on_exit': function('g:JobHandler') - \ } - -let g:callbacks_no_out = { - \ 'on_exit': function('g:JobHandler') - \ } - -"function! Stdout(job_id, data, event) - "echom 'Job ' . a:job_id . ': >>' . join(a:data) - "" echom 'stdout: ' . a:data[0] -"endfunction - -" function! Stderr(job_id, data, event) -" echoerr 'Job ' . a:job_id . ': >>' . join(a:data) -" endfunction - -"function! PrintFinished(job_id, data, event) - "echom 'Job ' . a:job_id . ' finished with exit code: ' . string(a:data) -"endfunction - -function! OpenPdf() - if g:use_async==1 - let pdf_path = "" - - if g:latex_use_outdir==1 - let pdf_path = expand('%:r') . "_" . g:latex_outdir . "/" . expand('%:t:r') . ".pdf" - else - let pdf_path = expand('%:r') . ".pdf" - endif - - let pdf_job = jobstart(g:pdf_viewer . " " . pdf_path) - echom "Started PDF-Viewer with job_id " . pdf_job - "execute("AsyncRun " . g:pdf_viewer . " " . expand('%:r') . ".pdf") - let g:open_pdf=0 - else - execute("!" . g:pdf_viewer. " " . expand('%:r') . ".pdf") - endif -endfunction - -function! ConvertPandoc(attr) - let command = "" - if a:attr == "md-to-pdf" - let command = "pandoc -s " . @% . " --from=markdown+escaped_line_breaks -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-html-to-pdf" - let command = "pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-to-html" - let command = "pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" - elseif a:attr == "latex-to-pdf" - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" - endif - - " if g:use_async==1 - " execute("AsyncRun " . command) - " else - "let g:pandoc#command#autoexec_command="call jobstart('pandoc -s " . @% . " --from=markdown -o " . expand('%:r') . ".pdf')" - if g:use_async==1 - " let g:current_job = jobstart('pandoc -s ' . expand('%') . ' --from=markdown -o ' . expand('%:r') . '.pdf', {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'on_stdout': function('Stdout'), 'on_stderr': function('Stdout'), 'on_exit': function('PrintFinished')}) - " - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - else - execute("!" . command) - echom "Compilation finished" - endif - " endif - - if g:open_pdf==1 - call OpenPdf() normal - endif -endfunction - -function! g:ExitedWithCode(job_id, data, event) - echom "Job " . a:job_id . " exited with code: " . string(a:data) -endfunction - -function! ConvertPandocPdfLatexDebug() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPandocPdfLatex() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - if g:use_async==1 - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Conversion from " . @% . " to " . expand('%:r') . ".tex finished" - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if result[0]==-1 - echom "Generation of " . expand('%:r') . ".pdf timed out" - elseif result[0]==-2 - echom "Generation of " . expand('%:r') . ".pdf terminated" - elseif result[0]==-3 - echom "INVALID JOB-ID: Generation of " . expand('%:r') . ".pdf terminated" - else - echom "Generation of " . expand('%:r') . ".pdf finished" - - if g:latexmk_use==1 - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif - endif - endif - else - execute("!" . command) - echom "Conversion finished" - execute("!" . pdf_command) - echom "Compilation finished" - - if g:latexmk_use==1 - execute("!" . pdf_cleanup) - echom "Cleanup finished" - endif - endif -endfunction - -"nmap pm :execute "! pandoc " . @% . " --from=markdown -o " . expand('%:r') . ".pdf" -"nmap pM :execute "! pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" -"nmap ph :execute "! pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" -"nmap pl :execute "! pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" -au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us - -nmap pm :call ConvertPandoc("md-to-pdf") -nmap pM :call ConvertPandoc("md-html-to-pdf") -nmap ph :call ConvertPandoc("md-to-html") -nmap pl :call ConvertPandocPdfLatex() -nmap pd :call ConvertPandocPdfLatexDebug() -nmap pp :AsyncStop:call OpenPdf() -nmap po :AsyncStop:AsyncRunsumatrapdf - - -function! ConvertPdfLatexDebug() - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPdfLatex() - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . expand('%:r') . ".tex" - - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif -endfunction - -function! CleanLatexDir(full) - if a:full==0 - let clean="c" - else - let clean="C" - endif - - let curr_dir = getcwd() - execute("cd " . expand('%:p:h')) - - "let pdf_cleanup = "latexmk -" . clean . " " . expand('%:r') . ".tex" - - let pdf_cleanup = "latexmk -" . clean - - execute("!" . pdf_cleanup) - execute("cd " . curr_dir) -endfunction - -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -nnoremap lc :call CleanLatexDir(0) -nnoremap lC :call CleanLatexDir(1) -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -"nnoremap lc :! latexmk -c -"nnoremap lC :! latexmk -C - -function! NewLatexTemplate() - let filename = input('Please specify the filename: ') - if filename!="" - let command = "Templator " . expand('%:p:h') . "/latex " . filename - echom command - execute(command) - endif -endfunction - -nnoremap ln :call NewLatexTemplate() -nnoremap pn :call NewLatexTemplate() - -function! ToggleCompileOnSave() - if g:compile_on_save == 1 - let g:compile_on_save=0 - echom "Compile on save is now turned OFF" - else - let g:compile_on_save=1 - echom "Compile on save is now turned ON" - endif -endfunction - -nmap pc :call ToggleCompileOnSave() - -function! ConvertPandocOnSave(args) - if g:compile_on_save == 1 - call ConvertPandoc(a:args) - execute "normal \" - endif -endfunction - -"autocmd FileType pandoc autocmd BufWritePost call ConvertPandoc(g:pandoc_default) | execute("normal \") -autocmd FileType pandoc silent autocmd BufWritePost silent! call ConvertPandocOnSave(g:pandoc_default) -" autocmd FileType tex silent autocmd BufWritePost silent! call ConvertPandoc("latex-to-pdf") - -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap + + -nnoremap - - -nnoremap < < -nnoremap > > -nnoremap _ _ -nnoremap -nnoremap = = -nnoremap T T - -nnoremap e :e -nnoremap t :tabe - -set splitbelow -set splitright - -nmap gB :buffers -nmap gb :buffer - -nnoremap § ` - -filetype plugin on -syntax on - - -" vimwiki stuff " -" Run multiple wikis " - -let g:vimwiki_list = [ - \{'path': "D:/Projects/BrainWiki", - \ 'syntax': 'markdown', 'ext': '.wiki'} - \] - -"au BufRead,BufNewFile *.wiki set filetype=vimwiki -"function! ToggleCalendar() -"execute ":Calendar" -"if exists("g:calendar_open") -"if g:calendar_open == 1 -"execute "q" -"unlet g:calendar_open -"else -"g:calendar_open = 1 -"end -"else -"let g:calendar_open = 1 -"end -"endfunction -":autocmd FileType vimwiki map c :call ToggleCalendar() - -function! GetSelection() range - echo a:firstline - echo a:lastline - let selectedText = getline(a:firstline,a:lastline) - echo selectedText - call FilterSelection(join(selectedText)) -endfunction - -function! FilterSelection(text) - if a:text =~ ">>>" - call FileHandler(a:text) - else - let text_no_spaces = substitute(a:text, "[ \n]", "", "g") - call FileHandler(text_no_spaces) - endif -endfunction - -function! BuffersList() - let all = range(0, bufnr('$')) - let res = [] - for b in all - if bufexists(b) - call add(res, bufname(b)) - endif - endfor - return res -endfunction - -function! IsInBuffersList(text) - for b in BuffersList() - if b =~ a:text - return 1 - endif - endfor - return 0 -endfunction - -function! FileHandler(text) - if a:text =~ "(" && a:text =~ ")" - let filename = matchstr(a:text, '(.\{-})') - let substituted = matchstr(filename, '[^\(].*[^\)]') - if substituted =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - try - let confirmed = 1 - let buffer_exists = 0 - if IsInBuffersList(substituted) == 1 - let buffer_exists = 1 - endif - if empty(glob(substituted)) && buffer_exists == 0 - echom "File does not exist" - let g:confirm_new_file = 1 - else - let g:confirm_new_file = 0 - endif - - echom g:confirm_new_file - - if g:confirm_new_file == 1 - let val = input('Do you want to create a new file "'. substituted . '" [y]es/[N]o? ') - if val !~? '^y' - let confirmed = 0 - else - let confirmed = 1 - endif - endif - - echom "File exists or is open" - if confirmed == 1 - let g:wiki_history[substituted] = expand('%:p') - execute('e %:h/' . substituted) - else - echom "You aborted the file creation! please also remove the link from the document!" - endif - catch /./ - echoerr 'An error occured during file creation: ' . v:exception - endtry - endif - else - if a:text =$ "\\$" - let substituted = substitute(a:text, ".*\\$", "", "g") - echom substituted - "let substituted = matchstr(substituted, '[^>>>].*') - let text_no_spaces = substitute(substituted, "[\n]", "", "g") - let text_no_spaces = substitute(text_no_spaces, "[ ]", "_", "g") - if text_no_spaces !~ ".md" - let text_no_spaces .= ".md" - endif - if text_no_spaces =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - "call setline(".", "[" . substituted . "](" . substituted . ")") - "execute("normal! ddO[" . substituted . "](" . text_no_spaces . ")") - execute("normal! 0f$c$[" . substituted . "](" . text_no_spaces . ")") - "call FileHandler("(" . text_no_spaces . ")") - endif - endif - endif -endfunction - -function! GetLine() - let currentLine = getline(".") - call FilterSelection(currentLine) -endfunction - -function! GoBackNew() - echom expand('%:t') - if has_key(g:wiki_history, expand('%:t')) - let parent = remove(g:wiki_history, expand('%:t')) - echom parent - execute("e " . parent) - else - echom "Nothing to go back to!" - endif -endfunction - -function! GoBack() - execute('e#') -endfunction - -command! -range GetSelectionInRange ,call GetSelection() - -nmap :silent :call GetLine() -vmap :silent :GetSelectionInRange - -map :silent :call GoBackNew() - -function! StartHttp() - if g:http_server != '' - echom "A server seems to be running already with process id " . g:http_server - echom "Stopping it first" - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server -endfunction - -function! StopHttp() - if g:http_server == '' - echoerr "There seems to be no server running" - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -function! ToggleHttp() - if g:http_server == '' - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -command! StartHttp call StartHttp() -command! StopHttp call StopHttp() -command! ToggleHttp call ToggleHttp() - -map s :ToggleHttp - -function! CodeBlock() - let val = input('Choose your coding language - leave blank for no syntax-highlighting: ') - execute("normal! S```" . val . "o```Ox") -endfunction - -function! MakeTable() - let count = input('How many columns would you like to have? ') - if count == "" - return - endif - let col_nr = str2nr(count) - let col_headers = [] - while col_nr > 0 - let val = input('Enter the column heading: ') - while len(val) < 3 - let val .= " " - endwhile - call add(col_headers, val) - let col_nr -= 1 - endwhile - let headings = "| " - let divider = "| " - let i = 0 - for heading in col_headers - let headings .= col_headers[i] . " | " - let j = 0 - let div_tmp = "" - while j < len(col_headers[i]) - let div_tmp .= "-" - let j += 1 - endwhile - let div_tmp .= " | " - let divider .= div_tmp - let i += 1 - endfor - execute("normal! S" . headings) - execute("normal! o" . divider) -endfunction - -inoremap :silent :call CodeBlock() -nmap :silent :call CodeBlock() - -" inoremap :silent :call MakeTable() -" nmap :silent :call MakeTable() -inoremap :TableModeToggle -nmap :TableModeToggle - -function! Heading() - execute("normal! O[ Back to the landing page](index.md)") - execute("normal! o# BrainOdin") - execute("normal! o") - execute("normal! j") -endfunction - -"inoremap :silent :call Heading() -nmap :silent :call Heading() -map :set relativenumber! -nmap c -vmap c - -set number -set relativenumber - -autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber -autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber - -"hi LineNr guifg=#B0BEC5 -"hi CursorLineNr guifg=#64FFDA - -set ignorecase -set smartcase -set backspace=indent,eol,start -set confirm - -function! WriteFolds() - let filename=expand('%:r') . ".fold" - execute("mkview! " . filename) -endfunction - -function! SaveFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("mkview! " . filename) - endif -endfunction - -function! ReadFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("source " . filename) - endif -endfunction - -let g:vimtex_fold_enabled=1 -"if g:manual_fold_autoload==1 - "set foldmethod=manual - "autocmd BufWinLeave,WinLeave,BufWritePost * call SaveFolds() - "autocmd BufWinEnter * call ReadFolds() - "autocmd InsertLeave,WinEnter * setlocal foldmethod=manual - "autocmd InsertEnter,WinLeave * setlocal foldmethod=manual -"else - "set foldmethod=indent - "set foldlevel=1 - ""set foldclose=all -"endif - -nmap fw :call WriteFolds() -" nmap fl :source expand('%:r') . ".fold" - -set incsearch - -set clipboard=unnamedplus - -nmap h :noh - -nmap . :bnext -nmap , :bprev - -inoremap p unique_ptr<>i -nnoremap p iunique_ptr<>i - -inoremap m make_unique<>i -noremap m imake_unique<>i diff --git a/Windows/ginit.vim b/Windows/ginit.vim deleted file mode 100644 index 3910db0..0000000 --- a/Windows/ginit.vim +++ /dev/null @@ -1,9 +0,0 @@ -set nocompatible - -if g:use_font==1 - set guifont=Hack:h14 - Guifont! Hack:h14 -else - set guifont=Consolas:h14 - Guifont! Consolas:h14 -endif diff --git a/Windows/init.vim b/Windows/init.vim deleted file mode 100644 index 7679fd2..0000000 --- a/Windows/init.vim +++ /dev/null @@ -1,1069 +0,0 @@ -set nocompatible - -set termguicolors - -set mouse=a - -let mapleader="-" -let maplocalleader="-" - -set wrap linebreak nolist -set breakindent -set breakindentopt=shift:4 - -set showbreak=↳ -set list -set listchars=tab:•\ ,trail:•,extends:⟩,precedes:⟨ -set shortmess=a -set tabstop=4 -set shiftwidth=4 -set smartindent -set autoindent -set diffopt=filler,vertical - -let g:use_javacomplete=0 - -let g:use_python=1 -let g:use_async=1 -let g:use_airline=1 -let g:use_sound=1 -let g:use_font=1 -let g:use_deoplete=1 -let g:use_pandoc_markdown=1 -let g:compile_on_save=0 -let g:open_pdf=0 -let g:pdf_viewer="sumatrapdf" -let g:pandoc_output="pandoc_output" -let g:pandoc_default="md-to-pdf" -let g:latexmk_use=1 -let g:latexmk_clean=1 -let g:latex_use_outdir=0 -let g:latex_outdir="output" - -let g:tex_indent_items=0 -let g:tex_items='' - -let g:manual_fold_autoload=1 - -let g:jobs=[] - -let g:http_server='' - -let g:indentguides_tabchar = '│' - -call plug#begin() -Plug 'scrooloose/nerdcommenter' -Plug 'shime/vim-livedown' - -if g:use_sound==1 - Plug 'https://github.com/timeyyy/orchestra.nvim.git' - Plug 'https://github.com/timeyyy/bubbletrouble.symphony.git' - Plug 'https://github.com/timeyyy/clackclack.symphony' -endif - -if g:use_airline==1 - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' -endif - -if g:use_deoplete==1 - if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif -endif -"Plug 'thaerkh/vim-indentguides' - -Plug 'ap/vim-buftabline' - -if g:use_pandoc_markdown==1 - Plug 'vim-pandoc/vim-pandoc-syntax' -endif -Plug 'vim-pandoc/vim-pandoc' -Plug 'sheerun/vim-polyglot' -Plug 'scrooloose/nerdtree' -if g:use_python==1 - Plug 'dhruvasagar/vim-table-mode' -endif -if g:use_async==1 - Plug 'skywind3000/asyncrun.vim' -endif - -if g:use_javacomplete==1 - Plug 'artur-shaik/vim-javacomplete2' -endif - -Plug 'lervag/vimtex' -" Plug 'LaTeX-Box-Team/LaTeX-Box' -Plug 'tomtom/templator_vim' -"Plug 'xuhdev/vim-latex-live-preview' - -Plug 'yuttie/comfortable-motion.vim' - -Plug 'ARM9/snes-syntax-vim' -Plug 'philj56/vim-asm-indent' - -" Colorschemes -Plug 'haishanh/night-owl.vim' -Plug 'BrainDeath0/Hypsteria' -Plug 'sts10/vim-pink-moon' -Plug 'nightsense/snow' -Plug 'edouardp/myob-colorscheme' -Plug 'kaicataldo/material.vim' -Plug 'phanviet/vim-monokai-pro' -Plug 'aradunovic/perun.vim' -Plug 'jacoborus/tender.vim' -Plug 'mkarmona/materialbox' -Plug 'ajmwagar/vim-deus' -Plug 'rhysd/vim-color-spring-night' -Plug 'nightsense/carbonized' -Plug 'nightsense/forgotten' -Plug 'nightsense/seagrey' -Plug 'nightsense/vrunchbang' -Plug 'mhartington/oceanic-next' -Plug 'rakr/vim-two-firewatch' -Plug 'zeis/vim-kolor' -Plug 'sjl/badwolf' -Plug 'tomasr/molokai' -Plug 'fmoralesc/molokayo' -Plug 'junegunn/seoul256.vim' -Plug 'w0ng/vim-hybrid' -Plug 'goatslacker/mango.vim' -Plug 'dracula/vim', { 'as': 'dracula' } -Plug 'morhetz/gruvbox' -Plug 'ayu-theme/ayu-vim' -Plug 'jnurmine/Zenburn' -Plug 'nanotech/jellybeans.vim' -Plug 'altercation/vim-colors-solarized' -Plug 'lifepillar/vim-solarized8' -Plug 'NLKNguyen/papercolor-theme' - -call plug#end() - - -set background=dark -"colorscheme badwolf -colorscheme snow - -"autocmd SwapExists * let v:swapchoice="o" -function! DeleteFileSwaps() - write - let l:output = '' - redir => l:output - silent exec ':sw' - redir END - let l:current_swap_file = substitute(l:output, '\n', '', '') - let l:base = substitute(l:current_swap_file, '\v\.\w+$', '', '') - let l:swap_files = split(glob(l:base.'\.s*')) - " delete all except the current swap file - for l:swap_file in l:swap_files - if !empty(glob(l:swap_file)) && l:swap_file != l:current_swap_file - call delete(l:swap_file) - echo "swap file removed: ".l:swap_file - endif - endfor - " Reset swap file extension to `.swp`. - set swf! | set swf! - echo "Reset swap file extension for file: ".expand('%') -endfunction -command! DeleteFileSwaps :call DeleteFileSwaps() - - -nnoremap cd :lcd %:p:h - -tnoremap - -let g:comfortable_motion_no_default_key_mappings = 1 -let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value. -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 1) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -1) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2) -nnoremap :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2) - -"set scrolloff=2 - -function! FullScreenToggle() - if g:GuiWindowFullScreen==1 - call GuiWindowFullScreen(0) - else - call GuiWindowFullScreen(1) - endif -endfunction - -function! MaximizedToggle() - if g:GuiWindowMaximized==1 - call GuiWindowMaximized(0) - else - call GuiWindowMaximized(1) - endif -endfunction - -nnoremap :call MaximizedToggle() -nnoremap :call FullScreenToggle() -nnoremap = - - -let $NVIM_TUI_ENABLE_TRUE_COLOR=1 - -"let g:LatexBox_latexmk_async=1 - -"let g:LatexBox_latexmk_options="-synctex=1 -shell-escape" - -"let g:LatexBox_quickfix=2 - -"let g:LatexBox_viewer="SumatraPDF -reuse-instance" - -let g:polyglot_disabled = ['latex'] - -let g:vimtex_compiler_latexmk = { - \ 'backend' : 'nvim', - \ 'background' : 1, - \ 'build_dir' : '', - \ 'callback' : 1, - \ 'continuous' : 0, - \ 'executable' : 'latexmk', - \ 'options' : [ - \ '-verbose', - \ '-file-line-error', - \ '-synctex=1', - \ '-interaction=nonstopmode', - \ '-shell-escape', - \ ], - \} - -"augroup vimtex_config - "au! - "au User VimtexEventQuit call vimtex#compiler#clean(0) -"augroup END -let g:vimtex_quickfix_mode = 1 -let g:vimtex_quickfix_open_on_warning = 0 -let g:vimtex_view_general_viewer = 'SumatraPDF' -let g:vimtex_view_general_options = '-reuse-instance -forward-search @tex @line @pdf' -let g:vimtex_view_general_options_latexmk = '-reuse-instance' - -if g:use_pandoc_markdown - let g:pandoc#syntax#conceal#use = 0 - let g:pandoc#formatting#mode="sa" - let g:pandoc#formatting#smart_autoformat_on_cursormoved=1 -endif - -if g:use_javacomplete==1 - autocmd FileType java setlocal omnifunc=javacomplete#Complete -endif -if g:use_deoplete==1 - let g:deoplete#enable_at_startup = 1 -endif - -if g:use_python == 1 - let g:table_mode_corner_corner='+' - let g:table_mode_header_fillchar='=' -endif - -if g:use_airline==1 - " air-line - - let g:airline_powerline_fonts = 1 - if !exists('g:airline_symbols') - let g:airline_symbols = {} - if g:use_font==0 - let g:airline_left_sep = '' - let g:airline_right_sep = '' - let g:airline_symbols.linenr = '␊' - let g:airline_symbols.linenr = '␤' - let g:airline_symbols.linenr = '¶' - let g:airline_symbols.branch = '⎇' - let g:airline_symbols.paste = 'ρ' - let g:airline_symbols.paste = 'Þ' - let g:airline_symbols.paste = '∥' - let g:airline_symbols.whitespace = 'Ξ' - endif - endif - - "" unicode symbols - "let g:airline_left_sep = '»' - "let g:airline_left_sep = '▶' - "let g:airline_right_sep = '«' - "let g:airline_right_sep = '◀' - "let g:airline_symbols.linenr = '␊' - "let g:airline_symbols.linenr = '␤' - "let g:airline_symbols.linenr = '¶' - "let g:airline_symbols.branch = '⎇' - "let g:airline_symbols.paste = 'ρ' - "let g:airline_symbols.paste = 'Þ' - "let g:airline_symbols.paste = '∥' - "let g:airline_symbols.whitespace = 'Ξ' - "" airline symbols - "let g:airline_left_sep = '' - "let g:airline_left_alt_sep = '' - "let g:airline_right_sep = '' - "let g:airline_right_alt_sep = '' - "let g:airline_symbols.branch = '' - "let g:airline_symbols.readonly = '' - "let g:airline_symbols.linenr = '' - - "let g:airline_theme = "badwolf" - let g:airline_theme = "deus" -endif - -if g:use_sound==1 - call orchestra#prelude() - - call orchestra#set_tune('bubbletrouble') -endif - -let g:livedown_autorun = 0 - -let g:livedown_open = 1 - -let g:livedown_port = 1337 - -let g:livedown_browser = "firefox -P livedown" - -let g:confirm_new_file = 1 - -let g:wiki_history = {} - -"nmap Ox -"nmap ox -"inoremap `^ - -map n :NERDTreeToggle - -"nmap >> -"nmap << - -"vmap >> -"vmap << - -" nnoremap o o -" nnoremap O O - -nnoremap Q - -nmap m :LivedownToggle - -let g:data = [] -function! g:JobHandler(job_id, data, event) - if a:event == 'stdout' || a:event == 'stderr' - echom '>> ' . substitute(join(a:data), "\^M", "\r", "g") - else - echom 'Job ' . a:job_id . ' finished' - - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - if item == a:job_id - call remove(g:jobs, index) - endif - let index = index + 1 - endwhile - - if string(a:data) != "0" - echoerr 'Program terminated with exit code ' . string(a:data) - endif - endif - - "call append(line('$'), str) -endfunction - -let g:callbacks = { - \ 'on_stdout': function('g:JobHandler'), - \ 'on_stderr': function('g:JobHandler'), - \ 'on_exit': function('g:JobHandler') - \ } - -let g:callbacks_no_out = { - \ 'on_exit': function('g:JobHandler') - \ } - -"function! Stdout(job_id, data, event) - "echom 'Job ' . a:job_id . ': >>' . join(a:data) - "" echom 'stdout: ' . a:data[0] -"endfunction - -" function! Stderr(job_id, data, event) -" echoerr 'Job ' . a:job_id . ': >>' . join(a:data) -" endfunction - -"function! PrintFinished(job_id, data, event) - "echom 'Job ' . a:job_id . ' finished with exit code: ' . string(a:data) -"endfunction - -function! OpenPdf() - if g:use_async==1 - let pdf_path = "" - - if g:latex_use_outdir==1 - let pdf_path = expand('%:r') . "_" . g:latex_outdir . "/" . expand('%:t:r') . ".pdf" - else - let pdf_path = expand('%:r') . ".pdf" - endif - - let pdf_job = jobstart(g:pdf_viewer . " " . pdf_path) - echom "Started PDF-Viewer with job_id " . pdf_job - "execute("AsyncRun " . g:pdf_viewer . " " . expand('%:r') . ".pdf") - let g:open_pdf=0 - else - execute("!" . g:pdf_viewer. " " . expand('%:r') . ".pdf") - endif -endfunction - -function! ConvertPandoc(attr) - let command = "" - if a:attr == "md-to-pdf" - let command = "pandoc -s " . @% . " --from=markdown+escaped_line_breaks -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-html-to-pdf" - let command = "pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" - elseif a:attr == "md-to-html" - let command = "pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" - elseif a:attr == "latex-to-pdf" - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" - endif - - " if g:use_async==1 - " execute("AsyncRun " . command) - " else - "let g:pandoc#command#autoexec_command="call jobstart('pandoc -s " . @% . " --from=markdown -o " . expand('%:r') . ".pdf')" - if g:use_async==1 - " let g:current_job = jobstart('pandoc -s ' . expand('%') . ' --from=markdown -o ' . expand('%:r') . '.pdf', {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'out_io': 'buffer', 'out_name': g:pandoc_output}) - " let g:current_job = jobstart(command, {'on_stdout': function('Stdout'), 'on_stderr': function('Stdout'), 'on_exit': function('PrintFinished')}) - " - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - else - execute("!" . command) - echom "Compilation finished" - endif - " endif - - if g:open_pdf==1 - call OpenPdf() normal - endif -endfunction - -function! g:ExitedWithCode(job_id, data, event) - echom "Job " . a:job_id . " exited with code: " . string(a:data) -endfunction - -function! ConvertPandocPdfLatexDebug() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPandocPdfLatex() - let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex" - - let output = "" - if g:latex_use_outdir==1 - let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir - else - let output = "" - endif - - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - if g:use_async==1 - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(command, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running ' . command . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Conversion from " . @% . " to " . expand('%:r') . ".tex finished" - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if result[0]==-1 - echom "Generation of " . expand('%:r') . ".pdf timed out" - elseif result[0]==-2 - echom "Generation of " . expand('%:r') . ".pdf terminated" - elseif result[0]==-3 - echom "INVALID JOB-ID: Generation of " . expand('%:r') . ".pdf terminated" - else - echom "Generation of " . expand('%:r') . ".pdf finished" - - if g:latexmk_use==1 - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif - endif - endif - else - execute("!" . command) - echom "Conversion finished" - execute("!" . pdf_command) - echom "Compilation finished" - - if g:latexmk_use==1 - execute("!" . pdf_cleanup) - echom "Cleanup finished" - endif - endif -endfunction - -"nmap pm :execute "! pandoc " . @% . " --from=markdown -o " . expand('%:r') . ".pdf" -"nmap pM :execute "! pandoc --katex --highlight-style=zenburn -t html5 --css=file:///D:/Pandoc/katex_style.css " . @% . " -o " . expand('%:r') . ".pdf" -"nmap ph :execute "! pandoc " . @% . " -s --katex --css=file:///D:/Pandoc/katex_style.css -o " . expand('%:r') . ".html" -"nmap pl :execute "! pandoc " . @% . " -s -o " . expand('%:r') . ".pdf" -au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=de_de -au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us - -nmap pm :call ConvertPandoc("md-to-pdf") -nmap pM :call ConvertPandoc("md-html-to-pdf") -nmap ph :call ConvertPandoc("md-to-html") -nmap pl :call ConvertPandocPdfLatex() -nmap pd :call ConvertPandocPdfLatexDebug() -nmap pp :AsyncStop:call OpenPdf() -nmap po :AsyncStop:AsyncRunsumatrapdf - - -function! AsciiDoctor() - execute("!asciidoctor " . expand('%')) -endfunction - -nmap a :call AsciiDoctor() - - -function! ConvertPdfLatexDebug() - if g:latexmk_use==1 - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . output . " " . expand('%:r') . ".tex" - else - let pdf_command = "pdflatex -shell-escape " . output . " " . expand('%:r') . ".tex" - endif - - execute("!" . command) - execute("!" . pdf_command) -endfunction - -function! ConvertPdfLatex() - let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . expand('%:r') . ".tex" - let pdf_cleanup = "latexmk -c " . expand('%:r') . ".tex" - - if len(g:jobs) > 0 - let index = 0 - while index < len(g:jobs) - let item = g:jobs[index] - call jobstop(item) - let index = index + 1 - endwhile - endif - - let current_job = jobstart(pdf_command, g:callbacks_no_out) - call insert(g:jobs, current_job) - echom 'Running ' . pdf_command . ' with Job-Nr. ' . current_job - - let result = jobwait([current_job], 120000) - - if g:latexmk_clean==1 - let current_job = jobstart(pdf_cleanup, g:callbacks) - call insert(g:jobs, current_job) - echom 'Running' . pdf_cleanup . ' with Job-Nr. ' . current_job - - call jobwait([current_job], 30000) - - echom "Cleaned up for " . expand('%:r') - endif -endfunction - -function! CleanLatexDir(full) - if a:full==0 - let clean="c" - else - let clean="C" - endif - - let curr_dir = getcwd() - execute("cd " . expand('%:p:h')) - - "let pdf_cleanup = "latexmk -" . clean . " " . expand('%:r') . ".tex" - - let pdf_cleanup = "latexmk -" . clean - - execute("!" . pdf_cleanup) - execute("cd " . curr_dir) -endfunction - -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -nnoremap lc :call CleanLatexDir(0) -nnoremap lC :call CleanLatexDir(1) -"nnoremap ll :call ConvertPdfLatex() -"nnoremap lL :call ConvertPdfLatexDebug() -"nnoremap lc :! latexmk -c -"nnoremap lC :! latexmk -C - -function! NewLatexTemplate() - let filename = input('Please specify the filename: ') - if filename!="" - let command = "Templator " . expand('%:p:h') . "/latex " . filename - echom command - execute(command) - endif -endfunction - -nnoremap ln :call NewLatexTemplate() -nnoremap pn :call NewLatexTemplate() - -function! ToggleCompileOnSave() - if g:compile_on_save == 1 - let g:compile_on_save=0 - echom "Compile on save is now turned OFF" - else - let g:compile_on_save=1 - echom "Compile on save is now turned ON" - endif -endfunction - -nmap pc :call ToggleCompileOnSave() - -function! ConvertPandocOnSave(args) - if g:compile_on_save == 1 - call ConvertPandoc(a:args) - execute "normal \" - endif -endfunction - -"autocmd FileType pandoc autocmd BufWritePost call ConvertPandoc(g:pandoc_default) | execute("normal \") -autocmd FileType pandoc silent autocmd BufWritePost silent! call ConvertPandocOnSave(g:pandoc_default) -" autocmd FileType tex silent autocmd BufWritePost silent! call ConvertPandoc("latex-to-pdf") - -function! AsciidoctorConvert() - execute("!asciidoctor " . expand('%')) -endfunction -function! AsciidoctorPdfConvert() - execute("!asciidoctor-pdf " . expand('%')) -endfunction -function! AsciidoctorEpubConvert() - execute("!asciidoctor-epub3 " . expand('%')) -endfunction - -nmap aa :call AsciidoctorConvert() -nmap ap :call AsciidoctorPdfConvert() -nmap ae :call AsciidoctorEpubConvert() - -function! TermuxOpenFile() - execute("!termux-open " . expand('%')) -endfunction - -function! TermuxOpenHTML() - execute("!firefox " . expand('%:r') . ".html") -endfunction - -function! TermuxOpenPdf() - execute("!sumatrapdf " . expand('%:r') . ".pdf") -endfunction - -function! TermuxOpenEpub() - execute("!ebook-viewer " . expand('%:r') . ".epub") -endfunction - -nmap oo :call TermuxOpenFile() -nmap oh :call TermuxOpenHTML() -nmap op :call TermuxOpenPdf() -nmap oe :call TermuxOpenEpub() - -function! ConvertMarkdownToAsciidoc() - execute ("%s/\\!\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/image:\\2[\\1]/gc") - execute ("%s/\\[\\(.\\{-}\\)\\](\\(.\\{-}\\))/link:\\2[\\1]/gc") - execute("%s/\\#/=/gc") - execute("%s/image:\\(.\\{-}\\) ".\\{-}"\\[/image:\\1[/gc") -endfunction - -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap + + -nnoremap - - -nnoremap < < -nnoremap > > -nnoremap _ _ -nnoremap -nnoremap = = -nnoremap T T - -nnoremap e :e -nnoremap t :tabe - -set splitbelow -set splitright - -nmap gB :buffers -nmap gb :buffer - -nnoremap § ` - -filetype plugin on -syntax on - - -" vimwiki stuff " -" Run multiple wikis " - -let g:vimwiki_list = [ - \{'path': "D:/Projects/BrainWiki", - \ 'syntax': 'markdown', 'ext': '.wiki'} - \] - -"au BufRead,BufNewFile *.wiki set filetype=vimwiki -"function! ToggleCalendar() -"execute ":Calendar" -"if exists("g:calendar_open") -"if g:calendar_open == 1 -"execute "q" -"unlet g:calendar_open -"else -"g:calendar_open = 1 -"end -"else -"let g:calendar_open = 1 -"end -"endfunction -":autocmd FileType vimwiki map c :call ToggleCalendar() - -function! GetSelection() range - echo a:firstline - echo a:lastline - let selectedText = getline(a:firstline,a:lastline) - echo selectedText - call FilterSelection(join(selectedText)) -endfunction - -function! FilterSelection(text) - if a:text =~ ">>>" - call FileHandler(a:text) - else - let text_no_spaces = substitute(a:text, "[ \n]", "", "g") - call FileHandler(text_no_spaces) - endif -endfunction - -function! BuffersList() - let all = range(0, bufnr('$')) - let res = [] - for b in all - if bufexists(b) - call add(res, bufname(b)) - endif - endfor - return res -endfunction - -function! IsInBuffersList(text) - for b in BuffersList() - if b =~ a:text - return 1 - endif - endfor - return 0 -endfunction - -function! FileHandler(text) - if a:text =~ "(" && a:text =~ ")" - let filename = matchstr(a:text, '(.\{-})') - let substituted = matchstr(filename, '[^\(].*[^\)]') - if substituted =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - try - let confirmed = 1 - let buffer_exists = 0 - if IsInBuffersList(substituted) == 1 - let buffer_exists = 1 - endif - if empty(glob(substituted)) && buffer_exists == 0 - echom "File does not exist" - let g:confirm_new_file = 1 - else - let g:confirm_new_file = 0 - endif - - echom g:confirm_new_file - - if g:confirm_new_file == 1 - let val = input('Do you want to create a new file "'. substituted . '" [y]es/[N]o? ') - if val !~? '^y' - let confirmed = 0 - else - let confirmed = 1 - endif - endif - - echom "File exists or is open" - if confirmed == 1 - let g:wiki_history[substituted] = expand('%:p') - execute('e %:h/' . substituted) - else - echom "You aborted the file creation! please also remove the link from the document!" - endif - catch /./ - echoerr 'An error occured during file creation: ' . v:exception - endtry - endif - else - if a:text =$ "\\$" - let substituted = substitute(a:text, ".*\\$", "", "g") - echom substituted - "let substituted = matchstr(substituted, '[^>>>].*') - let text_no_spaces = substitute(substituted, "[\n]", "", "g") - let text_no_spaces = substitute(text_no_spaces, "[ ]", "-", "g") - if text_no_spaces !~ ".md" - let text_no_spaces .= ".md" - endif - if text_no_spaces =~ ":" || substituted =~ "*" || substituted =~ "?" || substituted =~ "\"" || substituted =~ "<" || substituted =~ ">" || substituted =~ "|" - echoerr "Your filename contains invalid characters!" - else - "call setline(".", "[" . substituted . "](" . substituted . ")") - "execute("normal! ddO[" . substituted . "](" . text_no_spaces . ")") - execute("normal! 0f$c$[" . substituted . "](" . text_no_spaces . ")") - "call FileHandler("(" . text_no_spaces . ")") - endif - endif - endif -endfunction - -function! GetLine() - let currentLine = getline(".") - call FilterSelection(currentLine) -endfunction - -function! GoBackNew() - echom expand('%:t') - if has_key(g:wiki_history, expand('%:t')) - let parent = remove(g:wiki_history, expand('%:t')) - echom parent - execute("e " . parent) - else - echom "Nothing to go back to!" - endif -endfunction - -function! GoBack() - execute('e#') -endfunction - -command! -range GetSelectionInRange ,call GetSelection() - -nmap :silent :call GetLine() -vmap :GetSelectionInRange - -map :silent :call GoBackNew() - -function! StartHttp() - if g:http_server != '' - echom "A server seems to be running already with process id " . g:http_server - echom "Stopping it first" - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server -endfunction - -function! StopHttp() - if g:http_server == '' - echoerr "There seems to be no server running" - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -function! ToggleHttp() - if g:http_server == '' - execute("lcd %:p:h") - let g:http_server = jobstart("python -m http.server 1224") - echom "Http server started in directory of the current file with process id " . g:http_server - else - call jobstop(g:http_server) - echom "Http server with process id " . g:http_server . " stopped" - let g:http_server='' - endif -endfunction - -command! StartHttp call StartHttp() -command! StopHttp call StopHttp() -command! ToggleHttp call ToggleHttp() - -map s :ToggleHttp - -function! CodeBlock() - let val = input('Choose your coding language - leave blank for no syntax-highlighting: ') - execute("normal! S```" . val . "o```Ox") -endfunction - -function! MakeTable() - let count = input('How many columns would you like to have? ') - if count == "" - return - endif - let col_nr = str2nr(count) - let col_headers = [] - while col_nr > 0 - let val = input('Enter the column heading: ') - while len(val) < 3 - let val .= " " - endwhile - call add(col_headers, val) - let col_nr -= 1 - endwhile - let headings = "| " - let divider = "| " - let i = 0 - for heading in col_headers - let headings .= col_headers[i] . " | " - let j = 0 - let div_tmp = "" - while j < len(col_headers[i]) - let div_tmp .= "-" - let j += 1 - endwhile - let div_tmp .= " | " - let divider .= div_tmp - let i += 1 - endfor - execute("normal! S" . headings) - execute("normal! o" . divider) -endfunction - -inoremap :silent :call CodeBlock() -nmap :silent :call CodeBlock() - -" inoremap :silent :call MakeTable() -" nmap :silent :call MakeTable() -inoremap :TableModeToggle -nmap :TableModeToggle - -function! Heading() - execute("normal! O[ Back to the landing page](index.md)") - execute("normal! o# BrainOdin") - execute("normal! o") - execute("normal! j") -endfunction - -"inoremap :silent :call Heading() -nmap :silent :call Heading() -map :set relativenumber! -nmap c -vmap c - -set number -set relativenumber - -autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber -autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber - -"hi LineNr guifg=#B0BEC5 -"hi CursorLineNr guifg=#64FFDA - -set ignorecase -set smartcase -set backspace=indent,eol,start -set confirm - -function! WriteFolds() - let filename=expand('%:r') . ".fold" - execute("mkview! " . filename) -endfunction - -function! SaveFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("mkview! " . filename) - endif -endfunction - -function! ReadFolds() - let filename=expand('%:r') . ".fold" - if filereadable(filename) - execute("source " . filename) - endif -endfunction - -let g:vimtex_fold_enabled=1 -"if g:manual_fold_autoload==1 - "set foldmethod=manual - "autocmd BufWinLeave,WinLeave,BufWritePost * call SaveFolds() - "autocmd BufWinEnter * call ReadFolds() - "autocmd InsertLeave,WinEnter * setlocal foldmethod=manual - "autocmd InsertEnter,WinLeave * setlocal foldmethod=manual -"else - "set foldmethod=indent - "set foldlevel=1 - ""set foldclose=all -"endif - -nmap fw :call WriteFolds() -" nmap fl :source expand('%:r') . ".fold" - -set incsearch - -set clipboard=unnamedplus - -nmap h :noh - -nmap . :bnext -nmap , :bprev - -inoremap p unique_ptr<>i -nnoremap p iunique_ptr<>i - -inoremap m make_unique<>i -noremap m imake_unique<>i