标签:com getline 保存 sea -- idt status media 双击
call plug#begin(‘~/.vim/plugged‘)
""Plug ‘itchyny/lightline.vim‘
"Plug ‘Yggdroot/LeaderF‘, { ‘dir‘: ‘~/LeaderF‘, ‘do‘: ‘./install --all‘ }
" Plug ‘junegunn/fzf‘, { ‘dir‘: ‘~/.fzf‘, ‘do‘: ‘./install --all‘ }
Plug ‘~/.vim/plugged/tabular/‘
Plug ‘~/.vim/plugged/LeaderF/‘
"Plug ‘ludovicchabant/vim-gutentags‘
"Plug ‘vimwiki/vimwiki‘
call plug#end()
" cscope config
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
if has("win32")
let $VIMFILES = $VIM.‘/vimfiles‘
else
let $VIMFILES = $HOME.‘/.vim‘
endif
"=========================================================================
""
"" DesCRiption: 适合自己使用的vimrc文件,for Linux/Windows, GUI/Console
"
"""=========================================================================
syntax on "自动语法高亮
set ts=4
set tabstop=4
set expandtab
" 设置当文件被改动时自动载入
set autoread
" quickfix模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
"代码补全
set completeopt=preview,menu
"允许插件
filetype plugin on
"共享剪贴板
set clipboard+=unnamed
"从不备份
set nobackup
"make 运行
:set makeprg=g++\ -Wall\ \ %
"自动保存
set autowrite
"set ruler " 打开状态栏标尺
set cursorline " 突出显示当前行
set magic " 设置魔术
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单栏
"set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set foldcolumn=0
set foldmethod=indent
set foldlevel=3
set foldenable " 开始折叠
" 不要使用vi的键盘模式,而是vim自己的
set nocompatible
" 语法高亮
set syntax=on
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 自动缩进
set autoindent
set cindent
" 统一缩进为4
set softtabstop=4
set shiftwidth=4
" 在行和段开始处使用制表符
set smarttab
" 显示行号
set number
" 历史记录数
set history=1000
"禁止生成临时文件
set nobackup
set noswapfile
"搜索忽略大小写
"set ignorecase
nnoremap <leader>ic :set ignorecase<cr>
nnoremap <leader>iic :set noignorecase<cr>
"搜索逐字符高亮
set hlsearch
set incsearch
"行内替换
set gdefault
"编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
set langmenu=zh_CN.UTF-8
set helplang=cn
" 我的状态行显示的内容(包括文件类型和解码)
"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
"set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
" 总是显示状态行
"set laststatus=2
" 命令行(在状态行下)的高度,默认为1,这里是2
set cmdheight=2
" 侦测文件类型
filetype on
" 载入文件类型插件
filetype plugin on
" 为特定文件类型载入相关缩进文件
filetype indent on
" 保存全局变量
set viminfo+=!
" 带有如下符号的单词不要被换行分割
""set iskeyword+=_,$,@,%,#,-
" 字符间插入的像素行数目
set linespace=0
" 增强模式中的命令行自动完成操作
set wildmenu
" 使回格键(backspace)正常处理indent, eol, start等
set backspace=2
" 允许backspace和光标键跨越行边界
set whichwrap+=<,>,h,l
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
set mouse=
set selection=exclusive
set selectmode=mouse,key
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=0
" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=1
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3
" 为C程序提供自动缩进
set smartindent
" 高亮显示普通txt文件(需要txt.vim脚本)
au BufRead,BufNewFile * setfiletype txt
" 搜索字符的颜色配置
hi Search term=reverse ctermbg=4 guibg=Yellow
hi Visual term=reverse ctermbg=2 guibg=LightGrey
"自动补全
"":inoremap ( ()<ESC>i
":inoremap ) <c-r>=ClosePair(‘)‘)<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair(‘}‘)<CR>
":inoremap [ []<ESC>i
":inoremap ] <c-r>=ClosePair(‘]‘)<CR>
":inoremap " ""<ESC>i
":inoremap ‘ ‘‘<ESC>i
function! ClosePair(char)
if getline(‘.‘)[col(‘.‘) - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
filetype plugin indent on
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
" leaderF configuration"
" don‘t show the help in normal mode
let g:Lf_HideHelp = 1
let g:Lf_UseCache = 0
let g:Lf_UseVersionControlTool = 0
let g:Lf_IgnoreCurrentBufferName = 1
" popup mode
""let g:Lf_WindowPosition = ‘popup‘
""let g:Lf_PreviewInPopup = 1
""let g:Lf_StlSeparator = { ‘left‘: "\ue0b0", ‘right‘: "\ue0b2", ‘font‘: "DejaVu Sans Mono for Powerline" }
""let g:Lf_PreviewResult = {‘Function‘: 0, ‘BufTag‘: 0 }
let g:Lf_ShortcutF = "<leader>ff"
let g:Lf_ShortcutF = ‘<C-P>‘
noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR>
noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
""noremap <C-B> :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR>
""noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
" search visually selected text literally
xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR>
noremap go :<C-U>Leaderf! rg --recall<CR>
" should use `Leaderf gtags --update` first
let g:Lf_GtagsAutoGenerate = 0
let g:Lf_Gtagslabel = ‘native-pygments‘
noremap <leader>fr :<C-U><C-R>=printf("Leaderf! gtags -r %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fd :<C-U><C-R>=printf("Leaderf! gtags -d %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fo :<C-U><C-R>=printf("Leaderf! gtags --recall %s", "")<CR><CR>
noremap <leader>fn :<C-U><C-R>=printf("Leaderf gtags --next %s", "")<CR><CR>
noremap <leader>fp :<C-U><C-R>=printf("Leaderf gtags --previous %s", "")<CR><CR>
" leaderF configuration end
" .vimrc open and source
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
inoremap jk <esc>
" make var definition tabular; the method is making the char after second spaces left/right aligned. space and char must appear once so that defined var will not be affected
nnoremap <leader>a= :Tabularize /^\s*[a-z1-9,.,\-,>,_]\+\s\+\zs\**[a-z1-9]/l1r0l0<cr>
nnoremap <leader>b= :Tabularize /\s=\s/l0l0l0<cr>
" statusline setting -----------------{{{
set statusline=
set statusline+=%1*\[%n] "buffernr
set statusline+=%2*\ %<%F\ "File+path
"set statusline+=%0*\ %=\ %{‘‘.(&fenc!=‘‘?&fenc:&enc).‘‘}\ "Encoding
"set statusline+=%4*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
set statusline+=%0*\ [format:%{&ff}]\ "FileFormat (dos/unix..)
set statusline+=%0*\ %=\ %6*row:%l/%L\ col:%03c\ (%03p%%)\ "Rownumber/total (%)
set statusline+=%0*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot.
"hi User2 ctermfg=3 ctermbg=0 "颜色的定义,对应上面的%2*
"hi User6 ctermfg=3 ctermbg=4 "颜色的定义,对应上面的%6*
set laststatus=2
hi User1 cterm=bold ctermfg=2 ctermbg=1
hi User2 cterm=bold ctermfg=2 ctermbg=2
hi User3 cterm=bold ctermfg=2 ctermbg=1
hi User4 cterm=bold ctermfg=2 ctermbg=1
hi User5 cterm=bold ctermfg=2 ctermbg=1
hi User6 cterm=bold ctermfg=3 ctermbg=4
" }}}
" taglist {{{
let Tlist_Auto_Open = 1 " 打开vim时,自动打开Taglist
let Tlist_Show_One_File=1 " 只显示当前文件的taglist
let Tlist_Exit_OnlyWindow = 1 " 当只剩下taglist窗口时,自动退出vim
"let Tlist_Use_Right_Window = 1 " taglist窗口的位置
"let Tlist_WinHeight = 100 " taglist窗口的高度
let Tlist_WinWidth = 30 " taglist窗口的宽度
noremap <F8> :Tlist<CR> " 打开aglist窗口的快捷键
" taglist }}}
" mark with color {{{
"g:mwDefaultHighlightingNum = ‘extended‘
" }}}
" vimwiki {{{
let g:vimwiki_list = [{‘path‘: ‘/media/D/mywiki/wiki‘,
\ ‘path_html‘: ‘/media/D/mywiki/html‘}]
" }}}
" set paste and set nopaste
nnoremap <leader>sp :set paste<cr>
nnoremap <leader>snn :set nopaste<cr>
标签:com getline 保存 sea -- idt status media 双击
原文地址:https://www.cnblogs.com/plumnut/p/14456309.html