From: Jannik ZANDER Date: Fri, 20 Jul 2018 18:59:38 +0000 (+0200) Subject: Add pandoc to vim X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=8056bcb486e4a82be1f0bae2bdd469277cfc1b11;p=dotfiles.git Add pandoc to vim --- diff --git a/.bash_aliases b/.bash_aliases index 75d5410..22a583c 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -30,6 +30,7 @@ alias mv='mv -i' alias ln='ln -i' alias md='mkdir -p' alias rd='rmdir' +alias :q=exit # reboot / halt / poweroff alias reboot='sudo /sbin/reboot' @@ -42,6 +43,7 @@ alias update='sudo apt-get update && sudo apt-get upgrade' # My shortcuts alias c='clear' alias h='history' +alias 'h?'="history | grep -i" alias e='ranger-cd' alias o='rifle' alias vi='vim' diff --git a/.bashrc b/.bashrc index 2ed6ee7..5c46b97 100644 --- a/.bashrc +++ b/.bashrc @@ -6,6 +6,7 @@ cd ~ # options +#set -x # debug set -o vi shopt -s autocd shopt -s cdspell diff --git a/.gitmodules b/.gitmodules index 580e03a..c5abf2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule ".vim/pack/plugins/opt/incsearch.vim"] path = .vim/pack/github/opt/incsearch.vim url = https://github.com/haya14busa/incsearch.vim.git -[submodule ".vim/pack/plugins/opt/ctrlp.vim"] - path = .vim/pack/github/opt/ctrlp.vim - url = https://github.com/ctrlpvim/ctrlp.vim.git [submodule ".vim/pack/github/opt/bclose.vim"] path = .vim/pack/github/opt/bclose.vim url = https://github.com/rbgrouleff/bclose.vim.git @@ -61,3 +58,12 @@ [submodule ".vim/pack/github/opt/validator.vim"] path = .vim/pack/github/opt/validator.vim url = https://github.com/maralla/validator.vim.git +[submodule ".vim/pack/github/opt/vim-pandoc"] + path = .vim/pack/github/opt/vim-pandoc + url = https://github.com/vim-pandoc/vim-pandoc.git +[submodule ".vim/pack/github/opt/FuzzyFinder"] + path = .vim/pack/github/opt/FuzzyFinder + url = https://github.com/vim-scripts/FuzzyFinder.git +[submodule ".vim/pack/github/opt/L9"] + path = .vim/pack/github/opt/L9 + url = https://github.com/vim-scripts/L9 diff --git a/.profile b/.profile index 25b8dd5..f82b46c 100644 --- a/.profile +++ b/.profile @@ -32,7 +32,7 @@ if [[ -f /mingw64/bin/src-hilite-lesspipe.sh ]]; then elif [[ -f /usr/share/source-highlight/src-hilite-lesspipe.sh ]]; then export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s" fi -export LESS=" -R -X --SILENT " +export LESS="-FiRSX --SILENT " # colored GCC warnings and errors export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' diff --git a/.vim/pack/github/opt/FuzzyFinder b/.vim/pack/github/opt/FuzzyFinder new file mode 160000 index 0000000..b9f1659 --- /dev/null +++ b/.vim/pack/github/opt/FuzzyFinder @@ -0,0 +1 @@ +Subproject commit b9f165970346df55862853dd83c8a4f2b2b70262 diff --git a/.vim/pack/github/opt/L9 b/.vim/pack/github/opt/L9 new file mode 160000 index 0000000..c822b05 --- /dev/null +++ b/.vim/pack/github/opt/L9 @@ -0,0 +1 @@ +Subproject commit c822b05ee0886f9a9703227dc85a6d47612c4bf1 diff --git a/.vim/pack/github/opt/ctrlp.vim b/.vim/pack/github/opt/ctrlp.vim deleted file mode 160000 index e66b5b5..0000000 --- a/.vim/pack/github/opt/ctrlp.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e66b5b50e5c539354813e2ecac6fb75a2121e29e diff --git a/.vim/pack/github/opt/vim-pandoc b/.vim/pack/github/opt/vim-pandoc new file mode 160000 index 0000000..3a68678 --- /dev/null +++ b/.vim/pack/github/opt/vim-pandoc @@ -0,0 +1 @@ +Subproject commit 3a686781ab5ea622616798475deb394e48d3cc48 diff --git a/.vim/vimrc b/.vim/vimrc index 43be7c6..2dd122d 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -1,9 +1,8 @@ +" Use :help 'option' to see the documentation for the given option. set nocompatible filetype plugin indent on syntax on -" Use :help 'option' to see the documentation for the given option. - " indentation set expandtab set shiftwidth=2 @@ -11,7 +10,8 @@ set softtabstop=2 set autoindent set copyindent set smarttab -set nolinebreak +set linebreak +set textwidth=0 set breakindent set breakindent showbreak=\ + set shiftround @@ -39,6 +39,7 @@ set number set relativenumber set title set titlestring=%F +set matchtime=2 " folding set foldmethod=syntax @@ -70,8 +71,8 @@ set wildoptions=tagfile " buffers set hidden set autoread -set autowrite -set autowriteall +"set autowrite +"set autowriteall " temporary files silent !mkdir -p ~/.vim/undo @@ -81,9 +82,7 @@ set undofile set undodir=~/.vim/undo set viminfo+=n~/.vim/viminfo set history=1000 -setglobal tags-=./tags tags-=./tags; tags^=./tags; - -" sessions +set tags=.git/tags set sessionoptions-=options let g:session_directory = "~/.vim/session" let g:session_autoload = "no" @@ -93,10 +92,12 @@ let g:session_command_aliases = 1 " system set path=.,,** set shell=bash +let g:is_posix = 1 if has("win32") set shell=cmd set shellcmdflag=/c endif +scriptencoding utf-8 set encoding=utf-8 set fileencoding=utf-8 set fileencodings=utf-8,latin1,unicode @@ -122,20 +123,144 @@ let &t_SI.="\e[5 q" let &t_EI.="\e[1 q" let &t_te.="\e[0 q" +"General Mappings let mapleader = "," +let maplocalleader = " " + set pastetoggle=p -" Netrw (buildin) +nnoremap * :grep \| copen +nnoremap t :TagbarToggle +command! -nargs=1 Ngrep lvimgrep "" $HOME/cloud/Notes/**/*.md +command! -range=% Rst :'<,'>!pandoc -f markdown -t rst + +noremap +noremap +noremap +noremap +noremap :bn +noremap :bp +noremap! +noremap! +"noremap z :bp +"noremap q :bp +"noremap x :bn +"noremap w :bn +"noremap c :bd + +" Normal Mode Mappings +nnoremap ; : +nnoremap : ; +nnoremap n nzzzv +nnoremap N Nzzzv +nnoremap + :exe "resize " . (winheight(0) * 3/2) +nnoremap - :exe "resize " . (winheight(0) * 2/3) +nnoremap :noh +nnoremap ev :edit $MYVIMRC +"nnoremap sv :source $MYVIMRC +nnoremap sh :terminal +"nnoremap html :-1read ~/.vim/template/html3jwf>a +"nnoremap php :-1read ~/.vim/template/php2ja + +"" Visual Mode Mappings +vmap < >gv + +" Insert Mode Mappings +inoremap u + +" Command Mode Mappings +cnoremap +cnoremap + +" Command aliases +cnoreabbrev w!! w !sudo tee "%" + +" Termninal Mappings +tnoremap h +tnoremap j +tnoremap k +tnoremap l +tnoremap :bnext +tnoremap :bprev + +" Functions + +" Netrw let g:netrw_liststyle=3 let g:netrw_banner = 0 let g:netrw_sort_sequence = '[\/]$,*' -" grep (buildin) +" grep " file:line:coloumn:message set grepformat^=%f:%l:%c:%m set grepprg=ag\ --vimgrep\ --skip-vcs-ignores\ --path-to-ignore\ ~/.ignore\ --cpp\ --cc -nnoremap * :grep \| copen -" plugins + +function! s:CmakeInit() + let &errorformat="%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f|%l| %m" + set makeprg=cmake +endfunction +command! -bang -nargs=0 -complete=file CmakeInit call s:CmakeInit() + +function! s:Doxygen() + set errorformat+=%f:%l:\ %m + set makeprg=doxygen +endfunction +command! -bang -nargs=0 -complete=file Doxygen call s:Doxygen() + +function! s:Iar() + set errorformat=%f(%l)\ :\ %m + set makeprg=vim-iarbuild.cmd +endfunction +command! -bang -nargs=0 -complete=file Iar call s:Iar() + +" Autocommands +if has('autocmd') + augroup expandtabs + au! + au FileType c setlocal expandtab softtabstop=2 shiftwidth=2 + au FileType cpp setlocal expandtab softtabstop=2 shiftwidth=2 + au FileType make setlocal noexpandtab tabstop=8 shiftwidth=8 + au FileType python setlocal expandtab softtabstop=4 shiftwidth=4 + \ formatoptions+=croq colorcolumn=79 + \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with + augroup end + + augroup filetypes + au! + au bufnewfile,bufread *.md,*.txt set filetype=pandoc + au bufnewfile,bufread *.gradle set filetype=groovy + au bufnewfile,bufread *.json set filetype=json + au bufnewfile,bufread *.yml set filetype=yaml + augroup end + + augroup saveall + autocmd! + au focuslost * wall + augroup end + + augroup numbers + au! + au bufenter,focusgained,insertleave * set relativenumber + au bufleave,focuslost,insertenter * set norelativenumber + augroup end + + augroup vimrc + au! + au bufwritepost ~/.vim/gvimrc silent source % + au bufwritepost ~/.vim/vimrc silent source % + au bufwritepost ~/.vim/vimrc.local silent source % + au BufWritePost * silent FufRenewCache + augroup end + + augroup quickfix +" autocmd QuickFixCmdPost [^l]* nested cwindow +" autocmd QuickFixCmdPost l* nested lwindow + au QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1) + augroup end +endif + +" Packages " Airline packadd! vim-airline @@ -149,7 +274,6 @@ let g:airline#extensions#tabline#formatter = 'unique_tail_improved' " Tagbar packadd! tagbar -nnoremap t :TagbarToggle " Fugitive packadd! vim-fugitive @@ -173,17 +297,7 @@ packadd! ranger.vim packadd! bclose.vim let g:ranger_replace_netrw = 1 -" CtrlP -"packadd! ctrlp.vim -"let g:ctrlp_map = 'p' -"let g:ctrlp_cmd = 'CtrlP' -"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] -"let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' -"nnoremap p :CtrlP -"nnoremap b :CtrlPBuffer -"nnoremap m :CtrlPMRU - -" matchit +" Matchit packadd! matchit " termdebug @@ -227,8 +341,8 @@ packadd supertab "let python_highlight_all = 1 " completor -packadd completor.vim -let g:completor_clang_binary = '/usr/bin/clang' +"packadd completor.vim +"let g:completor_clang_binary = '/usr/bin/clang' " validator packadd validator.vim @@ -237,143 +351,19 @@ let g:validator_c_checkers = ['clang-tidy'] let g:validator_cpp_checkers = ['clang-tidy'] -" General Mappings -noremap -noremap -noremap -noremap -noremap :bn -noremap :bp -"noremap z :bp -"noremap q :bp -"noremap x :bn -"noremap w :bn -"noremap c :bd - -" Normal Mode Mappings -nnoremap ; : -nnoremap : ; -nnoremap n nzzzv -nnoremap N Nzzzv -nnoremap + :exe "resize " . (winheight(0) * 3/2) -nnoremap - :exe "resize " . (winheight(0) * 2/3) -nnoremap :noh -nnoremap ev :vsplit $MYVIMRC -"nnoremap sv :source $MYVIMRC -nnoremap sh :terminal -"nnoremap html :-1read ~/.vim/template/html3jwf>a -"nnoremap php :-1read ~/.vim/template/php2ja - +" Pandoc +packadd vim-pandoc +packadd vim-pandoc-syntax -"" Visual Mode Mappings -vmap < >gv - -" Insert Mode Mappings -inoremap u - -" Command Mode Mappings - -" Command aliases -cnoreabbrev w!! w !sudo tee "%" - -" Termninal Mappings -tnoremap h -tnoremap j -tnoremap k -tnoremap l -tnoremap :bnext -tnoremap :bprev - -" Functions +" Fuzzy finder +packadd L9 +packadd FuzzyFinder -function! s:setupWrapping() - set wrapscan - set wrap - set wrapmargin=2 - set textwidth=79 -endfunction - -function! s:CmakeInit() - let &errorformat="%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f|%l| %m" - set makeprg=cmake -endfunction -command! -bang -nargs=0 -complete=file CmakeInit call s:CmakeInit() - -function! s:Doxygen() - set errorformat+=%f:%l:\ %m - set makeprg=doxygen -endfunction -command! -bang -nargs=0 -complete=file Doxygen call s:Doxygen() - -function! s:Iar() - set errorformat=%f(%l)\ :\ %m - set makeprg=vim-iarbuild.cmd -endfunction -command! -bang -nargs=0 -complete=file Iar call s:Iar() - - -" Autocommands -if has('autocmd') - " c - augroup vimrc-c - autocmd! - autocmd FileType c setlocal tabstop=2 shiftwidth=2 expandtab - autocmd FileType cpp setlocal tabstop=2 shiftwidth=2 expandtab - augroup END - - " python - augroup vimrc-python - autocmd! - autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 - \ formatoptions+=croq softtabstop=4 - \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with - augroup END - - " txt - augroup vimrc-txt - autocmd! - autocmd BufRead,BufNewFile *.txt call s:setupWrapping() - augroup END - - augroup filetypes - autocmd! - autocmd bufnewfile,buffilepre,bufread *.md set filetype=markdown - autocmd bufnewfile,buffilepre,bufread *.gradle set filetype=groovy - autocmd bufnewfile,buffilepre,bufread *.json set filetype=json - autocmd bufnewfile,buffilepre,bufread *.yml set filetype=yaml - augroup END - - augroup saveall - autocmd! - autocmd focuslost * wall - augroup END - - augroup numbers - autocmd! - autocmd bufenter,focusgained,insertleave * set relativenumber - autocmd bufleave,focuslost,insertenter * set norelativenumber - augroup END - - augroup vimrc - autocmd! - autocmd bufwritepost ~/.vim/gvimrc source % - autocmd bufwritepost ~/.vim/vimrc source % - autocmd bufwritepost ~/.vim/vimrc.local source % - augroup END - - augroup quickfix -" autocmd QuickFixCmdPost [^l]* nested cwindow -" autocmd QuickFixCmdPost l* nested lwindow - autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1) - augroup END -endif +packloadall +silent! helptags ALL " local settings if filereadable(expand('~/.vim/vimrc.local')) source ~/.vim/vimrc.local endif -" Load all plugins now. -packloadall -silent! helptags ALL diff --git a/README.md b/README.md index 3536666..4896219 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # dotfiles -1/ First download 'dit-init.sh' +1) First download 'dit-init.sh' - $ git archive --remote=git@jaza.me:jaz/dit.git master bin/dit-init.sh | tar -x --strip-components 1 +> $ git archive --remote=git@jaza.me:jaz/dit.git master bin/dit-init.sh | tar -x --strip-components 1 -2/ Next execute it +2) Next execute it - $ ./dit-init.sh +> $ ./dit-init.sh -3/ Now you can manage dotfiles with 'dit' (same as 'git') +3) Now you can manage dotfiles with 'dit' (same as 'git') - $ dit +> $ dit diff --git a/notes/Makefile b/notes/Makefile new file mode 100644 index 0000000..5711671 --- /dev/null +++ b/notes/Makefile @@ -0,0 +1,18 @@ +MDs := $(shell find -name '*.md') +PDFs := $(patsubst %.md,%.pdf,$(MDs)) +HTMLs := $(patsubst %.md,%.html,$(MDs)) +HTML_FLAGS = +PDF_FLAGS = --pdf-engine=pdflatex + +all: $(PDFs) + +html: $(HTMLs) + +clean: + @rm -f $(PDFs) $(HTMLs) + +%.pdf: %.md + pandoc $(PDF_FLAGS) -o $@ $< + +%.html: %.md + pandoc $(HTML_FLAGS) -o $@ $<