最喜欢的minimalistic .vimrc配置

时间:2009-12-03 15:57:38

标签: vim

找到{。{3}}和here .vimrc相关问题。

这个问题想要处理简约的.vimrc文件。

如果您使用的是没有.vimrc文件的新机器,那么在进行任何打字之前,您需要使用哪些“必须打开”命令?

10 个答案:

答案 0 :(得分:25)

这是我的评论最小设置:

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 :(得分:14)

永远不需要简约配置。这解决了一切:

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

答案 2 :(得分:6)

我的配置:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => 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

只需复制你想要的东西

答案 3 :(得分:3)

这偏离了问题的字母,但希望在精神内。我在新机器上做的第一件事就是set -o vi在命令行上获得vi风格的键绑定。

答案 4 :(得分:3)

以下是一些真正有益的命令。

        " 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

答案 5 :(得分:3)

这么多行可供选择,但我不会没有,并强烈建议所有vimmers:

" 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>

答案 6 :(得分:2)

可以找到很多.vimrc的想法here

答案 7 :(得分:1)

syntax enable
set background=dark代表黑色xterms set autoindent当我要开发时。

答案 8 :(得分:1)

由于我经常使用新机器,所以我将简约的.vimrc放在我的主页上 here。所以我不必在USB记忆棒上随身携带它。

不知道,不管你有什么内容。

答案 9 :(得分:1)

我的vimrc存放在我的Dropbox文件夹中。但这不是简约。

如果我做的事情非常简单(不值得抓住我真正的vimrc),我会做以下事情:

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