2009-12-03 9 views
20

Es gibt .vimrc verwandte Fragen gefunden here und here.Favorit minimalistic .vimrc Konfiguration

Diese Frage möchte mit einer minimalistischen .vimrc-Datei umgehen.

Wenn Sie sich auf einer neuen Maschine ohne .vimrc-Datei befinden, welche Befehle müssen Sie aktivieren, bevor Sie tippen?

+0

wollen http://stackoverflow.com/questions/164847/what-is-in-your-vimrc –

Antwort

14

Es gibt nie eine Notwendigkeit für eine minimalistische Konfiguration. Dies löst alles:

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

besser zu klonen es zu setzen, so Wenn Sie Änderungen lokal vornehmen, können Sie sie einfach an github übergeben. – iconoclast

+8

Nun, das setzt voraus, dass git installiert ist oder ich die Berechtigung habe, es zu installieren. Klonen ist bevorzugt, aber die obige Lösung ist universell. –

+0

mit git rep für die Umgebung Einstellung ist eine großartige Idee, weshalb ich die Antwort akzeptiert. – Yada

1

syntax enable
set background=dark für schwarze xterms.
set autoindent wenn ich mich entwickeln werde.

1

Da ich viel auf neuen Maschinen bin, habe ich meine minimalistische .vimrc auf meiner Homepage here gesetzt. Ich muss es also nicht auf einem USB-Stick herumtragen.

Ich weiß nicht, ob da etwas für dich drin ist oder nicht.

Rene

+3

gute Idee, die .vimrc auf einer Website – Yada

2

Viele .vimrc Ideen können here finden.

3

Dies weicht ein wenig vom Buchstaben der Frage ab, ist aber hoffentlich im Geiste. Die allererste Sache, die ich auf einer neuen Maschine mache, ist set -o vi, um vi-style Tastenbindungen auf der Kommandozeile zu erhalten.

1

Mein vimrc lebt in meinem Dropbox-Ordner. Aber es ist nicht minimalistisch.

Wenn ich etwas wirklich einfach (nicht wert Grabbing meine wirkliche vimrc) tun werde ich folgendes tun:

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

Hier ist meine minimalen Einstellungen mit Kommentaren:

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

Ich hatte keine Ahnung von 'nobackup'. Ordentlich. 'rm * ~' statt 'rm * ~' ist zu einfach zu machen ... –

+2

set backspace = eol, start, indent – JuanPablo

2

Hier einige wirklich guten sind Befehle haben muss.

 " 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

So viele Linien aus, wählen, aber die, die ich würde nicht ohne sein und würde für alle vimmers sehr empfehlen:

" 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

Meine config:

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

gefunden dies:

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

kopieren Sie einfach Dinge, die Sie