mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +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:
parent
183ca1cfc5
commit
690a8e40ce
278
README.md
278
README.md
@ -1,69 +1,18 @@
|
|||||||
# The Ultimate vimrc
|
# Fork de amix/vimrc optimizado para MacBook Pro 15"
|
||||||
|
|
||||||
Over the last 8 years I have used and tweaked Vim. This is my Ultimate vimrc.
|
## Instalación
|
||||||
|
|
||||||
There are two versions:
|
git clone https://github.com/facundolaffont/vimrc.git ~/.vim_runtime
|
||||||
|
sh ~/.vim_runtime/instalación.sh
|
||||||
|
|
||||||
* **Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a great basic setup
|
Es recomendable usar las [fuentes tipográficas Source Code Pro](https://github.com/adobe-fonts/source-code-pro). Son gratis y están alojadas en GitHub
|
||||||
* **Awesome**: This includes a ton of useful plugins, color schemes and configurations
|
|
||||||
|
|
||||||
I would of course recommend using the awesome version.c
|
## Cómo actualizar a la última versión
|
||||||
|
|
||||||
## How to install the Awesome version?
|
|
||||||
The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following:
|
|
||||||
|
|
||||||
git clone https://github.com/amix/vimrc.git ~/.vim_runtime
|
|
||||||
sh ~/.vim_runtime/install_awesome_vimrc.sh
|
|
||||||
|
|
||||||
I also recommend using [Source Code Pro font from Adobe](http://store1.adobe.com/cfusion/store/html/index.cfm?event=displayFontPackage&code=1960) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it
|
|
||||||
|
|
||||||
## How to install the Basic version?
|
|
||||||
The basic version is basically just one file and no plugins. You can check out [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim).
|
|
||||||
|
|
||||||
This is useful to install on remote servers where you don't need many plugins and you don't do many edits.
|
|
||||||
|
|
||||||
git clone git://github.com/amix/vimrc.git ~/.vim_runtime
|
|
||||||
sh ~/.vim_runtime/install_basic_vimrc.sh
|
|
||||||
|
|
||||||
|
|
||||||
## How to install on Windows?
|
|
||||||
|
|
||||||
Use [msysgit](http://msysgit.github.com/) to checkout the repository and run the installation instructions above. No special instructions needed ;-)
|
|
||||||
|
|
||||||
|
|
||||||
## How to install on Linux
|
|
||||||
|
|
||||||
If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: `alias vi=vim`. Otherwise, `apt-get install vim`
|
|
||||||
|
|
||||||
## How to update to latest version?
|
|
||||||
|
|
||||||
Simply just do a git rebase!
|
|
||||||
|
|
||||||
cd ~/.vim_runtime
|
cd ~/.vim_runtime
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
|
|
||||||
|
## Plugins incluídos
|
||||||
## Some screenshots
|
|
||||||
|
|
||||||
Colors when editing a Python file:
|
|
||||||

|
|
||||||
|
|
||||||
Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim):
|
|
||||||

|
|
||||||
|
|
||||||
[NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window:
|
|
||||||

|
|
||||||
|
|
||||||
This vimrc even works on Windows!
|
|
||||||

|
|
||||||
|
|
||||||
Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Included Plugins
|
|
||||||
|
|
||||||
I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience!
|
|
||||||
|
|
||||||
* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins
|
* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins
|
||||||
* [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
|
* [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
|
||||||
@ -86,16 +35,16 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ
|
|||||||
* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim
|
* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim
|
||||||
|
|
||||||
|
|
||||||
## Included color schemes
|
## Esquemas de colores incluídos
|
||||||
|
|
||||||
* [peaksea](https://github.com/vim-scripts/peaksea): My favorite!
|
* [peaksea](https://github.com/vim-scripts/peaksea)
|
||||||
* [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized)
|
* [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized)
|
||||||
* [vim-irblack](https://github.com/wgibbs/vim-irblack)
|
* [vim-irblack](https://github.com/wgibbs/vim-irblack)
|
||||||
* [mayansmoke](https://github.com/vim-scripts/mayansmoke)
|
* [mayansmoke](https://github.com/vim-scripts/mayansmoke)
|
||||||
* [vim-pyte](https://github.com/therubymug/vim-pyte)
|
* [vim-pyte](https://github.com/therubymug/vim-pyte)
|
||||||
|
|
||||||
|
|
||||||
## Included modes
|
## Modos incluídos
|
||||||
|
|
||||||
* [vim-coffee-script](https://github.com/kchmck/vim-coffee-script)
|
* [vim-coffee-script](https://github.com/kchmck/vim-coffee-script)
|
||||||
* [vim-less](https://github.com/groenewege/vim-less)
|
* [vim-less](https://github.com/groenewege/vim-less)
|
||||||
@ -104,211 +53,14 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ
|
|||||||
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx
|
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx
|
||||||
* [vim-go](https://github.com/fatih/vim-go)
|
* [vim-go](https://github.com/fatih/vim-go)
|
||||||
|
|
||||||
|
Se pueden instalar plugins personalizados, por ejemplo, via pathogen:
|
||||||
## How to include your own stuff?
|
|
||||||
|
|
||||||
After you have installed the setup you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this:
|
|
||||||
|
|
||||||
~/.vim_runtime (master)> cat my_configs.vim
|
|
||||||
map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
|
|
||||||
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
|
|
||||||
|
|
||||||
You can also install your own plugins, for instance, via pathogen we can install [vim-rails](https://github.com/tpope/vim-rails):
|
|
||||||
|
|
||||||
cd ~/.vim_runtime
|
cd ~/.vim_runtime
|
||||||
git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails
|
git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails
|
||||||
|
|
||||||
Now you have vim-rails installed ;-)
|
Con estos dos comandos, ya se tendría instalado el plugin vim-rails
|
||||||
|
|
||||||
|
## Cómo desinstalar
|
||||||
## Key Mappings
|
* Borrar `~/.vim_runtime`
|
||||||
|
* Borrar cualquier línea que haga referencia a `.vim_runtime` en tu archivo `~/.vimrc`
|
||||||
### Plugin related mappings
|
|
||||||
|
|
||||||
Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`<leader>o`):
|
|
||||||
|
|
||||||
map <leader>o :BufExplorer<cr>
|
|
||||||
|
|
||||||
Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files (`<leader>f`):
|
|
||||||
|
|
||||||
map <leader>f :MRU<CR>
|
|
||||||
|
|
||||||
Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin (`<leader>j` or `<ctrl>f`):
|
|
||||||
|
|
||||||
let g:ctrlp_map = '<c-f>'
|
|
||||||
|
|
||||||
Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin:
|
|
||||||
|
|
||||||
map <leader>nn :NERDTreeToggle<cr>
|
|
||||||
map <leader>nb :NERDTreeFromBookmark
|
|
||||||
map <leader>nf :NERDTreeFind<cr>
|
|
||||||
|
|
||||||
[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. (`<leader>z`)
|
|
||||||
|
|
||||||
map <leader>z :Goyo<cr>
|
|
||||||
|
|
||||||
### Normal mode mappings
|
|
||||||
|
|
||||||
Fast saving of a buffer (`<leader>w`):
|
|
||||||
|
|
||||||
nmap <leader>w :w!<cr>
|
|
||||||
|
|
||||||
Map `<Space>` to `/` (search) and `<Ctrl>+<Space>` to `?` (backwards search):
|
|
||||||
|
|
||||||
map <space> /
|
|
||||||
map <c-space> ?
|
|
||||||
map <silent> <leader><cr> :noh<cr>
|
|
||||||
|
|
||||||
Disable highlight when `<leader><cr>` is pressed:
|
|
||||||
|
|
||||||
map <silent> <leader><cr> :noh<cr>
|
|
||||||
|
|
||||||
Smart way to move between windows (`<ctrl>j` etc.):
|
|
||||||
|
|
||||||
map <C-j> <C-W>j
|
|
||||||
map <C-k> <C-W>k
|
|
||||||
map <C-h> <C-W>h
|
|
||||||
map <C-l> <C-W>l
|
|
||||||
|
|
||||||
Closing of current buffer(s) (`<leader>bd` and (`<leader>ba`)):
|
|
||||||
|
|
||||||
" Close current buffer
|
|
||||||
map <leader>bd :Bclose<cr>
|
|
||||||
|
|
||||||
" Close all buffers
|
|
||||||
map <leader>ba :1,1000 bd!<cr>
|
|
||||||
|
|
||||||
Useful mappings for managing tabs:
|
|
||||||
|
|
||||||
map <leader>tn :tabnew<cr>
|
|
||||||
map <leader>to :tabonly<cr>
|
|
||||||
map <leader>tc :tabclose<cr>
|
|
||||||
map <leader>tm :tabmove
|
|
||||||
|
|
||||||
" 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>
|
|
||||||
|
|
||||||
Open vimgrep and put the cursor in the right position:
|
|
||||||
|
|
||||||
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
|
|
||||||
|
|
||||||
Vimgreps in the current file:
|
|
||||||
|
|
||||||
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
|
|
||||||
|
|
||||||
Remove the Windows ^M - when the encodings gets messed up:
|
|
||||||
|
|
||||||
noremap <leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
|
||||||
|
|
||||||
Quickly open a buffer for scripbble:
|
|
||||||
|
|
||||||
map <leader>q :e ~/buffer<cr>
|
|
||||||
|
|
||||||
Toggle paste mode on and off:
|
|
||||||
|
|
||||||
map <leader>pp :setlocal paste!<cr>
|
|
||||||
|
|
||||||
|
|
||||||
### Insert mode mappings
|
|
||||||
|
|
||||||
Quickly insert parenthesis/brackets/etc.:
|
|
||||||
|
|
||||||
inoremap $1 ()<esc>i
|
|
||||||
inoremap $2 []<esc>i
|
|
||||||
inoremap $3 {}<esc>i
|
|
||||||
inoremap $4 {<esc>o}<esc>O
|
|
||||||
inoremap $q ''<esc>i
|
|
||||||
inoremap $e ""<esc>i
|
|
||||||
inoremap $t <><esc>i
|
|
||||||
|
|
||||||
Insert the current date and time (useful for timestamps):
|
|
||||||
|
|
||||||
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
|
|
||||||
|
|
||||||
|
|
||||||
### Visual mode mappings
|
|
||||||
|
|
||||||
Visual mode pressing `*` or `#` searches for the current selection:
|
|
||||||
|
|
||||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
|
||||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
|
||||||
|
|
||||||
When you press gv you vimgrep after the selected text:
|
|
||||||
|
|
||||||
vnoremap <silent> gv :call VisualSelection('gv')<CR>
|
|
||||||
|
|
||||||
When you press `<leader>r` you can search and replace the selected text:
|
|
||||||
|
|
||||||
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
|
|
||||||
|
|
||||||
Surround the visual selection in parenthesis/brackets/etc.:
|
|
||||||
|
|
||||||
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
|
|
||||||
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
|
|
||||||
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
|
|
||||||
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
|
|
||||||
vnoremap $q <esc>`>a'<esc>`<i'<esc>
|
|
||||||
vnoremap $e <esc>`>a"<esc>`<i"<esc>
|
|
||||||
|
|
||||||
|
|
||||||
### Command line mappings
|
|
||||||
|
|
||||||
$q is super useful when browsing on the command line. It deletes everything until the last slash:
|
|
||||||
|
|
||||||
cno $q <C-\>eDeleteTillSlash()<cr>
|
|
||||||
|
|
||||||
Bash like keys for the command line:
|
|
||||||
|
|
||||||
cnoremap <C-A> <Home>
|
|
||||||
cnoremap <C-E> <End>
|
|
||||||
cnoremap <C-K> <C-U>
|
|
||||||
|
|
||||||
cnoremap <C-P> <Up>
|
|
||||||
cnoremap <C-N> <Down>
|
|
||||||
|
|
||||||
Write the file as sudo (only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write):
|
|
||||||
|
|
||||||
:W
|
|
||||||
|
|
||||||
|
|
||||||
### Spell checking
|
|
||||||
Pressing `<leader>ss` will toggle and untoggle spell checking
|
|
||||||
|
|
||||||
map <leader>ss :setlocal spell!<cr>
|
|
||||||
|
|
||||||
Shortcuts using `<leader>` instead of special chars
|
|
||||||
|
|
||||||
map <leader>sn ]s
|
|
||||||
map <leader>sp [s
|
|
||||||
map <leader>sa zg
|
|
||||||
map <leader>s? z=
|
|
||||||
|
|
||||||
### Cope
|
|
||||||
Do :help cope if you are unsure what cope is. It's super useful!
|
|
||||||
|
|
||||||
When you search with vimgrep, display your results in cope by doing:
|
|
||||||
`<leader>cc`
|
|
||||||
|
|
||||||
To go to the next search result do:
|
|
||||||
`<leader>n`
|
|
||||||
|
|
||||||
To go to the previous search results do:
|
|
||||||
`<leader>p`
|
|
||||||
|
|
||||||
Vimscript mappings:
|
|
||||||
|
|
||||||
map <leader>cc :botright cope<cr>
|
|
||||||
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
|
|
||||||
map <leader>n :cn<cr>
|
|
||||||
map <leader>p :cp<cr>
|
|
||||||
|
|
||||||
## How to uninstall
|
|
||||||
Do following:
|
|
||||||
* Remove `~/.vim_runtime`
|
|
||||||
* Remove any lines that refernce `.vim_runtime` in your `~/.vimrc`
|
|
||||||
|
|
||||||
|
@ -12,4 +12,4 @@ source ~/.vim_runtime/my_configs.vim
|
|||||||
catch
|
catch
|
||||||
endtry' > ~/.vimrc
|
endtry' > ~/.vimrc
|
||||||
|
|
||||||
echo "Installed the Ultimate Vim configuration successfully! Enjoy :-)"
|
echo "Instalación finalizada!"
|
@ -1,3 +0,0 @@
|
|||||||
cd ~/.vim_runtime
|
|
||||||
cat ~/.vim_runtime/vimrcs/basic.vim > ~/.vimrc
|
|
||||||
echo "Installed the Basic Vim configuration successfully! Enjoy :-)"
|
|
264
vimrcs/basic.vim
264
vimrcs/basic.vim
@ -1,28 +1,9 @@
|
|||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Maintainer:
|
" Mantenimiento:
|
||||||
" Amir Salihefendic
|
" Facundo Laffont
|
||||||
" http://amix.dk - amix@amix.dk
|
" facundolaffont@gmail.com
|
||||||
"
|
"
|
||||||
" Version:
|
" Secciones:
|
||||||
" 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:
|
|
||||||
" -> General
|
" -> General
|
||||||
" -> VIM user interface
|
" -> VIM user interface
|
||||||
" -> Colors and Fonts
|
" -> 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
|
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 plugin on
|
||||||
filetype indent 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
|
set autoread
|
||||||
|
|
||||||
" With a map leader it's possible to do extra key combinations
|
" Se va a utilizar el mapleader para generar combinaciones de tecla extra
|
||||||
" like <leader>w saves the current file
|
|
||||||
let mapleader = ","
|
let mapleader = ","
|
||||||
let g:mapleader = ","
|
let g:mapleader = ","
|
||||||
|
|
||||||
" Fast saving
|
" guardado rápido
|
||||||
nmap <leader>w :w!<cr>
|
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
|
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
|
" deja un espacio de 5 líneas entre el curso y el borde superior o inferior
|
||||||
let $LANG='en'
|
set so=5
|
||||||
set langmenu=en
|
|
||||||
source $VIMRUNTIME/delmenu.vim
|
|
||||||
source $VIMRUNTIME/menu.vim
|
|
||||||
|
|
||||||
" Turn on the WiLd menu
|
" activa el menú Wild
|
||||||
set wildmenu
|
set wildmenu
|
||||||
|
|
||||||
" Ignore compiled files
|
" ignora los archivos de compilación (útil para git)
|
||||||
set wildignore=*.o,*~,*.pyc
|
set wildignore=*.o,*~,*.pyc,*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||||
if has("win16") || has("win32")
|
|
||||||
set wildignore+=.git\*,.hg\*,.svn\*
|
|
||||||
else
|
|
||||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
|
||||||
endif
|
|
||||||
|
|
||||||
"Always show current position
|
" siempre muestra la posición del cursor
|
||||||
set ruler
|
set ruler
|
||||||
|
|
||||||
" Height of the command bar
|
" altura de la línea de comandos
|
||||||
set cmdheight=2
|
set cmdheight=2
|
||||||
|
|
||||||
|
" <?>
|
||||||
" A buffer becomes hidden when it is abandoned
|
" A buffer becomes hidden when it is abandoned
|
||||||
set hid
|
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 backspace=eol,start,indent
|
||||||
set whichwrap+=<,>,h,l
|
set whichwrap+=<,>,h,l
|
||||||
|
|
||||||
" Ignore case when searching
|
" ignora la sensibilidad de las mayúsculas cuando se está buscando
|
||||||
set ignorecase
|
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
|
set smartcase
|
||||||
|
|
||||||
" Highlight search results
|
" resalta los resultados de las búsquedas
|
||||||
set hlsearch
|
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
|
set incsearch
|
||||||
|
|
||||||
" Don't redraw while executing macros (good performance config)
|
" no redibuja cuando se ejecutan macros (buena performance)
|
||||||
set lazyredraw
|
set lazyredraw
|
||||||
|
|
||||||
" For regular expressions turn magic on
|
" activa magic para las expresiones regulares
|
||||||
set magic
|
set magic
|
||||||
|
|
||||||
" Show matching brackets when text indicator is over them
|
" muestra el paréntesis opuesto cuando el cursor está sobre uno
|
||||||
set showmatch
|
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
|
set mat=2
|
||||||
|
|
||||||
" No annoying sound on errors
|
" quita el sonido y el flash en los errores
|
||||||
set noerrorbells
|
set noerrorbells
|
||||||
set novisualbell
|
set novisualbell
|
||||||
set t_vb=
|
set t_vb=
|
||||||
set tm=500
|
set tm=500
|
||||||
|
|
||||||
" Add a bit extra margin to the left
|
" agrega un poco de margen a la izquierda
|
||||||
set foldcolumn=1
|
set foldcolumn=1
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Colors and Fonts
|
" => colores y fuentes tipográficas
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Enable syntax highlighting
|
|
||||||
|
" habilita el resaltado según sintaxis
|
||||||
syntax enable
|
syntax enable
|
||||||
|
|
||||||
|
" intenta utilizar el esquema de color desert
|
||||||
try
|
try
|
||||||
colorscheme desert
|
colorscheme desert
|
||||||
catch
|
catch
|
||||||
endtry
|
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 background=dark
|
||||||
|
|
||||||
" Set extra options when running in GUI mode
|
" establece utf8 como la codificación estándar
|
||||||
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
|
set encoding=utf8
|
||||||
|
|
||||||
" Use Unix as the standard file type
|
" utiliza Unix como tipo de archivo estándar
|
||||||
set ffs=unix,dos,mac
|
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...
|
" Turn backup off, since most stuff is in SVN, git et.c anyway...
|
||||||
set nobackup
|
set nobackup
|
||||||
set nowb
|
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
|
set expandtab
|
||||||
|
|
||||||
" Be smart when using tabs ;)
|
" usa las tabulaciones de manera inteligente
|
||||||
set smarttab
|
set smarttab
|
||||||
|
|
||||||
" 1 tab == 4 spaces
|
" 1 tabulación == 4 espacios
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
set tabstop=4
|
set tabstop=4
|
||||||
|
|
||||||
" Linebreak on 500 characters
|
" el quiebre de línea se realiza a los 100 caracteres
|
||||||
set lbr
|
set lbr
|
||||||
set tw=500
|
set tw=100
|
||||||
|
|
||||||
set ai "Auto indent
|
" establece autoindentación, indentación inteligente y quiebre de líneas
|
||||||
set si "Smart indent
|
set ai
|
||||||
set wrap "Wrap lines
|
set si
|
||||||
|
set wrap
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Visual mode related
|
" => relacionado con el modo visual
|
||||||
""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Visual mode pressing * or # searches for the current selection
|
|
||||||
" Super useful! From an idea by Michael Naumann
|
" 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>
|
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 <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>
|
map <silent> <leader><cr> :noh<cr>
|
||||||
|
|
||||||
" Smart way to move between windows
|
" movimiento entre ventanas
|
||||||
map <C-j> <C-W>j
|
map <C-j> <C-W>j
|
||||||
map <C-k> <C-W>k
|
map <C-k> <C-W>k
|
||||||
map <C-h> <C-W>h
|
map <C-h> <C-W>h
|
||||||
map <C-l> <C-W>l
|
map <C-l> <C-W>l
|
||||||
|
|
||||||
" Close the current buffer
|
" cierra el buffer actual
|
||||||
map <leader>bd :Bclose<cr>:tabclose<cr>gT
|
map <leader>bd :Bclose<cr>:tabclose<cr>gT
|
||||||
|
|
||||||
" Close all the buffers
|
" cierra todos los buffers
|
||||||
map <leader>ba :bufdo bd<cr>
|
map <leader>ba :bufdo bd<cr>
|
||||||
|
|
||||||
|
" navegación entre buffers
|
||||||
map <leader>l :bnext<cr>
|
map <leader>l :bnext<cr>
|
||||||
map <leader>h :bprevious<cr>
|
map <leader>h :bprevious<cr>
|
||||||
|
|
||||||
" Useful mappings for managing tabs
|
" navegación entre pestañas
|
||||||
map <leader>tn :tabnew<cr>
|
map <leader>tn :tabnew<cr>
|
||||||
map <leader>to :tabonly<cr>
|
map <leader>to :tabonly<cr>
|
||||||
map <leader>tc :tabclose<cr>
|
map <leader>tc :tabclose<cr>
|
||||||
map <leader>tm :tabmove
|
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
|
let g:lasttab = 1
|
||||||
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
|
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
|
||||||
au TabLeave * let g:lasttab = tabpagenr()
|
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
|
" Switch CWD to the directory of the open buffer
|
||||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
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
|
try
|
||||||
set switchbuf=useopen,usetab,newtab
|
set switchbuf=useopen,usetab,newtab
|
||||||
set stal=2
|
set stal=2
|
||||||
catch
|
catch
|
||||||
endtry
|
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
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Status line
|
" => línea de estado
|
||||||
""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Always show the status line
|
|
||||||
|
" siempre muestra la línea de estado
|
||||||
set laststatus=2
|
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
|
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 ^
|
map 0 ^
|
||||||
|
|
||||||
" Move a line of text using ALT+[jk] or Command+[jk] on mac
|
" <¿>no funciona correctamente<?>
|
||||||
nmap <M-j> mz:m+<cr>`z
|
" mueve una línea de texto hacia arriba o hacia abajo
|
||||||
nmap <M-k> mz:m-2<cr>`z
|
nmap <D-j> mz:m+<cr>`z
|
||||||
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
|
nmap <D-k> mz:m-2<cr>`z
|
||||||
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`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")
|
" borra los espacios sobrantes al final de la línea, cuando se guarda el buffer
|
||||||
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 ;)
|
|
||||||
func! DeleteTrailingWS()
|
func! DeleteTrailingWS()
|
||||||
exe "normal mz"
|
exe "normal mz"
|
||||||
%s/\s\+$//ge
|
%s/\s\+$//ge
|
||||||
@ -297,11 +266,12 @@ endfunc
|
|||||||
autocmd BufWrite *.py :call DeleteTrailingWS()
|
autocmd BufWrite *.py :call DeleteTrailingWS()
|
||||||
autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
||||||
|
|
||||||
|
" <¿>falta chequear toda esta sección<?>
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Ag searching and cope displaying
|
" => Ag searching and cope displaying
|
||||||
" requires ag.vim - it's much better than vimgrep/grep
|
" requires ag.vim - it's much better than vimgrep/grep
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" When you press gv you Ag after the selected text
|
" When you press gv you Ag after the selected text
|
||||||
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
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>
|
map <leader>ss :setlocal spell!<cr>
|
||||||
|
|
||||||
" Shortcuts using <leader>
|
" atajos para herramientas de la gramática
|
||||||
map <leader>sn ]s
|
map <leader>sn ]s
|
||||||
map <leader>sp [s
|
map <leader>sp [s
|
||||||
map <leader>sa zg
|
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
|
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>
|
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>
|
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>
|
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)
|
function! CmdLine(str)
|
||||||
|
" crea un menu 'Foo' con un submenú 'Bar' que ejecuta el comando str
|
||||||
exe "menu Foo.Bar :" . a:str
|
exe "menu Foo.Bar :" . a:str
|
||||||
|
|
||||||
|
" ejecuta el menú Foo.Bar
|
||||||
emenu Foo.Bar
|
emenu Foo.Bar
|
||||||
|
|
||||||
|
" borra el menú Foo y todo su contenido
|
||||||
unmenu Foo
|
unmenu Foo
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! VisualSelection(direction, extra_filter) range
|
function! VisualSelection(direction, extra_filter) range
|
||||||
|
" definición
|
||||||
let l:saved_reg = @"
|
let l:saved_reg = @"
|
||||||
|
|
||||||
|
"
|
||||||
execute "normal! vgvy"
|
execute "normal! vgvy"
|
||||||
|
|
||||||
|
|
||||||
let l:pattern = escape(@", '\\/.*$^~[]')
|
let l:pattern = escape(@", '\\/.*$^~[]')
|
||||||
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
||||||
|
|
||||||
@ -385,8 +366,7 @@ function! VisualSelection(direction, extra_filter) range
|
|||||||
let @" = l:saved_reg
|
let @" = l:saved_reg
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" devuelve true si el modo paste está activado
|
||||||
" Returns true if paste mode is enabled
|
|
||||||
function! HasPaste()
|
function! HasPaste()
|
||||||
if &paste
|
if &paste
|
||||||
return 'PASTE MODE '
|
return 'PASTE MODE '
|
||||||
@ -394,8 +374,9 @@ function! HasPaste()
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Don't close window, when deleting a buffer
|
" redefine el comando Bclose
|
||||||
command! Bclose call <SID>BufcloseCloseIt()
|
command! Bclose call <SID>BufcloseCloseIt()
|
||||||
|
" no cierra la ventana cuando se borra un buffer
|
||||||
function! <SID>BufcloseCloseIt()
|
function! <SID>BufcloseCloseIt()
|
||||||
let l:currentBufNum = bufnr("%")
|
let l:currentBufNum = bufnr("%")
|
||||||
let l:alternateBufNum = bufnr("#")
|
let l:alternateBufNum = bufnr("#")
|
||||||
@ -415,6 +396,7 @@ function! <SID>BufcloseCloseIt()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" <?>
|
||||||
" Make VIM remember position in file after reopen
|
" Make VIM remember position in file after reopen
|
||||||
" if has("autocmd")
|
" if has("autocmd")
|
||||||
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
Loading…
Reference in New Issue
Block a user