1
0
mirror of https://github.com/amix/vimrc synced 2025-07-04 06:44:59 +08:00

Mac -> master (#1)

* se elimina la instalación básica
* traducción y modificación de README.md
* traducción y modificación de basic.vim
This commit is contained in:
Facundo Laffont
2016-09-03 20:31:57 -03:00
committed by GitHub
parent 183ca1cfc5
commit 690a8e40ce
4 changed files with 139 additions and 408 deletions

View File

@ -1,28 +1,9 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
" Mantenimiento:
" Facundo Laffont
" facundolaffont@gmail.com
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
"
" Syntax_highlighted:
" http://amix.dk/vim/vimrc.html
"
" Raw_version:
" http://amix.dk/vim/vimrc.txt
"
" Sections:
" Secciones:
" -> General
" -> VIM user interface
" -> Colors and Fonts
@ -41,131 +22,121 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
" => general
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
" Cuántas líneas de historia debe recordar Vim
set history=500
" Enable filetype plugins
" Habilita la carga de archivos de plugins/indent según el tipo de archivo que se está utilizando
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
" Cuando el archivo es modificado desde afuera de Vim, se vuelve a cargar
set autoread
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
" Se va a utilizar el mapleader para generar combinaciones de tecla extra
let mapleader = ","
let g:mapleader = ","
" Fast saving
" guardado rápido
nmap <leader>w :w!<cr>
" :W sudo saves the file
" (useful for handling the permission-denied error)
" <?>
" :W sudo saves the file (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
" => interfaz de usuario de Vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Avoid garbled characters in Chinese language windows OS
let $LANG='en'
set langmenu=en
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" deja un espacio de 5 líneas entre el curso y el borde superior o inferior
set so=5
" Turn on the WiLd menu
" activa el menú Wild
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=.git\*,.hg\*,.svn\*
else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif
" ignora los archivos de compilación (útil para git)
set wildignore=*.o,*~,*.pyc,*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
"Always show current position
" siempre muestra la posición del cursor
set ruler
" Height of the command bar
" altura de la línea de comandos
set cmdheight=2
" <?>
" A buffer becomes hidden when it is abandoned
set hid
" Configure backspace so it acts as it should act
" configura backspace, los comandos h y l, y los movimientos con las flechas para que el cursor
" responda como normalmente lo hace fuera de Vim, cuando se está al principio o final de la línea
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
" ignora la sensibilidad de las mayúsculas cuando se está buscando
set ignorecase
" When searching try to be smart about cases
" realiza búsquedas inteligentes en cuanto a la sensibilidad de las mayúsculas
set smartcase
" Highlight search results
" resalta los resultados de las búsquedas
set hlsearch
" Makes search act like search in modern browsers
" hace que la búsqueda actúe como en los navegadores web modernos
set incsearch
" Don't redraw while executing macros (good performance config)
" no redibuja cuando se ejecutan macros (buena performance)
set lazyredraw
" For regular expressions turn magic on
" activa magic para las expresiones regulares
set magic
" Show matching brackets when text indicator is over them
" muestra el paréntesis opuesto cuando el cursor está sobre uno
set showmatch
" How many tenths of a second to blink when matching brackets
" cuántas decenas de segundos tarda en parpadear el cursor cuando se indica el paréntesis opuesto
set mat=2
" No annoying sound on errors
" quita el sonido y el flash en los errores
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Add a bit extra margin to the left
" agrega un poco de margen a la izquierda
set foldcolumn=1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
" => colores y fuentes tipográficas
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
" habilita el resaltado según sintaxis
syntax enable
" intenta utilizar el esquema de color desert
try
colorscheme desert
catch
endtry
" si el color de fondo es un color oscuro, Vim utiliza colores que contrasten mejor con ese tipo de
" color de fondo
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
" establece utf8 como la codificación estándar
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" utiliza Unix como tipo de archivo estándar
set ffs=unix,mac,dos
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
" => archivos, back-ups y deshacer
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
@ -173,122 +144,120 @@ set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
" => texto, tabulación e indentación
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
" usa espacios en vez de tabulación
set expandtab
" Be smart when using tabs ;)
" usa las tabulaciones de manera inteligente
set smarttab
" 1 tab == 4 spaces
" 1 tabulación == 4 espacios
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
" el quiebre de línea se realiza a los 100 caracteres
set lbr
set tw=500
set tw=100
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" establece autoindentación, indentación inteligente y quiebre de líneas
set ai
set si
set wrap
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => relacionado con el modo visual
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" en modo Visual, presionando * o ¿, busca la selección actual
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
vnoremap <silent> ¿ :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
" => sobre movimiento, pestañas, ventanas y buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
" mapeos de búsqueda
map <space> /
map <c-space> ?
" <¿>no funciona<?>
map <C-Space> ?
" Disable highlight when <leader><cr> is pressed
" deshabilita el resaltado de las búsquedas
map <silent> <leader><cr> :noh<cr>
" Smart way to move between windows
" movimiento entre ventanas
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Close the current buffer
" cierra el buffer actual
map <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers
" cierra todos los buffers
map <leader>ba :bufdo bd<cr>
" navegación entre buffers
map <leader>l :bnext<cr>
map <leader>h :bprevious<cr>
" Useful mappings for managing tabs
" navegación entre pestañas
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>t<leader> :tabnext
map <leader>t<leader> :tabnext<cr>
" Let 'tl' toggle between this and the last accessed tab
" 'tl' salta entre la pestaña actual y la última a la que se accedió
let g:lasttab = 1
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
" abre una nueva pestaña con la ruta del buffer actual
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/<cr>
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
" <¿?>
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Specify the behavior when switching between buffers
" especifica el comportamiento cuando se cambia de buffer
try
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry
" Return to last edit position when opening files (You want this!)
" al abrir un archivo, vuelve al mismo punto donde se dejó cuando se cerró
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => línea de estado
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" siempre muestra la línea de estado
set laststatus=2
" Format the status line
" formateo de la línea de estado
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editing mappings
" => mapeos para edición
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remap VIM 0 to first non-blank character
" remapea '0' para que posicione el cursor en el primer carácter no blanco
map 0 ^
" Move a line of text using ALT+[jk] or Command+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
" <¿>no funciona correctamente<?>
" mueve una línea de texto hacia arriba o hacia abajo
nmap <D-j> mz:m+<cr>`z
nmap <D-k> mz:m-2<cr>`z
vmap <D-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <D-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
" Delete trailing white space on save, useful for Python and CoffeeScript ;)
" borra los espacios sobrantes al final de la línea, cuando se guarda el buffer
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
@ -297,11 +266,12 @@ endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
" <¿>falta chequear toda esta sección<?>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Ag searching and cope displaying
" requires ag.vim - it's much better than vimgrep/grep
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When you press gv you Ag after the selected text
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
@ -329,12 +299,13 @@ map <leader>p :cp<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
" => chequeo de gramática
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pressing ,ss will toggle and untoggle spell checking
" activa o desactiva el chequeo de gramática
map <leader>ss :setlocal spell!<cr>
" Shortcuts using <leader>
" atajos para herramientas de la gramática
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
@ -342,36 +313,46 @@ map <leader>s? z=
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
" => misceláneo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
" quita los caracteres ^M de windows cuando las codificaciones de texto se mezclan
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Quickly open a buffer for scribble
" abre un buffer sin nombre
map <leader>q :e ~/buffer<cr>
" Quickly open a markdown buffer for scribble
" abre un buffer sin nombre, de tipo Markdown
map <leader>x :e ~/buffer.md<cr>
" Toggle paste mode on and off
" activa o desactiva el modo paste
map <leader>pp :setlocal paste!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
" => sección de definición de funciones
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ejecuta la acción 'str' como dentro de un menú gráfico
function! CmdLine(str)
" crea un menu 'Foo' con un submenú 'Bar' que ejecuta el comando str
exe "menu Foo.Bar :" . a:str
" ejecuta el menú Foo.Bar
emenu Foo.Bar
" borra el menú Foo y todo su contenido
unmenu Foo
endfunction
function! VisualSelection(direction, extra_filter) range
" definición
let l:saved_reg = @"
"
execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")
@ -385,8 +366,7 @@ function! VisualSelection(direction, extra_filter) range
let @" = l:saved_reg
endfunction
" Returns true if paste mode is enabled
" devuelve true si el modo paste está activado
function! HasPaste()
if &paste
return 'PASTE MODE '
@ -394,8 +374,9 @@ function! HasPaste()
return ''
endfunction
" Don't close window, when deleting a buffer
" redefine el comando Bclose
command! Bclose call <SID>BufcloseCloseIt()
" no cierra la ventana cuando se borra un buffer
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
@ -415,6 +396,7 @@ function! <SID>BufcloseCloseIt()
endif
endfunction
" <?>
" Make VIM remember position in file after reopen
" if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif