"vim的设置
" __ __ ___ __ __ ____ ____
" \ \ / / |_ _| | \/ | | _ \ / ___|
" \ \ / / | | | |\/| | | |_) | | |
" \ V / | | | | | | | _ < | |___
" \_/ |___| |_| |_| |_| \_\ \____|
"显示模式
set showmode
"共享剪贴板
set clipboard=unnamedplus
"自动语法高亮
set syntax=on
"高亮显示匹配的括号([{和}])"
set showmatch
"高亮搜索
set hlsearch
"输入的命令显示出来"
set showcmd
"显示颜色
set t_Co=256
"打开鼠标
set mouse=a
"显示相对行号
set relativenumber
"命令模式下允许自动补全命令
set wildmenu
"高亮当前行
set cursorline
"实时匹配
set incsearch
"搜索时忽略大小写
set ignorecase
"智能大小写(输入大写时就对大小写敏感,否则不敏感)
set smartcase
"自动切换到当前文件的目录
set autochdir
"光标移动到buffer的顶部底部保持3行
set scrolloff=3
"检测文件类型
filetype on
"显示行号
set number
"自动缩进
set smartindent
"自动缩进的空格数
set shiftwidth=4
"tab的空格数
set tabstop=4
"按下tab自动转化为空格
set expandtab
"tab被转化为共个的数目
set softtabstop=4
"vim的编码方式
set fileencodings=utf-8,gbk
"折叠方式
set foldmethod=manual
"更新时间
set updatetime=10
"plug插件管理设置
call plug#begin('~/.vim/plugged')
Plug 'mhinz/vim-startify'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Valloric/YouCompleteMe'
Plug 'tpope/vim-surround'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
call plug#end()
"自定义的快捷键
map S :w<CR>
map D :q<CR>
map Q :q!<CR>
map sr : set splitright<CR>:vsplit<CR>
map sn : set nosplitright<CR>:vsplit<CR>
map sb : set splitblow<CR>:vsplit<CR>
map tt : NERDTreeToggle<CR>
cmap w!! w !sudo tee > /dev/null %
" markdown-preview's config
"--------------start-------------
" set to 1, nvim will open the preview window after entering the markdown buffer
let g:mkdp_auto_start = 1
" set to 1, the nvim will auto close current preview window when change
let g:mkdp_auto_close = 1
" set to 1, the vim will refresh markdown when save the buffer or
let g:mkdp_refresh_slow = 1
" set to 1, the MarkdownPreview command can be use for all files,
let g:mkdp_command_for_global = 0
" set to 1, preview server available to others in your network
let g:mkdp_open_to_the_world = 0
" use custom IP to open preview page
let g:mkdp_open_ip = '127.0.0.1'
" specify browser to open preview page
" let g:mkdp_browser = 'chromium'
let g:mkdp_browser = 'google-chrome-stable'
let g:mkdp_preview_options = {
\ 'mkit': {},
\ 'katex': {},
\ 'uml': {},
\ 'maid': {},
\ 'disable_sync_scroll': 0,
\ 'sync_scroll_type': 'middle',
\ 'hide_yaml_meta': 1,
\ 'sequence_diagrams': {},
\ 'flowchart_diagrams': {},
\ 'content_editable': v:false,
\ 'disable_filename': 0
\ }
" use a custom port to start server or random for empty
let g:mkdp_port = '8080'
" preview page title
let g:mkdp_page_title = '「${name}」'
" recognized filetypes
let g:mkdp_filetypes = ['markdown']
let g:mkdp_path_to_chrome = '/usr/bin/chromium'
" Whether to enable synchronization
let g:mkdp_preview_options.disable_sync_scroll = 0
"--------------end-------------
" youcompeleteme'setting
"--------------start-------------
"let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
"2个字符后开始补全
let g:ycm_min_num_identifier_candidate_chars = 2
"tab键不弹出函数定义
set completeopt=menu,menuone
let g:ycm_add_preview_to_completeopt = 0
set completeopt-=preview
let g:ycm_auto_hover=''
"补全列表的颜色(灰色)
highlight PMenu ctermbg=242 ctermfg=0 guifg=black guibg=darkgrey
highlight PMenuSel ctermfg=242 ctermbg=8 guifg=darkgrey guibg=black
"--------------end-------------
"##### auto fcitx ###########
"--------------start-------------
let g:input_toggle = 1
function! Fcitx2en()
let s:input_status = system("fcitx-remote")
if s:input_status == 2
let g:input_toggle = 1
let l:a = system("fcitx-remote -c")
endif
endfunction
function! Fcitx2zh()
let s:input_status = system("fcitx-remote")
if s:input_status != 2 && g:input_toggle == 1
let l:a = system("fcitx-remote -o")
let g:input_toggle = 0
endif
endfunction
set ttimeoutlen=150
"退出插入模式
autocmd InsertLeave * call Fcitx2en()
"进入插入模式
"--------------end-------------
" vim-markdown
" 禁用折叠
let g:vim_markdown_folding_disabled=1
" latex公式高亮
let g:vim_markdown_math = 1