Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Coder-Liuu
Last active May 16, 2021 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coder-Liuu/992b20d61fba7e6b4232e8a556ef02ba to your computer and use it in GitHub Desktop.
Save Coder-Liuu/992b20d61fba7e6b4232e8a556ef02ba to your computer and use it in GitHub Desktop.
part-init-01.vim
" 设置支持语言 Python, C++, Go
let g:kite_supported_languages = ['python', 'cpp', 'go']
" Kite 状态条
set statusline=%<%f\ %h%m%r%{kite#statusline()}%=%-14.(%l,%c%V%)\ %P
set laststatus=2 " always display the status line
call plug#begin("~/.vim-plug")
Plug 'connorholyday/vim-snazzy'
Plug 'scrooloose/nerdcommenter'
Plug 'preservim/nerdtree',{ 'on': 'NERDTreeToggle' }
call plug#end()
map T :NERDTreeToggle<CR>
let g:SnazzyTransparent = 1
color snazzy
syntax on " 开启语法高亮
set number " 显示行号
set cursorline " 高亮显示当前行
set wrap " 自动换行
set showcmd " 显示指令
set wildmenu " 补全菜单
set hlsearch " 高亮搜索
set incsearch " 动态高亮
set ignorecase " 不区分大小写
set smartcase " 智能大小写
set nocompatible " 丢弃Vi功能
set encoding=utf-8 " 文件编码
set scrolloff=3 " 光标最多到达倒数第三行
set undofile " 持久撤销
set undodir=~/.temp" 撤销的文件路径
set clipboard=unnamedplus " 设置是否和系统共用一个剪贴板
filetype on
filetype indent on
filetype plugin on
filetype plugin indent on
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " 光标样式有关
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" 键位映射
noremap J 5j
noremap K 5k
noremap L 7l
noremap H 7h
noremap j gj
noremap k gk
noremap sd "_d
noremap S :w<CR>
inoremap jk <ESC>
" 异步运行
noremap ,e :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
:sp
:term ./%<
elseif &filetype == 'cpp'
set splitbelow
exec "!g++ -std=c++11 % -Wall -o %<"
:sp
:term ./%<
elseif &filetype == 'java'
exec "!javac %"
set splitbelow
:sp
:term java %:t:r
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
set splitbelow
:sp
:term time python3 -W ignore %
elseif &filetype == 'html'
silent! exec "!".g:mkdp_browser." % &"
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStop"
silent! exec "VimtexCompile"
elseif &filetype == 'dart'
CocCommand flutter.run -d iPhone\ 11\ Pro
CocCommand flutter.dev.openDevLog
elseif &filetype == 'go'
set splitbelow
:sp
:term go run .
endif
endfunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment