最近大病一场,还是身体最重要啊!
几周没写文章了,实在是太懒了。今天把自己的vimrc贴出来,希望对大家有所启发。
我的vimrc也是在别人的基础上进行了自己的修改。对vimrc,是不能直接拷贝使用的,不然会有严重的不适。所以还是自己理解了之后,再形成自己的vimrc较好。
此vimrc是用在windows上的,如果在linux上使用,把MySys()的返回值改为"linux"。
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This vimrc is based on the vimrc by Amix, URL:
" http://www.amix.dk/vim/vimrc.html
" Maintainer: Easwy
" Version: 0.1
" Last Change: 31/05/07 09:17:57
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Get out of VI's compatible mode..
set nocompatible
" Platform
function! MySys()
return "windows"
endfunction
"Sets how many lines of history VIM har to remember
set history=400
" Chinese
if MySys() == "windows"
set encoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set fileencodings=ucs-bom,utf-8,gb18030,cp936,big5,euc-jp,euc-kr,latin1
endif
"Enable filetype plugin
filetype plugin on
filetype indent on
"Set to auto read when a file is changed from the outside
set autoread
"Have the mouse enabled all the time:
set mouse=a
"Set mapleader
let mapleader = ","
let g:mapleader = ","
"Fast saving
nmap <silent> <leader>ww :w<cr>
nmap <silent> <leader>wf :w!<cr>
"Fast quiting
nmap <silent> <leader>qw :wq<cr>
nmap <silent> <leader>qf :q!<cr>
nmap <silent> <leader>qq :q<cr>
nmap <silent> <leader>qa :qa<cr>
"Fast remove highlight search
nmap <silent> <leader><cr> :noh<cr>
"Fast redraw
nmap <silent> <leader>rr :redraw!<cr>
" Switch to buffer according to file name
function! SwitchToBuf(filename)
"let fullfn = substitute(a:filename, "^\\~/", $HOME . "/", "")
" find in current tab
let bufwinnr = bufwinnr(a:filename)
if bufwinnr != -1
exec bufwinnr . "wincmd w"
return
else
" find in each tab
tabfirst
let tab = 1
while tab <= tabpagenr("$")
let bufwinnr = bufwinnr(a:filename)
if bufwinnr != -1
exec "normal " . tab . "gt"
exec bufwinnr . "wincmd w"
return
endif
tabnext
let tab = tab + 1
endwhile
" not exist, new tab
exec "tabnew " . a:filename
endif
endfunction
"Fast edit vimrc
if MySys() == 'linux'
"Fast reloading of the .vimrc
map <silent> <leader>ss :source ~/.vimrc<cr>
"Fast editing of .vimrc
map <silent> <leader>ee :call SwitchToBuf("~/.vimrc")<cr>
"When .vimrc is edited, reload it
autocmd! bufwritepost .vimrc source ~/.vimrc
elseif MySys() == 'windows'
" Set helplang
set helplang=cn
"Fast reloading of the _vimrc
map <silent> <leader>ss :source ~/_vimrc<cr>
"Fast editing of _vimrc
map <silent> <leader>ee :call SwitchToBuf("~/_vimrc")<cr>
"When _vimrc is edited, reload it
autocmd! bufwritepost _vimrc source ~/_vimrc
endif
" For windows version
if MySys() == 'windows'
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function! MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set font
"if MySys() == "linux"
" set gfn=Monospace\ 11
"endif
" Avoid clearing hilight definition in plugins
if !exists("g:vimrc_loaded")
"Enable syntax hl
syntax enable
" color scheme
if has("gui_running")
set guioptions-=T
set guioptions-=m
set guioptions-=L
set guioptions-=r
colorscheme darkblue_my
"hi normal guibg=#294d4a
else
colorscheme desert_my
endif " has
endif " exists(...)
"Some nice mapping to switch syntax (useful if one mixes different languages in one file)
map <leader>$ :syntax sync fromstart<cr>
autocmd BufEnter * :syntax sync fromstart
"Highlight current
"if has("gui_running")
" set cursorline
" hi cursorline guibg=#333333
" hi CursorColumn guibg=#333333
"endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fileformats
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Favorite filetypes
set ffs=unix,dos
nmap <leader>fd :se ff=dos<cr>
nmap <leader>fu :se ff=unix<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM userinterface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors - when moving vertical..
"set so=7
" Maximum window when GUI running
if has("gui_running")
set lines=9999
set columns=9999
endif
"Turn on WiLd menu
set wildmenu
"Always show current position
set ruler
"The commandbar is 2 high
set cmdheight=2
"Show line number
set nu
"Do not redraw, when running macros.. lazyredraw
set lz
"Change buffer - without saving
"set hid
"Set backspace
set backspace=eol,start,indent
"Bbackspace and cursor keys wrap to
"set whichwrap+=<,>,h,l
set whichwrap+=<,>
"Ignore case when searching
"set ignorecase
"Include search
set incsearch
"Highlight search things
set hlsearch
"Set magic on
set magic
"No sound on errors.
set noerrorbells
set novisualbell
set t_vb=
"show matching bracets
"set showmatch
"How many tenths of a second to blink
"set mat=2
""""""""""""""""""""""""""""""
" Statusline
""""""""""""""""""""""""""""""
"Always hide the statusline
set laststatus=2
function! CurDir()
let curdir = substitute(getcwd(), '/home/easwy/', "~/", "g")
return curdir
endfunction
"Format the statusline
"set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c
</
分享到:
相关推荐
Powerline 是一个非常流行的增强型状态栏插件,它为 Vim、Emacs 和其他软件提供了一个美观、信息丰富的状态指示器。这个特定的版本是 `vim-powerline` 的开发分支,可能包含了最新的功能和改进,适用于开发者或者...
Vim插件是由社区开发的一系列扩展,它们提供了各种增强功能,如代码补全、语法高亮、文件浏览器等。通过安装合适的插件,您可以提高编程效率,减少重复劳动。 安装Vim插件的第一步是确保您的系统已经安装了Vim。在...
首先,"fatih/vim-go-tutorial"是由知名开发者fatih维护的一个开源项目,其目标是提供一个详细的教程,指导用户如何设置和使用vim-go。该项目包含在"vim-go-tutorial-master"这个压缩包中,解压后可以看到完整的教程...
在IT行业中,VIM(Vi IMproved)是一款广泛使用的强大文本编辑器,尤其受到程序员的青睐。本篇文章将深入探讨如何使用VIM作为开发Flex应用的基础环境设置。Flex是一种基于ActionScript和MXML的开放源代码框架,用于...
《vim-handbook-cn-71》是一份详细的Vim中文手册,专为想要深入理解和高效使用Vim编辑器的用户而设计。这份手册涵盖了Vim的基础操作、高级特性以及一些实用技巧,对于在Linux环境中工作的开发者尤其有帮助。Vim,...
"我的vim附带vimrc"这个标题表明这是一个包含作者个人定制的Vim配置文件(vimrc)的压缩包,用于优化和个性化Vim的使用体验,使其更适合C、C++和Python等编程语言的开发。 Vimrc是Vim的初始化脚本,它允许用户...
总的来说,开源项目Vim 8.0不仅是一个功能强大的文本编辑器,更是一个具有高度可扩展性和定制性的开发工具。它的异步I/O、多窗口支持、增强的Unicode处理和改进的插件系统等特性,使得Vim成为了许多程序员的首选。...
`vim-go`是Vim编辑器中一个强大的Go语言开发插件,由fatih维护。它为Vim提供了丰富的功能,旨在提升Go程序员的开发效率和代码质量。这个插件包含了调试、语法高亮、自动补全、代码跳转、格式化、重构等多个方面的...
5. 安装NERDTree:NERDTree是一个文件浏览器插件,便于在Vim中查看和管理项目文件。 6. 添加行号:在`.vimrc`中添加`set number`显示行号。 7. 集成Git:通过安装fugitive.vim,可以在Vim内进行Git操作。 8. 调整...
开源项目 Fatih Vim-Go 正是这样一款专为 Go 语言开发者量身定制的 Vim 插件,它将古老的、强大的文本编辑器 Vim 与现代的编程语言 Go 结合起来,为程序员提供了无与伦比的开发体验。下面我们将详细探讨 Vim-Go 的...
1、vimrc 放到vim 目录下 2、vimfiles 新建bundle目录 3、下载插件(https://github.com/gmarik/vundle)将vundle整个目录丢进bundle目录 4、下面见证奇迹的时刻到了 命令行输入:BundleInstall 回车 哦了 此配置...
Vim是一款强大的文本编辑器,深受程序员和系统...综上所述,`vimrc`文件和Vim的配色方案是提升Vim使用体验的关键。通过调整`vimrc`配置和选择合适的配色方案,每个用户都可以打造一个既高效又舒适的个人化开发环境。
在处理Lua编程语言时,使用特定的Vim插件和配置可以提升开发效率和代码质量。本篇文章将详细探讨“vim编辑lua所用插件与vimrc”这一主题。 首先,我们来了解Vimrc,它是Vim的配置文件,用于定制个人的编辑环境。...
"Python库"标签说明vim-vint是一个Python开发的软件模块,可以被其他Python程序导入和使用。Python库通常包含函数、类和其他可重用的代码片段,它们提供了特定的功能或服务,如数据处理、网络通信、图形用户界面等。...
`vim-pathogen`是Vim编辑器中一个非常著名的插件管理工具,由Toby Hedegeous开发。它的主要作用是简化Vim插件的安装、管理和更新过程,使得用户能够更方便地定制自己的Vim环境。在本文中,我们将深入探讨`vim-...
### vim配置大全解析 在深度剖析给定的`vim`配置片段之前,我们先来了解一下`vim`(Vi ...对于日常开发工作而言,一份精心设计的`vimrc`配置文件能够显著提升编码速度与质量,是每位程序员不可或缺的利器之一。
这个压缩包“vim-plug, 我的vim插件,基于vim-plug安装.zip”包含了Vim-plug的源代码,这将帮助你了解如何在你的Vim环境中安装和使用它。 首先,让我们了解一下Vim。Vim(Vi IMproved)是一款强大的文本编辑器,...