ONE_VimRC_FROM_MY_LINUX





set foldmethod=syntax 
"启动时不要自动折叠代码 
set foldlevel=100 
"依标记折叠 
set foldmethod=marker 
 
"显示行号 
set number 
 
"打开光标的行列位置显示功能 
"set ruler 
 
"显示中文引号 
set ambiwidth=double 
 
"行高亮 
"set cursorline 
"列高亮,与函数列表有冲突 
"set cursorcolumn 
 
"设置命令行的高度 
set cmdheight=2 
 
"高亮搜索的关键字 
set hlsearch 
 
"搜索忽略大小写 
set ignorecase 
 
"设置命令历史行数 
set history=100 
 
"不要闪烁 
"set novisualbell 
 
"显示TAB健 
set list 
set listchars=tab:>-,trail:- 
 
"高亮字符,让其不受100列限制 
":highlight OverLength ctermbg=red ctermfg=white guibg=grey guifg=white 
":match OverLength '\%101v.*' 


:filetype plugin on
:helptags $HOME/.vim/doc/




""""""""""""""""""""""""""""""
   " cscope
""""""""""""""""""""""""""""""


   if has("cscope")
              set csprg=/usr/bin/cscope
              set csto=0
              set cst
              set nocsverb
              " add any database in current directory
              if filereadable("cscope.out")
                  cs add cscope.out
              " else add database pointed to by environment
              elseif $CSCOPE_DB != ""
                  cs add $CSCOPE_DB
              endif
              set csverb
   endif


        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>


        " Using 'CTRL-spacebar' then a search type makes the vim window
        " split horizontally, with search result displayed in
        " the new window.


        nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
        nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
        nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>


        " Hitting CTRL-space *twice* before the search type does a vertical
        " split instead of a horizontal one


        nmap <C-Space><C-Space>s
                \:vert scs find s <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space><C-Space>g
                \:vert scs find g <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space><C-Space>c
                \:vert scs find c <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space><C-Space>t
                \:vert scs find t <C-R>=expand("<rrrrcword>")<CR><CR>
        nmap <C-Space><C-Space>e
                \:vert scs find e <C-R>=expand("<cword>")<CR><CR>
        nmap <C-Space><C-Space>i
                \:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
        nmap <C-Space><C-Space>d
                \:vert scs find d <C-R>=expand("<cword>")<CR><CR>






""""""""""""""""""""""""""""""
" lookupfile setting
""""""""""""""""""""""""""""""
    " 指定英文逗号作为<leader>键
      let mapleader=","


let g:LookupFile_TagExpr = '"filenametags"'


let g:LookupFile_MinPatLength = 2               "最少输入2个字符才开始查找
let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串
let g:LookupFile_PreservePatternHistory = 1     "保存查找历史
let g:LookupFile_AlwaysAcceptFirst = 1          "回车打开第一个匹配项目
let g:LookupFile_AllowNewFiles = 0              "不允许创建不存在的文件
if filereadable("./filenametags")                "设置tag文件的名字
   let g:LookupFile_TagExpr = '"./filenametags"'
endif
nmap <silent> <leader>lk <Plug>LookupFile<cr>   "映射LookupFile为,lk
nmap <silent> <leader>ll :LUBufs<cr>            "映射LUBufs为,ll
nmap <silent> <leader>lw :LUWalk<cr>            "映射LUWalk为,lw


     
    " 在指定目录生成filenametags,并使lookupfile将这个文件作为查找源
    function SetRootOfTheProject(path)
        " 进入指定目录
       exe 'cd '.a:path
       " 生成文件标签
        exe '!genfiletags'
        " 获取标签文件的路径
       let tagFilePath = genutils#CleanupFileName(a:path.'/filenametags')
       " 设置LookupFile插件的全局变量,使之以上面生成的标签文件作为查找源
        exe "let g:LookupFile_TagExpr='\"".tagFilePath."\"'"
    endfunction




    " 设置当前位置为工程的根目录
    function SetHereTheRoot()
        call SetRootOfTheProject('.')
    endfunction
    nmap <leader>root :call SetHereTheRoot()<CR>




    " 从用户的输入获取指定路径,并设置为工程的根目录
    function SetSpecifiedPathTheRoot()
        call SetRootOfTheProject(input('请输入工程根目录的路径:'))
    endfunction


    nmap <leader>xroot :call SetSpecifiedPathTheRoot()<CR>
     




" lookup file with ignore case
function! LookupFile_IgnoreCaseFunc(pattern)
   let _tags = &tags
   try
let &tags = eval(g:LookupFile_TagExpr)
let newpattern = '\c' . a:pattern
let tags = taglist(newpattern)
   catch
echohl ErrorMsg | echo "Exception: " . v:exception | echohl NONE
return ""
   finally
let &tags = _tags
   endtry
   " Show the matches for what is typed so far.
   let files = map(tags, 'v:val["filename"]')
   return files
endfunction
let g:LookupFile_LookupFunc = 'LookupFile_IgnoreCaseFunc'




    " 使用LookupFile打开文件
    nmap <leader>o :LookupFile<CR> 




""""""""""""""""""""""""""""""
"NERD File setting
""""""""""""""""""""""""""""""
  let g:NERDTree_title="[NERDTree]"


function! NERDTree_Start()
exec 'NERDTree'
endfunction


function! NERDTree_IsValid()
return 1
endfunction


let g:netrw_winsize=30
nmap <silent> <leader>fe :Sexplore!<cr>


""""""""""""""""""""""""""""""
   " Tag list (ctags)
""""""""""""""""""""""""""""""


   let Tlist_Ctags_Cmd = '/usr/bin/ctags'
   "let Tlist_Show_One_File = 1        "不同时显示多个文件的tag,只显示当前文件的
   let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vim
   let Tlist_Use_Left_Window = 1         "在右侧窗口中显示taglist窗口
"让当前不被编辑的文件的方法列表自动折叠起来 
 
   let Tlist_File_Fold_Auto_Close=1
"把taglist窗口放在屏幕的右侧,缺省在左侧 


   "let Tlist_Show_Menu = 1
   "let Tlist_Auto_Open = 1
""""""""""""""""""""""""""""""
  :set tags=./tags
""""""""""""""""""""""""""""""






   let g:winManagerWindowLayout='NERDTree|BufExplorer|FileExplorer'
   let g:AutoOpenWinManager = 1
"   let g:winManagerWindowLayout='NERDTree|BufExplorer|FileExplorer'
   nmap <silent> wm :WMToggle<cr>:TlistToggle<cr>
   "nmap wm :WMToggle<cr>


   



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
根据引用,在CSDN博客上有一篇文章提供了一个接地气版的Linux .vimrc配置文件,可以直接使用,你可以参考这篇文章了解更多相关说明。同时根据引用,.vimrc文件是用来配置vim编辑器功能开关的配置文件,分为系统配置和用户配置两种。系统配置文件存放在vim的安装路径内,而用户配置文件.vimrc则由用户自己创建,存放在用户根目录下。根据引用,用户配置文件.vimrc中的配置内容可以根据个人需求进行设置,如颜色主题、语法高亮、自动缩进等。如果你想在Linux上配置vimrc,你可以参考CSDN博客中的这篇文章。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【vimrc_linux】](https://download.csdn.net/download/neptuneys/11239215)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [04 .vimrc文件配置](https://blog.csdn.net/qq_43244515/article/details/124779889)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值