vim配置(嵌入式C语言开发)

一、序言

      本文针对是对于嵌入式开发者,个人而言比较好用一些的配置版本

二、使用方法

      在家目录中添加**.vimrc**文件,将配置添加进去即可。

三、.vimrc配置文件

      除了一些基础配置以外,还添加了一些好用的插件:Vundle、ctags、cscope等。使用效果图如下:
在这里插入图片描述

"    Author: Pitnitus
"    Created: 2022-01-01
" LastChange: 2022-05-08

"iGENERAL SETTINGS: {{{1
" To use VIM settings, out of VI compatible mode.
set nocompatible
" Enable file type detection.
filetype plugin indent on
" Syntax highlighting.
syntax on
" Setting colorscheme
" Other settings.
set   autoindent
set   autoread
set   autowrite
set   background=dark
set   backspace=indent,eol,start
set nobackup
set   cindent
set   cinoptions=:0
set   cursorline
set   completeopt=longest,menuone
set noexpandtab
set   fileencodings=utf-8,gb2312,gbk,gb18030
set   fileformat=unix
set   foldenable
set   foldmethod=marker
set   guioptions-=T
set   guioptions-=m
set   guioptions-=r
set   guioptions-=l
set   helpheight=10
set   helplang=cn
set   hidden
"set   history=100
set   hlsearch
set   ignorecase
set   incsearch
set   laststatus=2
set   mouse-=a
set   number
set   paste
set   pumheight=10
set   ruler
set   scrolloff=5
set   shiftwidth=4
set   showcmd
set   smartindent
set   smartcase
set   tabstop=4
set   termencoding=utf-8
set   textwidth=80
set   whichwrap=h,l
set   wildignore=*.bak,*.o,*.e,*~
set   wildmenu
set   wildmode=list:longest,full
set nowrap
"""""""""""""""""""""""""""""""""""""
"1 Vundle manage
set nocompatible 	"be iMproved, required
filetype off		"required

"set the runtime path to include Vundle and initialize
set rtp+=~/Vundle.vim
call vundle#begin()

"let Vundle manage Vundle, required
Plugin 'Vundle.vim'

"All of your Plugins must be added before the following line
call vundle#end()	" required
filetype plugin indent on "required


"""""""""""""""""""""""""""""""""""""'
"ctags manage
"sudo apt-get install ctags
"Use :
"    Process use command "ctags -R"
"	ctrl+] --> 
"	ctrl+T <--
:set tags=tags

""""""""""""""""""""""""""""""""""""
"cscope manage
"sudo apt-get install cscope
"
"cscope : build-in datalib:cscope-Rbq;
"	F5 : find c char;
"	F6 : find a string
"	F7 : find handle's define
"	F8 : find it who used handle
if has("cscope")
	set csprg=/usr/bin/cscope
	set csto=1
	set nocsverb
	"add any database in current directory
	if filereadable("cscope.out")
		cs add cscope.out
	endif
	set csverb
endif
:set cscopequickfix=s-,c-,d-,i-,t-,e-

nmap <silent> <F5> :cs find s <C-R>=expand("<cword>") <CR><CR>
nmap <silent> <F6> :cs find t <C-R>=expand("<cword>") <CR><CR>
nmap <silent> <F7> :cs find c <C-R>=expand("<cword>") <CR><CR>
nmap <silent> <F8> :cs find d <C-R>=expand("<cword>") <CR><CR>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'majutsushi/tagbar' " Tag bar"
" Tagbar
let g:tagbar_width=40
autocmd BufReadPost *.cpp,*.c,*.h,*.cc,*.cxx call tagbar#autoopen()

""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'scrooloose/nerdtree'
" NetRedTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
let NERDTreeWinSize=15
let NERDTreeShowLineNumbers=5
let NERDTreeAutoCenter=1
let NERDTreeShowBookmarks=1

""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tools for language rules to check
Plugin 'w0rp/ale'

let g:ale_sign_columm_always=1
let g:ale_sign_error = 'X'
let g:ale_sign_sign_warning = 'w'
let g:ale_statusline_format = ['X %d', '~~ %d', '\/ OK']
let g:ale_echo_msg_format = '[%linter%] %code: %%s'
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_c_gcc_options = '-Wall -O2 -std=c99'
let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14'
let g:ale_c_cppcheck_options = ''
let g:ale_cpp_cppcheck_options = ''

""""""""""""""""""""""""""""""""""""""""""""""""""
Plugin 'Valloric/YouCompleteMe'

set number

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是配置 C 语言开发环境Vim 配置: 1. 安装 Vim 插件管理工具 Vundle: ```bash git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim ``` 2. 在 `~/.vimrc` 中添加以下内容: ```vim set tabstop=4 set shiftwidth=4 set expandtab set smartindent " Plugin Settings call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'vim-airline/vim-airline' Plugin 'scrooloose/nerdtree' Plugin 'tpope/vim-fugitive' Plugin 'jiangmiao/auto-pairs' Plugin 'vim-scripts/c.vim' call vundle#end() " Airline Settings let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 let g:airline#extensions#tagbar#enabled = 1 let g:airline#extensions#tagbar#symbols = { \ 'function': 'ƒ', \ 'variable': '𝑣', \ 'class': '𝑐', \ 'struct': '𝑠', \ 'interface': '𝑖', \ 'type': '𝑡', \ } " NERDTree Settings map <C-n> :NERDTreeToggle<CR> let NERDTreeShowHidden=1 let NERDTreeIgnore=['\.pyc$', '\.swp$'] " Auto Pairs Settings let g:AutoPairsShortcutFastWrap = '<M-e>' let g:AutoPairsMapChords = 1 let g:AutoPairsFlyMode = 1 " C.vim Settings let c_space_errors = 1 let c_no_curly_error = 1 let c_no_if0_error = 1 let c_indent_comment = 1 let c_indent_labels = 1 let c_auto_tab = 1 let c_syn_caret = 1 let c_syn_error = 1 let c_syn_warning = 1 let c_syn_level = 4 let c_highlight_comments = 1 let c_highlight_numbers = 1 let c_highlight_strings = 1 let c_highlight_types = 1 let c_highlight_preproc = 1 let c_highlight_operators = 1 let c_highlight_extra = 1 ``` 3. 执行 `:PluginInstall` 命令安装插件。 4. 配置完成后,可以使用 `:NERDTreeToggle` 打开文件树,使用 `<C-n>` 组合键切换文件树的显示和隐藏。 5. 对于 C 语言的开发,可以使用 `:CCompile` 命令编译当前文件,并使用 `:CRun` 命令运行编译后的可执行文件。 注意:以上配置仅供参考,具体的配置可以根据自己的需求进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值