2009-12-03 7 views
20
preguntas

Hay .vimrc relacionado que se encuentran here y here.configuración .vimrc minimalista favorita

Esta pregunta quiere tratar con un archivo .vimrc minimalista.

Si se encuentra en una nueva máquina con ningún archivo .vimrc ¿cuáles son algunas 'debe activar el' comandos que utiliza antes de hacer cualquier escribiendo?

+0

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

Respuesta

14

Nunca hay una necesidad de una configuración minimalista. Esto resuelve todo:

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

Mejor clonarlo, por lo si realiza cambios localmente, puede simplemente volver a asignarlos a github. – iconoclast

+8

Bueno, eso supone que git está instalado o que tengo permisos para instalarlo. La clonación es preferible, pero la solución anterior es universal. –

+0

usando git rep para la configuración del entorno es una gran idea y por eso acepté la respuesta. – Yada

1

syntax enable
set background=dark para xterms negro.
set autoindent cuando me voy a desarrollar.

1

Dado que estoy en máquinas nuevas mucho, he puesto mi .vimrc minimalista en mi página de inicio here. Así que no tengo que llevarlo en una memoria USB.

No sabe, si hay algo para ti en él o no.

René

+3

buena idea poner el .vimrc en un sitio web – Yada

2

Mucha .vimrc las ideas se puede encontrar here.

3

Esto se desvía un poco de la letra de la pregunta, pero es de esperar que dentro del espíritu. Lo primero que hago en una máquina nueva es set -o vi para obtener enlaces de teclas vi-style en la línea de comandos.

1

Mi vimrc vive en mi carpeta de Dropbox. Pero no es minimalista.

Si estoy haciendo algo muy simple (no vale la pena agarrar mi verdadero vimrc) Voy a hacer lo siguiente:

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

Aquí está mi configuración mínima con los comentarios:

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

No tenía idea sobre 'nobackup'. Ordenado. 'rm * ~' en lugar de 'rm * ~' es demasiado fácil de hacer ... –

+2

set backspace = eol, start, indent – JuanPablo

2

Éstos son algunos bien real debe tener comandos.

 " 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

Tantas líneas para elegir, pero los que no estarían fuera y se lo recomendaría a todos los 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> 
4

Mi 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 

encontré esto:

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

simplemente copiar las cosas que desea

Cuestiones relacionadas