Closed wellcomez closed 4 years ago
" 更新时间:2016-03-30 12:15:21
" 定义快捷键的前缀,即
" 开启文件类型侦测 filetype on " 根据侦测到的不同类型加载对应的插件 filetype plugin on set mouse=a " <<
" >> " vim 自身(非插件)快捷键
" 定义快捷键到行首和行尾
"inoremap ``
" 让配置变更立即生效
" >> " 其他
" 开启实时搜索功能 "set incsearch
" 搜索时大小写不敏感 set ignorecase
" 关闭兼容模式 set nocompatible
" vim 自身命令行模式智能补全 set wildmenu
" <<
" vundle 环境设置 filetype off
" == VIM PLUG ================================
call plug#begin('~/.nvim/plugged')
nmap
Plug 'ripxorip/aerojump.nvim', { 'do': ':UpdateRemotePlugins' }
"------------------------ COC ------------------------ " coc for tslinting, auto complete and prettier Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} " coc extensions let g:coc_global_extensions = ['coc-tslint-plugin', 'coc-tsserver', 'coc-prettier'] "------------------------ VIM TSX ------------------------ " by default, if you open tsx file, neovim does not show syntax colors " vim-tsx will do all the coloring for jsx in the .tsx file Plug 'ianks/vim-tsx' "------------------------ VIM TSX ------------------------ " by default, if you open tsx file, neovim does not show syntax colors " typescript-vim will do all the coloring for typescript keywords Plug 'leafgarland/typescript-vim' Plug 'ap/vim-css-color' Plug '907th/vim-auto-save' let g:auto_save = 1 " enable AutoSave on Vim startup
"fzf
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
noremap
"Leaderf
"Plug 'rking/ag.vim'
"map
Plug 'flazz/vim-colorschemes'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
let g:UltiSnipsExpandTrigger="
command! -nargs=0 Prettier :CocCommand prettier.formatFile
" Use
" Use
" Use
" Use
" Use
"加上/解开注释, 智能判断
" >>
" 工程文件浏览
Plug 'vim-scripts/winmanager'
Plug 'scrooloose/nerdtree'
"" 工程文件浏览
"" 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list
"nmap wm :NERDTreeToggle
Plug 'vim-scripts/a.vim' "Tagbar........................................................................................ "Plug 'vim-scripts/Tagbar' Plug 'majutsushi/tagbar' let g:tagbar_type_typescript = { \ 'ctagstype': 'typescript', \ 'kinds': [ \ 'c:classes', \ 'n:modules', \ 'f:functions', \ 'v:variables', \ 'v:varlambdas', \ 'm:members', \ 'i:interfaces', \ 'e:enums', \ ] \ }
"let g:tagbar_type_typescript = { "\ 'ctagstype': 'typescript', "\ 'kinds': [ "\ 'c:classes', ""\ 'n:modules', "\ 'f:functions', "\ 'v:variables', "\ 'v:varlambdas', "\ 'm:members', "\ 'i:interfaces', "\ 'e:enums', "\ ] "} "jsctags "Plug 'ternjs/tern_for_vim' "Plug 'ramitos/jsctags' "let g:tagbar_type_javascript = { "\ 'ctagsbin' : 'jsctags' " \ } "jsctags
"let g:TagbarToggle = 'tb'
"nmap
"gtags------------------------- "Plug 'gtags.vim' "Plug 'ludovicchabant/vim-gutentags' "" gutentags 搜索工程目录的标志,当前文件路径向上递归直到碰到这些文件/目录名 "let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']
"" 所生成的数据文件的名称 "let g:gutentags_ctags_tagfile = '.tags'
"" 同时开启 ctags 和 gtags 支持: "let g:gutentags_modules = [] ""if executable('ctags') ""let g:gutentags_modules += ['ctags'] ""endif "if executable('gtags-cscope') && executable('gtags') "let g:gutentags_modules += ['gtags_cscope'] "endif
"" 将自动生成的 ctags/gtags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录 "let g:gutentags_cache_dir = expand('~/.cache/tags')
"" 配置 ctags 的参数 "let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q'] "let g:gutentags_ctags_extra_args += ['--c++-kinds=+px'] "let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
"" 如果使用 universal ctags 需要增加下面一行 "let g:gutentags_ctags_extra_args += ['--output-format=e-ctags']
"" 禁用 gutentags 自动加载 gtags 数据库的行为 "let g:gutentags_auto_add_gtags_cscope = 0 "Plug 'skywind3000/gutentags_plus' "" change focus to quickfix window after search (optional). "let g:gutentags_plus_switch = 1 "gtags-------------------------
"coc_nvim "" if hidden is not set, TextEdit might fail. set hidden
" Some servers have issues with backup files, see #649 set nobackup set nowritebackup
" Better display for messages set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000. set updatetime=300
" don't give |ins-completion-menu| messages. set shortmess+=c
" always show signcolumns set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap
function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction
" Use
" Use <C-g>u
means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap
" Use [c
and ]c
to navigate diagnostics
nmap
" Remap keys for gotos
nmap
" Use K to show documentation in preview window
nnoremap
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('
" Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap
" Remap for format selected region
xmap
augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end
" Remap for do codeAction of selected region, ex: <leader>aap
for current paragraph
xmap
" Remap for do codeAction of current line
nmap
" Use
" Use :Format
to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use :Fold
to fold current buffer
command! -nargs=? Fold :call CocAction('fold',
" use :OR
for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
nmap :h coc-status
"function! StatusDiagnostic() abort "let info = get(b:, 'coc_diagnostic_info', {}) "if empty(info) | return '' | endif "let msgs = [] "if get(info, 'error', 0) "call add(msgs, 'E' . info['error']) "endif "if get(info, 'warning', 0) "call add(msgs, 'W' . info['warning']) "endif "return join(msgs, ' '). ' ' . get(g:, 'coc_status', '') "".' '.get(b:,'coc_current_function','') "endfunctio "set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}%{StatusDiagnostic()} "Plug 'Lokaltog/vim-powerline' "set laststatus=2
"vista
Plug 'liuchengxu/vista.vim'
nmap
Plug 'liuchengxu/eleline.vim' set laststatus=2
"lightline "function! CocCurrentFunction() "return get(b:, 'coc_current_function', '') "endfunction "Plug 'itchyny/lightline.vim' "let g:lightline = { "\ 'colorscheme': 'wombat', "\ 'active': { "\ 'left': [ [ 'mode', 'paste' ], "\ [ 'readonly', 'filename', 'modified', 'method' ] ] "\ }, "\ 'component_function': { "\ 'method': 'NearestMethodOrFunction' "\ }, " \ } "Plug 'itchyny/lightline.vim' "let g:lightline = { "\ 'active': { "\ 'left': [ [ 'mode', 'paste' ], "\ [ 'gitbranch', 'cocstatus', 'currentfunction', 'method','readonly', 'filename', 'modified' ] ] "\ }, "\ 'component_function': { "\ 'gitbranch': 'fugitive#head', "\ 'cocstatus': 'coc#status', "\ 'currentfunction': 'NearestMethodOrFunction' "\ }, "\ }
""lightline
"airline------ "Plug 'vim-airline/vim-airline' "Plug 'vim-airline/vim-airline-themes' "let g:airline#extensions#coc#enabled = 1 "let airline#extensions#coc#error_symbol = 'e:' "let airline#extensions#coc#warning_symbol = 'w:' "let airline#extensions#coc#stl_format_err = '%e{[%e(#%fe)]}' "let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]}' "let g:airline#extensions#tagbar#enabled = 1 "airline------
" Using CocList
" Show all diagnostics
nnoremap
" grep word under cursors
"
Plug 'jremmen/vim-ripgrep'
map
nnoremap
autocmd BufRead,BufNewFile *.mm :set ft=cpp
Plug 'terryma/vim-multiple-cursors'
au CursorHold checktime
Plug 'fholgado/minibufexpl.vim'
Plug 'vim-scripts/AutoComplPop'
"Plug 'wellcomez/project.vim'
"cscope
"Plug 'cscope.vim'
"Plug 'cscope-menu'
"Plug 'autoloadcscope.vim'
"set cscopequickfix=s-,c-,d-,i-,t-,e-
"set cscopeprg=gtags-cscope
"
nmap <C->s :GscopeFind s
"ctrlp...............................................................................................
Plug 'vim-scripts/ctrlp.vim'
set wildignore+=/.git/,/.hg/,/.svn/,/gradle/,/node_modules/,/venv/,/build/ " Linux/MacOSX
let g:ctrlp_max_height = 100
let g:ctrlp_max_files =0
let g:ctrlp_by_filename = 0
let g:ctrlp_clear_cache_on_exit = 0
"let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
set wildignore+=/tmp/,.so,.swp,.zip,.o " MacOSX/Linux
set wildignore+=\tmp\*,.swp,.zip,.exe " Windows
let g:ctrlp_custom_ignore = {
\ 'dir': '|node_modules|.git$|.hg$|.svn$|.yardoc|public\/images|public\/system|data|log|tmp$',
\ 'file': '\v.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
"noremap
Plug 'scrooloose/nerdcommenter'
" 插件列表结束 filetype plugin indent on " <<<< on " 配色方案 " if has("gui_running") set background=dark colorscheme evening else colorscheme darkblue endif
set laststatus=2
set ruler
set number
set cursorline set cursorcolumn
" 高亮显示搜索结果 " set hlsearch
" 禁止折行 set nowrap
" 开启语法高亮功能 syntax enable " 允许用指定语法高亮配色方案替换默认方案 syntax on
" 缩进 " 自适应不同语言的智能缩进 filetype indent on
" 将制表符扩展为空格 set expandtab " 设置编辑时制表符占用空格数 set tabstop=4 " 设置格式化时制表符占用空格数 set shiftwidth=4 " 让 vim 把连续数量的空格视为一个制表符 set softtabstop=4
call plug#end() " == VIMPLUG END ================================ " == AUTOCMD ================================ " by default .ts file are not identified as typescript and .tsx files are not " identified as typescript react file, so add following au BufNewFile,BufRead .ts setlocal filetype=typescript au BufNewFile,BufRead .tsx setlocal filetype=typescript.tsx " == AUTOCMD END ================================ colorscheme molokai
1.打开cpp,statubar 无颜色 2.也没有当前函数 3.然后切换到:A切到hpp ,然后切回cpp,着色出现 4.如果在执行vista coc ,函数名称正常
"vista Plug 'liuchengxu/vista.vim' nmap :Vista!!
function! NearestMethodOrFunction() abort
return get(b:, 'vista_nearest_method_or_function', '')
endfunction
set statusline+=%{NearestMethodOrFunction()}
autocmd VimEnter * call vista#RunForNearestMethodOrFunction()
Plug 'liuchengxu/eleline.vim' set laststatus=2