dotfiles/nvim/.config/nvim/init.vim

149 lines
4.1 KiB
VimL

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CONFIGURACIÓN BÁSICA
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Codificación
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set fileformats=unix,dos,mac
" Arregla identación por backspace
set backspace=indent,eol,start
" Linea infinita
set nowrap
" Tabulaciones
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
" Búsqueda
set hlsearch
set incsearch
set ignorecase
set smartcase
" Mapea la tecla líder a ,
let mapleader=','
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CONFIGURACIÓN VISUAL
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sintaxis
syntax on
" Linea de estado
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
" Números de linea
set rnu
set nu
set scrolloff=4 "no haga scroll cuando faltan 4 lineas
" Marca en la columan 80
set colorcolumn=80
highlight ColorColumn ctermbg=238
" Centra el resultado de las busquedas para mejor enfoque
nnoremap n nzzzv
nnoremap N Nzzzv
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM-PLUG CORE
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
" let g:vim_bootstrap_langs = "go,html,javascript,python"
" let g:vim_bootstrap_editor = "nvim" " nvim or vim
if !filereadable(vimplug_exists)
if !executable("curl")
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent exec "!\curl -fLo " . vimplug_exists . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"
autocmd VimEnter * PlugInstall
endif
" Required:
call plug#begin(expand('~/.config/nvim/plugged'))
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" INSTALACIÓN DE PLUGGINS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged') " comienzo instalación de pluggins
" Gestor de archivos
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
" Comentar lineas
Plug 'tpope/vim-commentary'
" Neovim Tree shitter - Sintaxis highlight
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end() " fin de la instalción de pluggins
" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
nnoremap <silent> <F2> :NERDTreeFind<CR>
nnoremap <silent> <F3> :NERDTreeToggle<CR>
" Treesitter config
" :TSInstall python
" :TSInstall rust
" :TSInstall javascript
" :TSInstall c
lua <<EOF
require'nvim-treesitter.configs'.setup {
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = {
"python", "javascript", "rust", "c", "html", "css"
},
indent = { enable = true },
highlight = {
enable = true,
-- disable = { "c", "rust" }, -- lista de lenguajes desactivados
},
incremental_selection = { enable = true },
textobjects = { enable = true }
}
EOF
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mapeos
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Limpia busqueda
nnoremap <silent> <leader><space> :noh<cr>
" Pestañas
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <S-t> :tabnew<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" POR HACER
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" lsp
" sistema para buscar: telescope, harpoon, fuzzyfinder, grep...
"
" desde que puse la config de nerdtree no fuciona vim-commentary... :S