加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

【好用的.vimrc】支持vim语法高亮,保留上一次编辑内容,记住位

发布时间:2020-12-15 16:58:32 所属栏目:安全 来源:网络整理
导读:以下内容,保存到 ~/.vimrc 文件即可,以作备份。 "ctagsset tags=tags;/ set wrapscan "启用循环查找方式set guifont=Monaco:h10 " 字体 字号set expandtab " 设置tab键换空格set tabstop=4 " 设置tab键的宽度set shiftwidth=4 " 换行时行间交错使用4个空格

以下内容,保存到 ~/.vimrc 文件即可,以作备份。

"ctags
set tags=tags;/
 
set wrapscan                "启用循环查找方式
set guifont=Monaco:h10       " 字体 && 字号
set expandtab                " 设置tab键换空格
set tabstop=4                " 设置tab键的宽度
set shiftwidth=4             " 换行时行间交错使用4个空格
set autoindent               " 自动对齐
set backspace=2              " 设置退格键可用
set cindent shiftwidth=4     " 自动缩进4空格
set smartindent              " 智能自动缩进
set ai!                      " 设置自动缩进
"set nu!                      " 显示行号
"set showmatch               " 显示括号配对情况
"set mouse=a                  " 启用鼠标
"set ruler                    " 右下角显示光标位置的状态行
set incsearch                " 查找book时,当输入/b时会自动找到
set hlsearch                 " 开启高亮显示结果
set incsearch                " 开启实时搜索功能
set nowrapscan               " 搜索到文件两端时不重新搜索
set nocompatible             " 关闭兼容模式
set vb t_vb=                 " 关闭提示音
"set cursorline              " 突出显示当前行
set hidden                   " 允许在有未保存的修改时切换缓冲区
 
 
syntax enable                " 打开语法高亮
syntax on                    " 开启文件类型侦测
filetype indent on           " 针对不同的文件类型采用不同的缩进格式
filetype plugin on           " 针对不同的文件类型加载对应的插件
filetype plugin indent on    " 启用自动补全
 
set writebackup              " 设置无备份文件
set nobackup
"set autochdir                " 设定文件浏览器目录为当前目录
"set nowrap                  " 设置不自动换行
"set foldmethod=syntax        " 选择代码折叠类型
"set foldlevel=100            " 禁止自动折叠
 
set laststatus=2             " 开启状态栏信息
set cmdheight=2              " 命令行的高度,默认为1,这里设为2
 
" 每行超过80个的字符用下划线标示
au BufRead,BufNewFile *.asm,*.c,*.cpp,*.java,*.cs,*.sh,*.lua,*.pl,*.pm,*.py,*.rb,*.erb,*.hs,*.vim 2match Underlined /.%81v/
 
 
" 设置编码
set fenc=utf-8
set encoding=utf-8
set fileencodings=utf-8,gbk,cp936,latin-1
" 解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 解决consle输出乱码
language messages zh_CN.utf-8
 
 
" For Haskell
:let hs_highlight_delimiters=1            " 高亮定界符
:let hs_highlight_boolean=1               " 把True和False识别为关键字
:let hs_highlight_types=1                 " 把基本类型的名字识别为关键字
:let hs_highlight_more_types=1            " 把更多常用类型识别为关键字
:let hs_highlight_debug=1                 " 高亮调试函数的名字
:let hs_allow_hash_operator=1             " 阻止把#高亮为错误
 
"只有在是PHP文件时,才启用PHP补全
au FileType php call AddPHPFuncList()
function AddPHPFuncList()
    set dictionary-=/home/feiyan/tools/vim/funclist.txt dictionary+=/home/feiyan/tools/vim/funclist.txt
    set complete-=k complete+=k
endfunction

" ======= 恢复上次文件打开位置 ======= "  
set viminfo='10,"100,:20,%,n~/.viminfo
au BufReadPost * if line("'"") > 0|if line("'"") <= line("$")|exe("norm'"")|else|exe "norm $"|endif|endif

set t_ti= t_te=
set hlsearch
if has("autocmd")
    au BufReadPost * if line("'"") > 1 && line("'"") <= line("$") | exe "normal! g'"" | endif
endif

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读