vim tips

.vimrc

流浪 posted @ 2008年5月05日 06:02 in Vim tips , 5898 阅读

 

"进入用户目录
cd ~/.
"
支持中文
let &termencoding=&encoding
set fileencodings=utf-8,gbk,cp936,big5

"颜色主题
"
colorscheme chela_light
colorscheme two2tango

"字体设置
"
set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
"set guifont=Monaco
set guifont=Courier_New

"
支持鼠标
set mouse=a
"设置文件浏览器目录为当前目录
set bsdir=buffer
set autochdir

"
状态栏属性值一直存在
set laststatus=2

"show time in status
set statusline=%<%t%*\ %y\ %2*%r%m%*\ %l,%c\ %=%{strftime('%m/%d/%y-%H:%M')}\ \ %l/%L\ (%p%%)%*L

"
the new window show bottle
set sb

"the new window show right
set spr

"
退格键可以删除光标之前的字符
set backspace=indent,eol,start

"show line number
set number

"
关闭工具条
set guioptions-=T

"关闭菜单栏
"
set guioptions-=m

"打开状态栏标尺
set ru

"
搜索时高亮显示
syntax on

"自动缩进时缩进为四个字符
set sw=4

"
Tabp宽度为4个字符
set ts=4

"编辑时将所有TAB换成空格
set et
set smarttab  "
在上面的情况下一次可以删除四个空格
"
"
不在单词中间断行
set lbr

"允许在两个汉字之间断行
set fo+=mB

"
GVIM启动最大化
"au GUIEnter * simalt ~x

"
不产生备份文件
set nobackup

"不要响铃
set vb t_vb=

"
粘贴时保留原有格式
set paste

"优先使用中文文档
        if version >= 603
                set helplang=cn
        endif

"
关闭插入时跳来跳去的括号匹配
set nosm

"目录浏览 (这个有问题,会对vim下面提示造成影响)
"
set nocp

"允许使用插件
filetype plugin indent on

"
闭关开启画面
set shortmess+=I

"if has("gvim")
"
    colorscheme two2tango
"else
"
    colorscheme tango
"endif

"
colorscheme two2tango
"高亮配置当前行
"
    set cursorline
"    hi cursorline guibg=black


"
允许光标在句子之间的移动
set whichwrap=b,s,<,>      "普通模式有效
set whichwrap=b,s,<,>,[,]  "
插入模式有效

"查找高亮显示
set hls
set is

"
"python编程相关
"
"if has("autocmd")
"
"
"
"  " 自动检测文件类型并加载相应的设置
""  filetype plugin indent on
""
""  " Python 文件的一般设置,比如不要 tab 等
"
"  autocmd FileType python setlocal et | setlocal sta | setlocal sw=4
"
"
"
"  " Python Unittest 的一些设置
""  " 可以让我们在编写 Python 代码及 unittest 测试时不需要离开 vim
"
"  " 键入 :make 或者点击 gvim 工具条上的 make 按钮就自动执行测试用例
""  autocmd FileType python compiler pyunit
""    autocmd FileType python setlocal makeprg=python
""  "autocmd FileType python setlocal makeprg=python\ alltests.py
"
"  "autocmd BufNewFile,BufRead test*.py setlocal makeprg=python\ %
""
""  "" 自动使用新文件模板
""  "autocmd BufNewFile test*.py 0r ~/.vim/skeleton/test.py
"
"  "autocmd BufNewFile alltests.py 0r ~/.vim/skeleton/alltests.py
""  "autocmd BufNewFile *.py 0r ~/.vim/skeleton/skeleton.py
"
"
"
"endif
"

""调用python来编译当前py文件
""set makeprg=python\ %<.py
""set makeprg=deplate -m zh-cn -t bright.html -f html --css bright -d ~/publish/viki\ %<.viki
"
"
输入字符时隐藏鼠标指针
set mousehide

"在normal模式下先后按下,s重新加载.vimrc配置文件
nmap ,s :source ~/.vimrc<cr>

"
"config viki
"
let g:vikiNameSuffix=".viki"
"augr viki
"
au!
"autocmd! BufRead,BufNewFile *.viki set filetype=viki
"
augr END
"
"
set nocompatible

"在键盘大写开的情况下以下命令仍有用
command! Q  quit
command! W  write
command! Wq wq

"
avoid the "Hit ENTER to contunue" prompt
set shortmess=a

"增加命令行高度为2
"
set cmdheight=2

"光标移动时识别物理上的一行。
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk

"
设置工作目录为当前目录
function! CHANGE_CURR_DIR()
        let _dir = expand("%:p:h")
        exec "cd " . _dir
        unlet _dir
endfunction

autocmd BufEnter * call CHANGE_CURR_DIR()

"编辑html时标签设为小写
let g:html_tag_case = "
lowercase"

"
搜索时忽略大小写
set ignorecase
"区分大小写
"
set noignorecase

"编写html的相关设置closetag.vim
au Filetype html,xml,xsl source ~/.vim/plugin/closetag.vim
"
set makeprg=firefox\ %<.html
"map <F10> :make<cr>
"
gvim着色设置

"about perl program
set makeprg=perl
map <F10> :make %<cr>
"
用<F9>保存并更新当前文件
map <F9> <ESC>:w<cr>:e %<cr>
"用<F4>来取代:noh
map <F4> :noh<cr>
"
用<F5>来取代:hide
map <F5> :hide<cr>
"给TAB加上编号,可以用ALT+O~1切换到相应的tab
map <M-1> 1gt
map <M-2> 2gt
map <M-3> 3gt
map <M-4> 4gt

 

Avatar_small
Bihar Board Question 说:
2022年9月14日 16:16

Bihar School Examination, Patna Board and various private school teaching staff of the state have designed and suggested the Secondary Education Class 8th Standard study & learning material as Bihar Board 8th Class Model Paper 2023 with Mock Test and Practice Questions for Paper-1 & Papert-2 Exams held under Term1 & Term2 of the Course through BSEB STD-8 Model Set 2023 to Theory, Objective (MCQ) and Bit Questions. Bihar Board Question Paper Class 8 Every Secondary Education Student who studying their High School Level Class 8th Standard in BSEB Government or Private schools can download the BSEB 8th Class Question Paper 2023.

Avatar_small
snake game 说:
2022年11月21日 17:20

Your article is very useful, the content is great

Avatar_small
drift boss 说:
2022年12月13日 18:20

I sincerely appreciate you sharing this fantastic article. You worked really hard to provide us with engaging content. I've learned so much by reading this post.

Avatar_small
moto x3m 说:
2024年10月02日 17:15

The command 进入用户目录 translates to "Enter the user directory," which is an essential step in navigating a system's file structure. Using cd ~/ allows users to quickly access their home directory, streamlining the workflow, especially in environments like Linux or macOS.

Avatar_small
Papa's Pizzeria 说:
2024年11月06日 14:03

This post is really engaging! The content is well-written and kept me hooked from start to finish. It offers a great perspective and is thoughtfully written.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter