ih4cku / blog

deprecated, Git issues are great for writing blogs :)
2 stars 0 forks source link

thesis writing setup #47

Open ih4cku opened 8 years ago

ih4cku commented 8 years ago

Basically, I want to use vim to write my thesis. And I want to have features below which are commonly needed when writing code:

So, I choose to use vimtex plugin and qpdfview as the pdf viewer.

The forward/backward search feature depends on the vim client/server mode. So, I add a alias to create a vim server when start writing.

# in ~/.bashrc
alias vimtex='vim --servername LATEX'
# in qpdfview: Edit>Settings>Behavior>Source editor
vim --servername LATEX --remote-silent +%2<CR> %1

Build options:

let g:vimtex_latexmk_options='-xelatex -verbose -file-line-error -synctex=1 -interaction=nonstopmode'

Set the viewer:

if has("win32")
    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 has("unix")
    let g:vimtex_view_general_viewer='qpdfview'
    let g:vimtex_view_general_options='--unique @pdf\#src:@tex:@line:@col'
    let g:vimtex_view_general_options_latexmk='--unique'
endif

Forward call after success building.

let g:vimtex_view_general_callback = 'ViewerCallback'
function! ViewerCallback(status) dict
    if a:status
        VimtexView
    endif
endfunction
ih4cku commented 8 years ago

text formmating for Chinese

set textwidth=80
set colorcolumn=81
set formatoptions+=amB
ih4cku commented 8 years ago

Completion not triggered in sub tex files

reason

The filetype is set to plaintex instead of tex when opening sub tex files.

see:

solve method

add following codes into .vimrc:

let g:tex_flavor = 'latex'

P.S.

ih4cku commented 8 years ago

great colorscheme kalisi

colorscheme kalisi

Ref: https://github.com/freeo/vim-kalisi

ih4cku commented 8 years ago

install fonts

sudo apt-get install ttf-mscorefonts-installer

Ref: How to install Microsoft fonts in Linux office suites

ih4cku commented 8 years ago

$ pair completion and visual mode cursor movement

autocmd FileType tex inoremap $ $$<left>

" movement in insert mode
inoremap <c-l> <right>
inoremap <c-k> <left> " <c-h> is occupied by vim