2019-03-15 03:46:06 +01:00
|
|
|
|
set nocompatible
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Platform specific settings. Configure your platform in platform.vim, in this dir.
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
runtime platform.vim
|
|
|
|
|
|
|
|
|
|
if g:platform ==? "linux"
|
2019-03-31 14:47:04 +02:00
|
|
|
|
"autocmd VimLeave * set guicursor=a:ver35-blinkon0
|
|
|
|
|
"set guicursor=
|
2020-09-03 19:28:38 +02:00
|
|
|
|
let supported_terminals=["alacritty", "st-256color", "xterm-256color", "screen", "screen-256color"]
|
2020-09-03 19:30:24 +02:00
|
|
|
|
if index(supported_terminals, $TERM) != -1 && has("termguicolors")
|
2020-03-21 19:55:07 +01:00
|
|
|
|
set termguicolors
|
|
|
|
|
else
|
|
|
|
|
set notermguicolors
|
|
|
|
|
|
2020-03-24 01:16:08 +01:00
|
|
|
|
autocmd ColorScheme dracula hi Visual cterm=reverse
|
2020-03-21 19:55:07 +01:00
|
|
|
|
endif
|
2019-09-27 15:25:04 +02:00
|
|
|
|
elseif g:platform ==? "xterm"
|
|
|
|
|
set notermguicolors
|
|
|
|
|
set guicursor=
|
|
|
|
|
set t_Co=
|
2020-08-17 13:55:42 +02:00
|
|
|
|
autocmd ColorScheme dracula hi Visual cterm=reverse
|
2019-03-15 03:46:06 +01:00
|
|
|
|
else
|
|
|
|
|
set termguicolors
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Choose the mapleaders, in my case the spacebar.
|
|
|
|
|
" ===
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let mapleader = " "
|
|
|
|
|
let maplocalleader = " "
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Enable mouse support
|
|
|
|
|
" ===
|
|
|
|
|
set mouse=a
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Set basic options
|
|
|
|
|
" ===
|
2020-03-21 18:14:15 +01:00
|
|
|
|
filetype plugin on
|
|
|
|
|
|
|
|
|
|
set autoindent
|
2020-03-24 01:16:08 +01:00
|
|
|
|
set autoread
|
2020-03-21 18:14:15 +01:00
|
|
|
|
set backspace=indent,eol,start
|
2019-03-15 03:46:06 +01:00
|
|
|
|
set breakindent
|
|
|
|
|
set breakindentopt=shift:4
|
2020-03-21 18:14:15 +01:00
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
|
set confirm
|
|
|
|
|
set diffopt=filler,vertical
|
|
|
|
|
set expandtab
|
|
|
|
|
set ignorecase
|
|
|
|
|
set incsearch
|
2020-04-02 17:45:26 +02:00
|
|
|
|
set linebreak
|
2019-03-15 03:46:06 +01:00
|
|
|
|
set list
|
|
|
|
|
set listchars=trail:·,tab:•\ ,extends:⟩,precedes:⟨
|
2020-03-21 15:52:51 +01:00
|
|
|
|
set number
|
|
|
|
|
set relativenumber
|
2020-03-21 18:14:15 +01:00
|
|
|
|
set scrolloff=1
|
|
|
|
|
set shiftwidth=4
|
|
|
|
|
set shortmess=a
|
2020-03-21 15:52:51 +01:00
|
|
|
|
set smartcase
|
2020-03-21 18:14:15 +01:00
|
|
|
|
set smartindent
|
|
|
|
|
set softtabstop=4
|
2020-03-21 15:52:51 +01:00
|
|
|
|
set splitbelow
|
|
|
|
|
set splitright
|
2020-04-02 17:45:26 +02:00
|
|
|
|
set wrap
|
2020-03-21 15:52:51 +01:00
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
syntax enable
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Set config variables, in order to change options by only modifying these variable values.
|
|
|
|
|
" Sometimes this can also change the plugins used/needed.
|
|
|
|
|
" ===
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:http_server = ''
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:jobs = []
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:manual_fold_autoload = 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:tex_indent_items = 0
|
|
|
|
|
let g:tex_items = ''
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_airline = 1
|
|
|
|
|
let g:use_alt_colorschemes = 1
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:use_arm_syntax = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_asciidoctor = 1
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:use_asm_indent = 1
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_async = 1
|
|
|
|
|
let g:use_autocomplete=1
|
|
|
|
|
let g:use_bufkill = 1
|
|
|
|
|
let g:use_buftabline = 1
|
|
|
|
|
let g:use_clang_format = 0
|
2021-03-28 20:42:48 +02:00
|
|
|
|
let g:use_coc = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_comfortable_motion = 0
|
|
|
|
|
let g:use_cpp = 1
|
2020-03-22 03:13:24 +01:00
|
|
|
|
let g:use_font = 0
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:use_fswitch = 1
|
|
|
|
|
let g:use_fugitive = 1
|
2020-03-30 20:05:06 +02:00
|
|
|
|
let g:use_indentguides = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_javacomplete = 0
|
|
|
|
|
let g:use_latexmk = 0
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:use_livedown = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_nerdcommenter = 1
|
|
|
|
|
let g:use_nerdtree = 1
|
|
|
|
|
let g:use_pandoc = 0
|
2020-05-19 03:15:24 +02:00
|
|
|
|
let g:use_polyglot = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_python = 1
|
2021-03-28 20:42:48 +02:00
|
|
|
|
let g:use_rust = 1
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_sound = 0
|
|
|
|
|
let g:use_sxhkd = 1
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:use_templator = 0
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:use_utf8 = 1
|
2020-05-19 03:15:24 +02:00
|
|
|
|
let g:use_vimtex = 1
|
2020-03-21 18:14:15 +01:00
|
|
|
|
let g:ycm_clang = ''
|
|
|
|
|
let g:ycm_confirm_extra_conf = 0
|
|
|
|
|
let g:ycm_filetype_whitelist = {'cpp': 1}
|
|
|
|
|
let g:ycm_java = ''
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" As the previous settings should be seen as 'default' settings, we prvoide a
|
|
|
|
|
" way to set custom values for these.
|
|
|
|
|
" Here we load them.
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
runtime custom.vim
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Now these settings get applied.
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_utf8 == 1
|
|
|
|
|
set encoding=utf-8
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if g:use_autocomplete == 3
|
|
|
|
|
let g:ycm_clang = ' --clang-completer' " or '--clangd-completer' or ''
|
|
|
|
|
let g:ycm_java = ' --java-completer' " or ''
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
if g:use_font == 1
|
|
|
|
|
set showbreak=↳
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Begin vim-plug section
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
call plug#begin()
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Core
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_async == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'skywind3000/asyncrun.vim'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_sound == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'https://github.com/timeyyy/orchestra.nvim.git'
|
|
|
|
|
Plug 'https://github.com/timeyyy/bubbletrouble.symphony.git'
|
|
|
|
|
Plug 'https://github.com/timeyyy/clackclack.symphony'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_airline == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_comfortable_motion == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'yuttie/comfortable-motion.vim'
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
|
|
|
|
|
if g:use_nerdcommenter == 1
|
|
|
|
|
Plug 'scrooloose/nerdcommenter'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Visualizers
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_buftabline == 1
|
|
|
|
|
Plug 'ap/vim-buftabline'
|
|
|
|
|
endif
|
|
|
|
|
if g:use_nerdtree == 1
|
|
|
|
|
Plug 'scrooloose/nerdtree'
|
|
|
|
|
endif
|
|
|
|
|
if g:use_bufkill == 1
|
|
|
|
|
Plug 'qpkorr/vim-bufkill'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Syntax & Custom indents
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_pandoc == 1
|
|
|
|
|
Plug 'vim-pandoc/vim-pandoc'
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-25 14:30:07 +01:00
|
|
|
|
if g:use_indentguides == 1
|
|
|
|
|
Plug 'thaerkh/vim-indentguides'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_polyglot == 1
|
|
|
|
|
Plug 'sheerun/vim-polyglot'
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_vimtex == 1
|
|
|
|
|
Plug 'lervag/vimtex'
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_arm_syntax == 1
|
|
|
|
|
Plug 'ARM9/arm-syntax-vim'
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_asm_indent == 1
|
|
|
|
|
Plug 'philj56/vim-asm-indent'
|
|
|
|
|
endif
|
2019-03-20 18:24:55 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_sxhkd == 1
|
|
|
|
|
Plug 'kovetskiy/sxhkd-vim'
|
|
|
|
|
endif
|
2020-03-03 15:13:23 +01:00
|
|
|
|
|
2019-03-20 18:24:55 +01:00
|
|
|
|
if g:use_clang_format==1
|
|
|
|
|
Plug 'rhysd/vim-clang-format'
|
|
|
|
|
endif
|
2019-03-25 14:13:44 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_fswitch == 1
|
|
|
|
|
Plug 'derekwyatt/vim-fswitch'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Git
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_fugitive == 1
|
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Autocompletion
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if g:use_autocomplete == 1
|
|
|
|
|
Plug 'DustVoice/VimCompletesMe'
|
|
|
|
|
elseif g:use_autocomplete == 2
|
|
|
|
|
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
|
|
|
|
|
elseif g:use_autocomplete == 3
|
2020-04-02 17:45:26 +02:00
|
|
|
|
Plug 'ycm-core/YouCompleteMe'
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_javacomplete == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'artur-shaik/vim-javacomplete2'
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2021-03-28 20:42:48 +02:00
|
|
|
|
" ===
|
|
|
|
|
" CoC
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_coc == 1
|
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Rust
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_rust == 1
|
|
|
|
|
Plug 'rust-lang/rust.vim'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Special functionality
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_python == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
Plug 'dhruvasagar/vim-table-mode'
|
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_livedown == 1
|
|
|
|
|
Plug 'shime/vim-livedown'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Templating
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_templator == 1
|
|
|
|
|
Plug 'DustVoice/templator_vim'
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Colorscheme
|
|
|
|
|
" ===
|
2020-03-21 18:14:15 +01:00
|
|
|
|
Plug 'dracula/vim',{'as':'dracula'}
|
|
|
|
|
if g:use_alt_colorschemes == 1
|
|
|
|
|
Plug 'ajmwagar/vim-deus'
|
|
|
|
|
Plug 'chriskempson/base16-vim'
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" End vim-plug section
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
call plug#end()
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" clang-format
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_clang_format == 1
|
2019-03-20 18:24:55 +01:00
|
|
|
|
let g:clang_format#detect_style_file = 1
|
2020-09-20 20:09:21 +02:00
|
|
|
|
let g:clang_format#enable_fallback_style = 1
|
|
|
|
|
|
|
|
|
|
let g:clang_format#style = "Microsoft"
|
|
|
|
|
let g:clang_format#style_options = {
|
|
|
|
|
\ "BasedOnStyle" : "Microsoft",
|
|
|
|
|
\ "AccessModifierOffset" : -4,
|
|
|
|
|
\ "AlignAfterOpenBracket" : "Align",
|
|
|
|
|
\ "AlignConsecutiveAssignments" : "false",
|
|
|
|
|
\ "AlignConsecutiveDeclarations" : "false",
|
|
|
|
|
\ "AlignEscapedNewlinesLeft" : "false",
|
|
|
|
|
\ "AlignOperands" : "true",
|
|
|
|
|
\ "AlignTrailingComments" : "false",
|
|
|
|
|
\ "AllowAllParametersOfDeclarationOnNextLine" : "false",
|
|
|
|
|
\ "AllowShortBlocksOnASingleLine" : "false",
|
|
|
|
|
\ "AllowShortCaseLabelsOnASingleLine" : "false",
|
|
|
|
|
\ "AllowShortFunctionsOnASingleLine" : "All",
|
|
|
|
|
\ "AllowShortIfStatementsOnASingleLine" : "false",
|
|
|
|
|
\ "AllowShortLoopsOnASingleLine" : "false",
|
|
|
|
|
\ "AlwaysBreakAfterDefinitionReturnType" : "None",
|
|
|
|
|
\ "AlwaysBreakAfterReturnType" : "None",
|
|
|
|
|
\ "AlwaysBreakBeforeMultilineStrings" : "false",
|
|
|
|
|
\ "AlwaysBreakTemplateDeclarations" : "true",
|
|
|
|
|
\ "BinPackArguments" : "false",
|
|
|
|
|
\ "BinPackParameters" : "false",
|
|
|
|
|
\ "BreakAfterJavaFieldAnnotations" : "false",
|
|
|
|
|
\ "BreakBeforeBinaryOperators" : "NonAssignment",
|
|
|
|
|
\ "BreakBeforeBraces" : "Allman",
|
|
|
|
|
\ "BreakBeforeTernaryOperators" : "true",
|
|
|
|
|
\ "BreakConstructorInitializersBeforeComma" : "false",
|
|
|
|
|
\ "BreakStringLiterals" : "false",
|
|
|
|
|
\ "ColumnLimit" : 0,
|
|
|
|
|
\ "ConstructorInitializerAllOnOneLineOrOnePerLine" : "true",
|
|
|
|
|
\ "ConstructorInitializerIndentWidth" : 4,
|
|
|
|
|
\ "ContinuationIndentWidth" : 4,
|
|
|
|
|
\ "Cpp11BracedListStyle" : "false",
|
|
|
|
|
\ "DerivePointerAlignment" : "false",
|
|
|
|
|
\ "DisableFormat" : "false",
|
|
|
|
|
\ "ExperimentalAutoDetectBinPacking" : "false",
|
|
|
|
|
\ "IndentCaseLabels" : "true",
|
|
|
|
|
\ "IndentWidth" : 4,
|
|
|
|
|
\ "IndentWrappedFunctionNames" : "true",
|
|
|
|
|
\ "KeepEmptyLinesAtTheStartOfBlocks" : "false",
|
|
|
|
|
\ "Language" : "Cpp",
|
|
|
|
|
\ "MaxEmptyLinesToKeep" : 1,
|
|
|
|
|
\ "NamespaceIndentation" : "Inner",
|
|
|
|
|
\ "PointerAlignment" : "Left",
|
|
|
|
|
\ "ReflowComments" : "false",
|
|
|
|
|
\ "SortIncludes" : "true",
|
|
|
|
|
\ "SpaceAfterCStyleCast" : "true",
|
|
|
|
|
\ "SpaceBeforeAssignmentOperators" : "true",
|
|
|
|
|
\ "SpaceBeforeParens" : "ControlStatements",
|
|
|
|
|
\ "SpaceInEmptyParentheses" : "false",
|
|
|
|
|
\ "SpacesInAngles" : "false",
|
|
|
|
|
\ "SpacesInCStyleCastParentheses" : "false",
|
|
|
|
|
\ "SpacesInContainerLiterals" : "true",
|
|
|
|
|
\ "SpacesInParentheses" : "false",
|
|
|
|
|
\ "SpacesInSquareBrackets" : "false",
|
|
|
|
|
\ "Standard" : "Cpp11",
|
|
|
|
|
\ "TabWidth" : 4,
|
|
|
|
|
\ "UseTab" : "Never" }
|
|
|
|
|
|
|
|
|
|
let g:clang_format#auto_format = 1
|
|
|
|
|
let g:clang_format#auto_format_on_insert_leave = 0
|
2019-03-20 18:24:55 +01:00
|
|
|
|
|
|
|
|
|
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
|
|
|
|
|
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
|
|
|
|
|
|
2020-09-20 20:09:21 +02:00
|
|
|
|
nmap <Leader>ct :ClangFormatAutoToggle<CR>
|
2019-03-20 18:24:55 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-20 18:24:55 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" arm-assembly
|
|
|
|
|
" ===
|
2019-09-21 01:50:58 +02:00
|
|
|
|
function! SetupArm()
|
|
|
|
|
execute('set filetype=arm')
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
au BufNewFile,BufRead *.s,*.S call SetupArm() " arm = armv6/7
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-09-21 01:50:58 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Indentguides config
|
|
|
|
|
" ===
|
2020-03-25 14:30:07 +01:00
|
|
|
|
if g:use_indentguides
|
|
|
|
|
let g:indentguides_spacechar = '•'
|
|
|
|
|
let g:indentguides_tabchar = '|'
|
|
|
|
|
let g:indentguides_firstlevel = 1
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" When to use 'normal' tabs
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
autocmd FileType make setlocal noexpandtab
|
|
|
|
|
autocmd FileType Makefile setlocal noexpandtab
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Colorscheme
|
|
|
|
|
" ===
|
2020-03-21 18:14:15 +01:00
|
|
|
|
colorscheme dracula
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Function to delete a 'stuck'
|
|
|
|
|
" swap file for the current buffer
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
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
|
2019-03-20 18:24:55 +01:00
|
|
|
|
if !empty(glob(l:swap_file)) && l:swap_file != l:current_swap_file
|
2019-03-15 03:46:06 +01:00
|
|
|
|
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()
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Comfortable Motion setup
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_comfortable_motion == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
let g:comfortable_motion_no_default_key_mappings = 1
|
|
|
|
|
let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value.
|
|
|
|
|
nnoremap <silent> <C-e> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 1)<CR>
|
|
|
|
|
nnoremap <silent> <C-y> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -1)<CR>
|
|
|
|
|
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)<CR>
|
|
|
|
|
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)<CR>
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup F11/S-F11 for fullscreen/maximize toggle
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
function! FullScreenToggle()
|
2021-06-22 16:54:13 +02:00
|
|
|
|
if exists('g:neovide')
|
|
|
|
|
let g:neovide_fullscreen = !g:neovide_fullscreen
|
2019-03-15 03:46:06 +01:00
|
|
|
|
else
|
2021-06-22 16:54:13 +02:00
|
|
|
|
if g:GuiWindowFullScreen==1
|
|
|
|
|
call GuiWindowFullScreen(0)
|
|
|
|
|
else
|
|
|
|
|
call GuiWindowFullScreen(1)
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! MaximizedToggle()
|
|
|
|
|
if g:GuiWindowMaximized==1
|
|
|
|
|
call GuiWindowMaximized(0)
|
|
|
|
|
else
|
|
|
|
|
call GuiWindowMaximized(1)
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
2021-06-22 16:54:13 +02:00
|
|
|
|
if exists('g:neovide')
|
|
|
|
|
nnoremap <silent> <F11> :call FullScreenToggle()<CR>
|
|
|
|
|
else
|
|
|
|
|
nnoremap <silent> <F11> :call MaximizedToggle()<CR>
|
|
|
|
|
nnoremap <silent> <S-F11> :call FullScreenToggle()<CR>
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Disable polyglot for latex files
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_polyglot == 1
|
2020-03-25 14:30:07 +01:00
|
|
|
|
let g:vim_markdown_conceal = 0
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Setup vimtex
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_vimtex == 1
|
2020-05-19 03:15:24 +02:00
|
|
|
|
let g:polyglot_disabled = ['latex', 'tex']
|
|
|
|
|
|
|
|
|
|
let g:tex_flavor='latex'
|
2021-03-23 13:46:22 +01:00
|
|
|
|
"let g:vimtex_syntax_packages = {'hyperref':{'load':2}, 'listings':{'load':2}, 'luacode':{'load':2}, 'minted':{'load':2}}
|
2020-05-19 03:15:24 +02:00
|
|
|
|
let g:vimtex_format_enabled = 1
|
|
|
|
|
let g:vimtex_indent_enabled = 1
|
|
|
|
|
|
|
|
|
|
"let g:vimtex_indent_ignored_envs = ['document']
|
|
|
|
|
"let g:vimtex_syntax_minted = [{'lang':'text'}, {'lang':'console'}]
|
|
|
|
|
|
2020-05-19 04:51:10 +02:00
|
|
|
|
let g:vimtex_compiler_enabled = 0
|
2020-05-19 03:15:24 +02:00
|
|
|
|
"let g:vimtex_compiler_latexmk = {'backend':'nvim', 'background':1, 'build_dir':'', 'callback':1, 'continuous':1, 'executable':'latexmk', 'options':['-verbose', '-file-line-error', '-synctex=1', '-interaction=nonstopmode', '-lualatex', '-shell-escape']}
|
2020-03-21 15:52:51 +01:00
|
|
|
|
|
2020-05-19 04:51:10 +02:00
|
|
|
|
"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 = ''
|
|
|
|
|
|
|
|
|
|
"if g:platform ==? "windows" || g:platform ==? "windows_portable"
|
|
|
|
|
"let g:vimtex_view_enabled = 1
|
|
|
|
|
"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'
|
|
|
|
|
"elseif g:platform ==? "termux"
|
|
|
|
|
"let g:vimtex_view_enabled = 1
|
|
|
|
|
"let g:vimtex_view_general_viewer = 'termux-open'
|
|
|
|
|
"else
|
|
|
|
|
"let g:vimtex_view_enabled = 0
|
|
|
|
|
"let g:vimtex_view_general_viewer = ''
|
|
|
|
|
"endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-05-19 03:15:24 +02:00
|
|
|
|
"let g:vimtex_fold_enabled=1
|
2020-11-16 11:36:40 +01:00
|
|
|
|
|
|
|
|
|
au BufNewFile,BufRead *.cls call execute('set filetype=tex')
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup javacomplete
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if g:use_javacomplete==1
|
|
|
|
|
autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup deoplete
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if g:use_autocomplete==2
|
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup YouCompleteMe
|
|
|
|
|
" ===
|
2019-03-25 14:13:44 +01:00
|
|
|
|
if g:use_autocomplete == 3
|
|
|
|
|
nnoremap <leader>ygg :YcmCompleter GoToImprecise<CR>
|
|
|
|
|
nnoremap <leader>yg :YcmCompleter GoTo<CR>
|
2019-10-05 21:18:45 +02:00
|
|
|
|
|
2019-03-25 14:13:44 +01:00
|
|
|
|
nnoremap <leader>ytt :YcmCompleter GetTypeImprecise<CR>
|
|
|
|
|
nnoremap <leader>yt :YcmCompleter GetType<CR>
|
2019-10-05 21:18:45 +02:00
|
|
|
|
|
|
|
|
|
nnoremap <leader>ydd :YcmCompleter GetDocImprecise<CR>
|
|
|
|
|
nnoremap <leader>yd :YcmCompleter GetDoc<CR>
|
|
|
|
|
|
2019-09-21 01:47:42 +02:00
|
|
|
|
nnoremap <leader>yf :YcmCompleter FixIt<CR>
|
2019-10-05 21:18:45 +02:00
|
|
|
|
|
|
|
|
|
nnoremap <leader>yq :YcmDiags<CR>
|
|
|
|
|
|
2019-09-21 01:47:42 +02:00
|
|
|
|
nnoremap <leader>yy :YcmCompleter<Space>
|
2019-10-05 21:18:45 +02:00
|
|
|
|
|
|
|
|
|
nnoremap <leader>yr :YcmRestartServer<CR>
|
2019-03-25 14:13:44 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-25 14:13:44 +01:00
|
|
|
|
|
2021-03-28 20:42:48 +02:00
|
|
|
|
" ===
|
|
|
|
|
" Setup CoC
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_coc == 1
|
|
|
|
|
set updatetime=300
|
|
|
|
|
|
|
|
|
|
set shortmess+=c
|
|
|
|
|
|
2021-03-29 09:37:36 +02:00
|
|
|
|
set signcolumn=yes
|
2021-03-28 20:42:48 +02:00
|
|
|
|
|
|
|
|
|
inoremap <silent><expr> <C-Space> coc#refresh()
|
|
|
|
|
|
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
|
|
|
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
|
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
|
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
|
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
|
|
|
|
|
|
function! s:show_documentation()
|
|
|
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
|
|
|
execute 'h '.expand('<cword>')
|
|
|
|
|
elseif (coc#rpc#ready())
|
|
|
|
|
call CocActionAsync('doHover')
|
|
|
|
|
else
|
|
|
|
|
execute '!' . &keywordprg . " " . expand('<cword>')
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
|
|
|
|
|
|
|
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
|
|
|
|
|
|
|
|
xmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
|
nmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
|
|
|
|
|
|
nmap <leader>ac <Plug>(coc-codeaction)
|
|
|
|
|
nmap <leader>qf <Plug>(coc-fix-current)
|
|
|
|
|
|
2021-03-29 09:37:36 +02:00
|
|
|
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
|
|
|
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
|
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
|
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
|
|
|
|
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
|
|
|
|
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
command! -nargs=0 Format :call CocAction('format')
|
|
|
|
|
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
|
|
|
|
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
|
|
|
|
|
2021-03-28 20:42:48 +02:00
|
|
|
|
nnoremap <silent> <leader>y :<C-u>CocList -A --normal yank<CR>
|
|
|
|
|
|
2021-03-29 09:37:36 +02:00
|
|
|
|
let g:coc_global_extensions = ['coc-clangd', 'coc-cmake', 'coc-html', 'coc-html-css-support', 'coc-java', 'coc-json', 'coc-lists', 'coc-markdownlint', 'coc-omnisharp', 'coc-prettier', 'coc-pyright', 'coc-rust-analyzer', 'coc-sh', 'coc-snippets', 'coc-xml', 'coc-yank']
|
2021-03-28 20:42:48 +02:00
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup fswitch
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_fswitch == 1
|
|
|
|
|
nnoremap <leader>s :FSHere<CR>
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-25 14:13:44 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup python
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if g:use_python == 1
|
|
|
|
|
let g:table_mode_corner_corner='+'
|
|
|
|
|
let g:table_mode_header_fillchar='='
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup airline
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_airline == 1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
let g:airline_powerline_fonts = 1
|
2020-03-21 18:14:15 +01:00
|
|
|
|
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if !exists('g:airline_symbols')
|
|
|
|
|
let g:airline_symbols = {}
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:use_font == 0
|
2019-03-15 03:46:06 +01:00
|
|
|
|
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
|
|
|
|
|
|
2020-03-21 18:14:15 +01:00
|
|
|
|
" ===
|
|
|
|
|
" 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 = "dracula"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup sound
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
if g:use_sound==1
|
|
|
|
|
call orchestra#prelude()
|
|
|
|
|
|
|
|
|
|
call orchestra#set_tune('bubbletrouble')
|
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Setup livedown
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_livedown == 1
|
|
|
|
|
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 <leader>m :LivedownToggle<CR>
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup Nerdtree
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_nerdtree == 1
|
|
|
|
|
map <leader>n :NERDTreeToggle<CR>
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup pandoc
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_pandoc == 1
|
|
|
|
|
let g:pandoc#syntax#conceal#use = 0
|
|
|
|
|
let g:pandoc#formatting#mode="sa"
|
|
|
|
|
let g:pandoc#formatting#smart_autoformat_on_cursormoved=1
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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")
|
2019-03-15 03:46:06 +01:00
|
|
|
|
else
|
2020-03-21 15:52:51 +01:00
|
|
|
|
echom 'Job ' . a:job_id . ' finished'
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
let index = 0
|
|
|
|
|
while index < len(g:jobs)
|
|
|
|
|
let item = g:jobs[index]
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if item == a:job_id
|
|
|
|
|
call remove(g:jobs, index)
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
let index = index + 1
|
|
|
|
|
endwhile
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if string(a:data) != "0"
|
|
|
|
|
echoerr 'Program terminated with exit code ' . string(a:data)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"call append(line('$'), str)
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:callbacks = {
|
|
|
|
|
\ 'on_stdout': function('g:JobHandler'),
|
|
|
|
|
\ 'on_stderr': function('g:JobHandler'),
|
|
|
|
|
\ 'on_exit': function('g:JobHandler')
|
|
|
|
|
\ }
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let g:callbacks_no_out = {
|
|
|
|
|
\ 'on_exit': function('g:JobHandler')
|
|
|
|
|
\ }
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"function! Stdout(job_id, data, event)
|
|
|
|
|
"echom 'Job ' . a:job_id . ': >>' . join(a:data)
|
|
|
|
|
"" echom 'stdout: ' . a:data[0]
|
|
|
|
|
"endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" function! Stderr(job_id, data, event)
|
|
|
|
|
" echoerr 'Job ' . a:job_id . ': >>' . join(a:data)
|
|
|
|
|
" endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"function! PrintFinished(job_id, data, event)
|
|
|
|
|
"echom 'Job ' . a:job_id . ' finished with exit code: ' . string(a:data)
|
|
|
|
|
"endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! OpenPdf()
|
|
|
|
|
if g:use_async==1
|
|
|
|
|
let pdf_path = ""
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" 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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:open_pdf==1
|
|
|
|
|
call OpenPdf() normal <CR>
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! g:ExitedWithCode(job_id, data, event)
|
|
|
|
|
echom "Job " . a:job_id . " exited with code: " . string(a:data)
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! ConvertPandocPdfLatexDebug()
|
|
|
|
|
let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let output = ""
|
|
|
|
|
if g:latex_use_outdir==1
|
|
|
|
|
let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir
|
2019-03-15 03:46:06 +01:00
|
|
|
|
else
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let output = ""
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if g:latexmk_use==1
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
execute("!" . command)
|
|
|
|
|
execute("!" . pdf_command)
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! ConvertPandocPdfLatex()
|
|
|
|
|
let command = "pandoc " . @% . " -s -o " . expand('%:r') . ".tex"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let output = ""
|
|
|
|
|
if g:latex_use_outdir==1
|
|
|
|
|
let output = "-output-directory=" . expand('%:r') . "_" . g:latex_outdir
|
|
|
|
|
else
|
|
|
|
|
let output = ""
|
|
|
|
|
endif
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let current_job = jobstart(command, g:callbacks)
|
|
|
|
|
call insert(g:jobs, current_job)
|
|
|
|
|
echom 'Running ' . command . ' with Job-Nr. ' . current_job
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
call jobwait([current_job], 30000)
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
echom "Conversion from " . @% . " to " . expand('%:r') . ".tex finished"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let result = jobwait([current_job], 120000)
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
call jobwait([current_job], 30000)
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
echom "Cleaned up for " . expand('%:r')
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
execute("!" . command)
|
|
|
|
|
echom "Conversion finished"
|
|
|
|
|
execute("!" . pdf_command)
|
|
|
|
|
echom "Compilation finished"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if g:latexmk_use==1
|
|
|
|
|
execute("!" . pdf_cleanup)
|
|
|
|
|
echom "Cleanup finished"
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
nmap <leader>pm :call ConvertPandoc("md-to-pdf")<CR><CR>
|
|
|
|
|
nmap <leader>pM :call ConvertPandoc("md-html-to-pdf")<CR><CR>
|
|
|
|
|
nmap <leader>ph :call ConvertPandoc("md-to-html")<CR><CR>
|
|
|
|
|
nmap <leader>pl :call ConvertPandocPdfLatex()<CR><CR>
|
|
|
|
|
nmap <leader>pd :call ConvertPandocPdfLatexDebug()<CR>
|
|
|
|
|
nmap <leader>pp :AsyncStop<CR>:call OpenPdf()<CR>
|
|
|
|
|
nmap <leader>po :AsyncStop<CR>:AsyncRun<Space>sumatrapdf<Space>
|
|
|
|
|
|
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
nmap <leader>pc :call ToggleCompileOnSave()<CR>
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! ConvertPandocOnSave(args)
|
|
|
|
|
if g:compile_on_save == 1
|
|
|
|
|
call ConvertPandoc(a:args)
|
|
|
|
|
execute "normal \<CR>"
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"autocmd FileType pandoc autocmd BufWritePost <buffer> call ConvertPandoc(g:pandoc_default) | execute("normal \<CR>")
|
|
|
|
|
autocmd FileType pandoc silent autocmd BufWritePost <buffer> silent! call ConvertPandocOnSave(g:pandoc_default)
|
|
|
|
|
" autocmd FileType tex silent autocmd BufWritePost <buffer> silent! call ConvertPandoc("latex-to-pdf")
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Setup latexmk
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_latexmk == 1
|
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
execute("!" . command)
|
|
|
|
|
execute("!" . pdf_command)
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! ConvertPdfLatex()
|
|
|
|
|
let pdf_command = "latexmk -pdf -halt-on-error -shell-escape " . expand('%:r') . ".tex"
|
|
|
|
|
let pdf_cleanup = "latexmk -c " . expand('%:r') . ".tex"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let result = jobwait([current_job], 120000)
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
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
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
call jobwait([current_job], 30000)
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
echom "Cleaned up for " . expand('%:r')
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! CleanLatexDir(full)
|
|
|
|
|
if a:full==0
|
|
|
|
|
let clean="c"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
else
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let clean="C"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
endif
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let curr_dir = getcwd()
|
|
|
|
|
execute("cd " . expand('%:p:h'))
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"let pdf_cleanup = "latexmk -" . clean . " " . expand('%:r') . ".tex"
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let pdf_cleanup = "latexmk -" . clean
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
execute("!" . pdf_cleanup)
|
|
|
|
|
execute("cd " . curr_dir)
|
|
|
|
|
endfunction
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
"nnoremap <leader>ll :call ConvertPdfLatex()<CR><CR>
|
|
|
|
|
"nnoremap <leader>lL :call ConvertPdfLatexDebug()<CR><CR>
|
|
|
|
|
nnoremap <leader>lc :call CleanLatexDir(0)<CR><CR>
|
|
|
|
|
nnoremap <leader>lC :call CleanLatexDir(1)<CR><CR>
|
|
|
|
|
"nnoremap <localleader>ll :call ConvertPdfLatex()<CR><CR>
|
|
|
|
|
"nnoremap <localleader>lL :call ConvertPdfLatexDebug()<CR><CR>
|
|
|
|
|
"nnoremap <localleader>lc :! latexmk -c<CR><CR>
|
|
|
|
|
"nnoremap <localleader>lC :! latexmk -C<CR><CR>
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Setup Asciidoctor
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_asciidoctor == 1
|
|
|
|
|
function! AsciidoctorConvert()
|
|
|
|
|
execute("!asciidoctor " . expand('%'))
|
|
|
|
|
endfunction
|
|
|
|
|
function! AsciidoctorPdfConvert()
|
|
|
|
|
execute("!asciidoctor-pdf " . expand('%'))
|
|
|
|
|
endfunction
|
|
|
|
|
function! AsciidoctorEpubConvert()
|
|
|
|
|
execute("!asciidoctor-epub3 " . expand('%'))
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
nmap <leader>aa :call AsciidoctorConvert()<CR>
|
|
|
|
|
nmap <leader>ap :call AsciidoctorPdfConvert()<CR>
|
|
|
|
|
nmap <leader>ae :call AsciidoctorEpubConvert()<CR>
|
|
|
|
|
|
|
|
|
|
nmap <leader>ant i[.lightbox, cols="^2,^2", {LIGHTBOX}]<CR>\|===<CR>\|===<CR><ESC>kk
|
|
|
|
|
nmap <leader>ani aimage:./images/picture.jpg[picture, {POPUP}]<ESC>
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" Don't schow relative numbers in insert mode, but show them in normal mode
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber
|
|
|
|
|
autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
"hi LineNr guifg=#B0BEC5
|
|
|
|
|
"hi CursorLineNr guifg=#64FFDA
|
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
" General maps (at the bottom to overwrite everything)
|
|
|
|
|
" ===
|
2019-04-12 20:14:37 +02:00
|
|
|
|
nnoremap <silent> <leader>cd :cd %:p:h<CR>
|
2020-03-21 15:52:51 +01:00
|
|
|
|
nnoremap <silent> <leader>lcd :lcd %:p:h<CR>
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
|
|
|
|
tnoremap <Esc> <C-\><C-n>
|
|
|
|
|
|
|
|
|
|
nnoremap <leader>+ <C-W>+
|
|
|
|
|
nnoremap <leader>- <C-W>-
|
|
|
|
|
nnoremap <leader>< <C-W><
|
|
|
|
|
nnoremap <leader>> <C-W>>
|
|
|
|
|
nnoremap <leader>_ <C-W>_
|
|
|
|
|
nnoremap <leader><BAR> <C-W><BAR>
|
|
|
|
|
nnoremap <leader>= <C-W>=
|
|
|
|
|
nnoremap <leader>T <C-W>T
|
|
|
|
|
|
|
|
|
|
nmap <leader>h :noh<CR>
|
|
|
|
|
|
|
|
|
|
nmap <leader>. :bnext<CR>
|
|
|
|
|
nmap <leader>, :bprev<CR>
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
|
|
|
|
|
|
|
|
|
" ===
|
|
|
|
|
" Setup C++ specific stuff
|
|
|
|
|
" ===
|
|
|
|
|
if g:use_cpp == 1
|
|
|
|
|
function! CPP_Include_Guard()
|
|
|
|
|
let guard_name = input("Please input the guard name:\n")
|
|
|
|
|
if guard_name != ""
|
|
|
|
|
execute("normal! mZ")
|
|
|
|
|
execute("normal! gg")
|
|
|
|
|
if getline(".") =~ "\."
|
|
|
|
|
execute("normal! O")
|
|
|
|
|
endif
|
|
|
|
|
execute("normal! O#ifndef " . guard_name)
|
|
|
|
|
execute("normal! o#define " . guard_name)
|
|
|
|
|
execute("normal! G")
|
|
|
|
|
if getline(".") =~ "\."
|
|
|
|
|
execute("normal! o")
|
|
|
|
|
endif
|
|
|
|
|
execute("normal! o#endif // " . guard_name)
|
|
|
|
|
execute("normal! `Z")
|
2019-09-22 23:18:19 +02:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! CPP_Comment_File()
|
|
|
|
|
let file_desc = input("Please input a short file description:\n")
|
|
|
|
|
if file_desc != ""
|
|
|
|
|
let class_name = input("Please input a class name or leave empty:\n")
|
|
|
|
|
execute("normal! mZ")
|
|
|
|
|
execute("normal! O/**")
|
|
|
|
|
execute("normal! o")
|
|
|
|
|
execute("normal! S @file " . expand("%:t"))
|
|
|
|
|
execute("normal! o@author DustVoice")
|
2019-09-22 23:18:19 +02:00
|
|
|
|
execute("normal! o")
|
2020-03-21 15:52:51 +01:00
|
|
|
|
if class_name != ""
|
|
|
|
|
execute("normal! o@class " . class_name)
|
|
|
|
|
execute("normal! o")
|
|
|
|
|
endif
|
|
|
|
|
execute("normal! o" . file_desc)
|
|
|
|
|
execute("normal! o*/")
|
|
|
|
|
execute("normal! <<")
|
|
|
|
|
execute("normal! `Z")
|
2019-09-22 23:18:19 +02:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
endfunction
|
2019-09-22 23:18:19 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
function! CPP_Comment_Method()
|
|
|
|
|
let func_desc = input("Please input a short function description:\n")
|
|
|
|
|
if func_desc != ""
|
|
|
|
|
execute("normal! O/**")
|
2019-10-05 21:18:45 +02:00
|
|
|
|
execute("normal! o")
|
2020-03-21 15:52:51 +01:00
|
|
|
|
execute("normal! S " . func_desc)
|
|
|
|
|
execute("normal! o*/")
|
|
|
|
|
execute("normal! <<")
|
|
|
|
|
execute("normal! k$")
|
2019-10-05 21:18:45 +02:00
|
|
|
|
endif
|
2020-03-21 15:52:51 +01:00
|
|
|
|
endfunction
|
2019-09-22 23:18:19 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
command! CppIncludeGuard :call CPP_Include_Guard()
|
|
|
|
|
command! CppCommentFile :call CPP_Comment_File()
|
|
|
|
|
command! CppCommentMethod :call CPP_Comment_Method()
|
2019-10-10 23:37:30 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
let b:current_syntax = "custom"
|
2019-10-10 23:37:30 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
syntax keyword cppCustomNamespace juce
|
|
|
|
|
syntax keyword cppCustomNamespace PDFHummus
|
2019-10-10 23:37:30 +02:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
hi def link cppCustomNamespace Constant
|
|
|
|
|
endif
|
|
|
|
|
" ===
|
2019-03-15 03:46:06 +01:00
|
|
|
|
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2020-03-21 17:08:14 +01:00
|
|
|
|
" Background
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|
2019-07-26 11:14:49 +02:00
|
|
|
|
nmap <leader>bg :let &background = ( &background == "dark"? "light" : "dark" )<CR>
|
2020-03-21 15:52:51 +01:00
|
|
|
|
" ===
|