使用vim作为keil外部编辑器

喜欢vim的快捷键和一些插件,下载好vim后,在tools中添加外部工具
 

vim配置文件

" Setting some decent VIM settings for programming
" This source file comes from git-for-windows build-extra repository (git-extra/vimrc)
ru! defaults.vim                " Use Enhanced Vim defaults
aug vimStartup | au! | aug END  " Revert last positioned jump, as it is defined below
let g:skip_defaults_vim = 1     " Do not source defaults.vim again (after loading this system vimrc)
"colorscheme torte
let mapleader=" "
set nu
set ai                          " set auto-indenting on for programming
set showmatch                   " automatically show matching brackets. works like it does in bbedit.
set vb                          " turn on the "visual bell" - which is much quieter than the "audio blink"
set laststatus=2                " make the last line where the status is two lines deep so you can see status always
set showmode                    " show the current mode
set clipboard=unnamed           " set clipboard to unnamed to access the system clipboard under windows
"set wildmode=list:longest,longest:full   " Better command line completion
set nobackup       " no backup files
set noswapfile     " no swap files
set nowritebackup  " only in case you don't want a backup file while editing
set noundofile     " no undo files
"set cursorline     " cursorline

set statusline=%f               " filename relative to current $PWD
set statusline+=%Y               " filename type
set statusline+=%h              " help file flag
set statusline+=%m              " modified flag
set statusline+=%r              " readonly flag
set statusline+=%=              " Rest: right align
set statusline+=\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})  " last modified timestamp
set statusline+=\ %{&ff}:%{&fenc!=''?&fenc:&enc}%1*      " Fileformat [unix]/[dos] etc...
set statusline+=\ %l,%c%V         " Position in buffer: linenumber, column, virtual column
set statusline+=\ %P            " Position in buffer: Percentage
"set statusline=%2*%n%m%r%h%w%*\ %F\ %1*[FORMAT=%2*%{&ff}:%{&fenc!=''?&fenc:&enc}%1*]\ [TYPE=%2*%Y%1*]\ [ROW=%2*%03l%1*/%3*%L(%p%%)%1*]\
set ignorecase
set smartcase
"------------------------------------------------------------------------------
" Only do this part when compiled with support for autocommands.
if has("autocmd")
    " Set UTF-8 as the default encoding for commit messages
    autocmd BufReadPre COMMIT_EDITMSG,MERGE_MSG,git-rebase-todo setlocal fileencoding=utf-8

    " Remember the positions in files with some git-specific exceptions"
    autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$")
      \           && &filetype !~# 'commit\|gitrebase'
      \           && expand("%") !~ "ADD_EDIT.patch"
      \           && expand("%") !~ "addp-hunk-edit.diff" |
      \   exe "normal! g`\"" |
      \ endif

      autocmd BufNewFile,BufRead *.patch set filetype=diff

      autocmd Filetype diff
      \ highlight WhiteSpaceEOL ctermbg=red |
      \ match WhiteSpaceEOL /\(^+.*\)\@<=\s\+$/
endif " has("autocmd")
if has("multi_byte") 
    " UTF-8 编码 
    set encoding=utf-8 
    set termencoding=utf-8 
    set formatoptions+=mM 
    set fencs=utf-8,gbk 
    if v:lang =~? '^/(zh/)/|/(ja/)/|/(ko/)' 
        set ambiwidth=double 
    endif 
    if has("win32") 
        source $VIMRUNTIME/delmenu.vim 
        source $VIMRUNTIME/menu.vim 
        language messages zh_CN.utf-8 
    endif 
endif

set helplang=cn,en
set ts=4
set expandtab
set softtabstop=4
set shiftwidth=4
set backspace=indent,eol,start
set whichwrap=h,l,b,s,<,>,[,]
set guioptions-=T
set guioptions-=m
set guioptions-=L
set guioptions-=r
set guioptions-=b
" 使用内置 tab 样式而不是 gui
set guioptions-=e
set nolist
set guifont=SauceCodePro\ NF\ SemiBold:h10:cANSI
call plug#begin("E:/Program Files/Vim/vim91/Plugged")
Plug 'junegunn/seoul256.vim'
Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jlanzarotta/bufexplorer'
Plug 'tpope/vim-surround'
Plug 'jsfaint/gen_tags.vim'
"Plug 'girishji/vimcomplete'
Plug 'majutsushi/tagbar'
Plug 'easymotion/vim-easymotion'
"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
"Plug 'junegunn/fzf.vim'
"Plug 'yggdroot/indentline'
"Plug 'ludovicchabant/vim-gutentags'
Plug 'skywind3000/vim-auto-popmenu'
Plug 'skywind3000/vim-dict'
Plug 'jiangmiao/auto-pairs'
Plug 'kien/ctrlp.vim'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'kien/rainbow_parentheses.vim'
Plug 'justinmk/vim-sneak'
"Plug 'nathanaelkane/vim-indent-guides'
"Plug 'skywind3000/gutentags_plus'
call plug#end()
" You can revert the settings after the call like so:
"   filetype indent off   " Disable file-type-specific indentation
"   syntax off            " Disable syntax highlighting
" Color schemes should be loaded after plug#end().
" We prepend it with 'silent!' to ignore errors when it's not yet installed.
silent! colorscheme seoul256-light 
autocmd VimEnter * NERDTree | wincmd p
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
    \ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
let g:airline_theme="powerlineish"
let g:airline_theme="light" " 设置主题
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.dirty= '⚡'
" 支持 powerline 字体
let g:airline_powerline_fonts = 1
"显示窗口tab和buffer
let g:airline#extensions#tabline#left_sep = ' ' "tabline中未激活buffer两端的分隔字符
let g:airline#extensions#tabline#enabled = 1
" 关闭空白符检测
let g:airline#extensions#whitespace#enabled=0
" tabline中buffer显示编号
let g:airline#extensions#tabline#left_alt_sep = '|' "tabline中buffer显示编号
let g:airline#extensions#tabline#buffer_nr_show = 1

"buffer列表中下一个
noremap <tab> :bn<CR>
"buffer列表中上一个
nnoremap <s-tab> :bp<CR>
nnoremap <leader>bd :NERDTreeClose<cr>:bd<CR>
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-l> <c-w>l
nnoremap <c-k> <c-w>k

nnoremap <leader>el :vs<cr>:bn<cr><c-w>l 
nnoremap <leader>eh :vs<cr><c-w>l:bn<cr><c-w>h
nnoremap <leader>ej :sp<cr>:bn<cr><c-w>j 
nnoremap <leader>ek :sp<cr><c-w>j:bn<cr><c-w>k
nnoremap <leader>we :NERDTreeToggle<CR>
nnoremap <leader>wE :NERDTreeFind<CR>
nnoremap <leader>wn :NERDTree<CR>

imap jk <esc>
imap jj <esc>

map L $
map H ^
map <leader>es :w<cr>
map <leader>eS :w<space> 
let g:apc_enable_ft = {'*':1}
set cpt=.,k,w,b,],t
set completeopt=menu,menuone,noselect
set shortmess+=c
"
let g:apc_min_length = 5
nmap <leader>wt :TagbarToggle<CR>

let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
  let g:ctrlp_custom_ignore = {
    \ 'dir':  '\v[\/]\.(git|hg|svn)$',
    \ 'file': '\v\.(exe|so|dll)$',
    \ 'link': 'some_bad_symbolic_links',
    \ }
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d'  " Windows

nmap <leader>gd <c-\>g
nmap <leader>gc <c-\>c
nmap <leader>ge <c-\>e
nmap <leader>gf <c-\>f
nmap <leader>gi <c-\>i
nmap <leader>gs <c-\>s
nmap <leader>gt <c-\>t
let g:cpp_class_scope_highlight = 1
let g:cpp_member_variable_highlight = 1
let g:cpp_class_decl_highlight = 1
let g:cpp_posix_standard = 1
let g:cpp_experimental_simple_template_highlight = 1

let g:rbpt_colorpairs = [
    \ ['brown',       'RoyalBlue3'],
    \ ['Darkblue',    'SeaGreen3'],
    \ ['darkgray',    'DarkOrchid3'],
    \ ['darkgreen',   'firebrick3'],
    \ ['darkcyan',    'RoyalBlue3'],
    \ ['darkred',     'SeaGreen3'],
    \ ['darkmagenta', 'DarkOrchid3'],
    \ ['brown',       'firebrick3'],
    \ ['gray',        'RoyalBlue3'],
    \ ['black',       'SeaGreen3'],
    \ ['darkmagenta', 'DarkOrchid3'],
    \ ['Darkblue',    'firebrick3'],
    \ ['darkgreen',   'RoyalBlue3'],
    \ ['darkcyan',    'SeaGreen3'],
    \ ['darkred',     'DarkOrchid3'],
    \ ['red',         'firebrick3'],
    \ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
imap è <left>
imap ì <right>
imap ê <down>
imap ë <up>

map  / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)

" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
map  n <Plug>(easymotion-next)
map  N <Plug>(easymotion-prev)

let g:EasyMotion_do_mapping = 0 
" Gif config
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>jj <Plug>(easymotion-j)
map <Leader>jk <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
map <Leader>jb <Plug>(easymotion-b)
map <Leader>jB <Plug>(easymotion-B)
map <Leader>je <Plug>(easymotion-e)
map <Leader>jE <Plug>(easymotion-E)
map <Leader>jw <Plug>(easymotion-w)
map <Leader>jW <Plug>(easymotion-W)
map <Leader>jg <Plug>(easymotion-ge)
map <Leader>jG <Plug>(easymotion-gE)
map <Leader>jf <Plug>(easymotion-f)
map <Leader>jF <Plug>(easymotion-F)
map <Leader>jt <Plug>(easymotion-t)
map <Leader>jT <Plug>(easymotion-T)
map <Leader>jr <Plug>(easymotion-repeat) 
map <Leader>jl <Plug>(easymotion-bd-jk)

let g:EasyMotion_startofline = 1 " keep cursor column when JK motion
let g:EasyMotion_smartcase = 1

 gtags 实现函数跳转 有简单的tags补全不能模糊补全还没有找到替代 ctrlp实现文件的模糊搜索其他的就是简单的外观高亮设置 效果如下
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值