2009-12-03 89 views
20

還有.vimrc相關的問題發現herehere最喜歡的簡約.vimrc配置

這個問題想要處理一個簡約的.vimrc文件。

如果您使用的是沒有.vimrc文件的新機器,請在打字之前使用一些「必須打開」的命令?

+0

http://stackoverflow.com/questions/164847/what-is-in-your-vimrc – 2014-08-19 09:54:41

回答

14

從未有一個需要一個簡約的配置。這解決了一切:

wget -O ~/.vimrc http://github.com/lucasoman/Conf/raw/master/.vimrc 
+3

更好的克隆它,所以如果您在本地進行更改,則可以將它們提交回github。 – iconoclast 2010-05-16 02:23:21

+8

那麼,假設git已安裝或我有權安裝它。克隆是優選的,但上述解決方案是通用的。 – 2010-05-25 17:48:34

+0

使用git代表環境設置是一個好主意,這就是我接受答案的原因。 – Yada 2014-09-09 13:06:59

1

syntax enable
set background=dark for black xterms。
set autoindent當我要開發。

1

由於我在新機器上很多,我已將我的簡約.vimrc放在我的主頁 here。所以我不必在U盤上隨身攜帶。

不知道,如果有什麼你在裏面或沒有。

劉若英

+3

好主意,把.vimrc裏一個網站 – Yada 2009-12-03 16:34:31

2

很多的.vimrc思路可以發現here

3

這偏離了問題的信件,但希望在精神之內。我在新機器上做的第一件事是set -o vi在命令行上獲得vi風格的鍵綁定。

1

我的vimrc存在於我的保管箱文件夾中。但它不是簡約。

如果我做的事情很簡單(不值得抓住我的真正的vimrc)我會做到以下幾點:

:set nocompatible 
:set number 
:set showmatch 
:map! <F3> <Esc> 
23

這裏是我最小的設置與評論:

set backspace=2   " backspace in insert mode works like normal editor 
syntax on    " syntax highlighting 
filetype indent on  " activates indenting for files 
set autoindent   " auto indenting 
set number    " line numbers 
colorscheme desert  " colorscheme desert 
set nobackup   " get rid of anoying ~file 
+1

我不知道'nobackup'。整齊。 'rm *〜'而不是'rm *〜'太容易了...... – 2010-03-18 00:19:17

+2

set backspace = eol,start,indent – JuanPablo 2011-10-30 06:27:34

2

這裏有一些真正的好必須的命令。

 " do not make vim compatible with vi. 
    set nocompatible 

     " number the lines. 
    set number 

     " show location of cursor using a horizontal line. 
    set cursorline 

     " keep cursor in the middle of the screen while scrolling up and down. 
    set scrolloff=999 

    " show auto complete menus. 
    set wildmenu 

    " Make wildmenu behave like bash completion. Finding commands are so easy now. 
    set wildmode=list:longest 

    " run the Bash script by pressing F6 without leaving VIM. 
    map <f6> :w <CR>:!bash % <CR> 

    " turn on syntax hightlighting. 
    set syntax=on 
2

所以很多線路可供選擇,但我不會是那些沒有和強烈建議所有的Vimmer:

" remap jj to escape in insert mode 
inoremap jj <Esc> 

" swapping : and ; save a lot of unneeded shifting: 
noremap ; : 
noremap : ; 

" The wish that grants more wishes (edit vimrc with \ev) 
nnoremap <Leader>ev :tabnew<CR>:e ~/.vimrc<CR> 
4

我的配置:

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" => General 
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" Sets how many lines of history VIM has to remember 
set history=700 

" Enable filetype plugins 
filetype plugin on 
filetype indent on 

" Set to auto read when a file is changed from the outside 
set autoread 


"Always show current position 
set ruler 

" Ignore case when searching 
set ignorecase 

" When searching try to be smart about cases 
set smartcase 

" Highlight search results 
set hlsearch 

" Show matching brackets when text indicator is over them 
set showmatch 


syntax enable 


colorscheme desert 
set background=dark 

" Set extra options when running in GUI mode 
if has("gui_running") 
    set guioptions-=T 
    set guioptions+=e 
    set t_Co=256 
    set guitablabel=%M\ %t 
endif 

" Set utf8 as standard encoding and en_US as the standard language 
set encoding=utf8 

" Use Unix as the standard file type 
set ffs=unix,dos,mac 

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" => Files, backups and undo 
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" Turn backup off, since most stuff is in SVN, git et.c anyway... 
set nobackup 
set nowb 
set noswapfile 


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" => Text, tab and indent related 
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" Use spaces instead of tabs 
set expandtab 

" Be smart when using tabs ;) 
set smarttab 

" 1 tab == 4 spaces 
set shiftwidth=4 
set tabstop=4 

" Linebreak on 500 characters 
set lbr 
set tw=500 

set ai "Auto indent 
set si "Smart indent 
set wrap "Wrap lines 


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" => Moving around, tabs, windows and buffers 
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
" Treat long lines as break lines (useful when moving around in them) 
map j gj 
map k gk 



"""""""""""""""""""""""""""""" 
" => Status line 
"""""""""""""""""""""""""""""" 
" Always show the status line 
set laststatus=2 

" Format the status line 
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l 

我發現這個:

http://amix.dk/vim/vimrc.html

只是複製你想要的東西