Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let mapleader ="ç"
- " Vim-plug
- call plug#begin('~/.config/nvim/plugged')
- Plug 'bling/vim-airline'
- Plug 'dhruvasagar/vim-table-mode'
- Plug 'drmingdrmer/vim-toggle-quickfix'
- Plug 'dyng/ctrlsf.vim'
- Plug 'gorodinskiy/vim-coloresque', {'for': ['css', 'html']}
- Plug 'haya14busa/incsearch.vim'
- Plug 'honza/vim-snippets'
- Plug 'junegunn/fzf.vim'
- Plug 'junegunn/goyo.vim'
- Plug 'luochen1990/rainbow'
- Plug 'majutsushi/tagbar' " F9
- Plug 'othree/html5.vim'
- Plug 'pbrisbin/vim-mkdir'
- Plug 'scrooloose/nerdtree'
- Plug 'sheerun/vim-polyglot'
- Plug 'SirVer/ultisnips'
- Plug 'suan/vim-instant-markdown'
- Plug 'Townk/vim-autoclose'
- Plug 'tpope/vim-commentary'
- Plug 'tpope/vim-fugitive'
- Plug 'tpope/vim-repeat'
- Plug 'tpope/vim-speeddating'
- Plug 'tpope/vim-surround'
- Plug 'vim-scripts/a.vim'
- Plug 'vim-scripts/repmo.vim'
- Plug 'vimwiki/vimwiki'
- Plug 'w0rp/ale' " Linter
- Plug 'wesQ3/vim-windowswap'
- " vim-devicons should be the last plugin
- Plug 'ryanoasis/vim-devicons'
- call plug#end()
- " fugitive // gitgutter
- " command -bang -nargs=? QFix call QFixToggle(<bang>0)
- function! QFixToggle()
- if exists("g:qfix_win")
- cclose
- unlet g:qfix_win
- else
- copen 10
- let g:qfix_win = bufnr("$")
- endif
- endfunction
- " IncSearch default bindings
- map / <Plug>(incsearch-forward)
- map ? <Plug>(incsearch-backward)
- map g/ <Plug>(incsearch-stay)
- map <leader>h :set hlsearch!<cr>
- nnoremap <C-S> :CtrlSF
- xmap <C-B> g<C-A>
- " Multiple definitions of variables for plugins
- " Airline tuning
- let g:airline#extensions#tabline#enabled = 1
- let g:airline#extensions#tabline#show_buffers = 1
- let g:airline#extensions#tabline#show_tabs = 1
- let g:airline_theme='minimalist'
- let g:ale_lint_on_enter = 0
- let g:ale_set_loclist = 0
- let g:ale_set_quickfix = 1
- let g:ctrlsf_auto_close = {"normal" : 1, "compact": 1 }
- let g:ctrlsf_auto_focus = { "at": "done", "duration_less_than": 2000 }
- let g:ctrlsf_context = '-B 0 -A 0'
- let g:ctrlsf_default_view_mode = 'compact'
- let g:ctrlsf_regex_pattern = 1
- let g:fzf_layout = { 'down': '~15%' }
- let g:goyo_height=40
- let g:goyo_width=100
- let g:instant_markdown_autostart = 0
- let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
- let g:rainbow_active = 1
- let g:vimwiki_ext2syntax = {}
- " vimwiki files changed to .markdown for the sake of having different syntax highlighting/bindings
- let g:vimwiki_list = [{'path': '~/vimwiki','syntax': 'markdown', 'ext': '.markdown'}]
- " NERDTree
- let NERDTreeAutoDeleteBuffer = 1
- let NERDTreeDirArrows = 1
- let NERDTreeMinimalUI = 1
- let NERDTreeQuitOnOpen=1
- set diffopt+=vertical
- " Trigger configuration for UltiSnips
- let g:UltiSnipsExpandTrigger="<tab>"
- let g:UltiSnipsJumpForwardTrigger="<c-space>"
- let g:UltiSnipsJumpBackwardTrigger="<c-g>"
- " If you want :UltiSnipsEdit to split your window.
- let g:UltiSnipsEditSplit="vertical"
- " Basic definitions
- set nocompatible
- nnoremap c "_c
- filetype on
- syntax on
- autocmd BufRead,BufNewFile * ALEDisable
- set autoread
- set clipboard=unnamedplus " Requires Nvim
- set encoding=UTF-8
- set foldlevel=1
- set foldmethod=manual
- set hidden
- set ignorecase
- " set list lcs=tab:\┊\ "
- set list lcs=tab:\|\ "
- set magic " apaga y vamonos
- set modelines=1
- set mouse=a
- set nohlsearch " Incsearch is enough
- set noshowmode " Mode is up on vim-airline
- set number relativenumber
- set numberwidth=4
- set scrolloff=1
- set shiftwidth=4
- set shortmess=atI
- set smartcase
- set spelllang=es
- set splitbelow splitright
- set tabstop=4
- set undodir=~/.vim/undo
- set undofile
- set wildmode=longest,list,full
- set wrap
- vmap a A
- vmap i I
- " Move visual blocks vertically
- vnoremap J :m '>+1<CR>gv=gv
- vnoremap K :m '<-2<CR>gv=gv
- " Open ex mode on return press
- nnoremap <CR> :
- " Center on search
- nnoremap n nzzzv
- nnoremap N Nzzzv
- "Remove all comments
- nnoremap <leader>v :g/^#/d_<cr>
- " Maintain Visual Mode after shifting > and <
- vmap < <gv
- vmap > >gv
- " Tagbar
- nmap <F9> :TagbarToggle<CR>
- " Quickfix List
- nmap <silent> <leader>q :call QFixToggle()<CR>
- " Editing vimrc in vim
- nnoremap <leader>ev :vspl $MYVIMRC<cr>
- nnoremap <leader>sv :source $MYVIMRC<cr>
- " 0 goes to the first character instead of the indent
- nnoremap 0 ^
- " Buffer movement
- nnoremap <S-Tab> :bp<cr>
- nnoremap <Tab> :bn<cr>
- "Resizing splits
- nnoremap <F5> :vertical resize +5<cr>
- nnoremap <F2> :vertical resize -5<cr>
- nnoremap <F4> :resize +5<cr>
- nnoremap <F3> :resize -5<cr>
- " Table mode
- nnoremap <F6> :TableModeToggle<cr>
- " Goyo - Distraction free typing
- map <leader>f :Goyo \| set linebreak<CR>
- " Spell-check toggle with <leader>o
- map <leader>o :setlocal spell! <CR>
- " Fuzzy finder
- nnoremap <silent> <expr> <C-f> (expand('%') =~ 'NERD_tree' ? "\<c-w>\<c-w>" : '').":FZF\<cr>"
- " Leah Rowe movement
- map <C-h> <C-w>h
- map <C-j> <C-w>j
- map <C-k> <C-w>k
- map <C-l> <C-w>l
- " Replace all with S
- nnoremap S :%s/\v/g<Left><Left>
- " Allow saving of files as sudo when I forgot to start vim using sudo.
- cmap w!! w !sudo /usr/bin/tee > /dev/null %
- " Indent whole file
- nnoremap <leader>i gg=G<C-o>
- " Compile document (saves file)
- map <leader>c :w! \| !compiler <c-r>% <CR>
- map <leader>x :ALEToggle<cr>
- " Remove ex mode
- nnoremap Q <nop>
- " Remove annoying tutorial
- nnoremap <F1> <nop>
- " Open corresponding .pdf/.html or preview
- map <leader>p :!opout <c-r>%<CR><CR>
- " Automatically deletes all trailing whitespace on save
- autocmd BufWritePre * %s/\s\+$//e
- " Disables automatic commenting on newline
- autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
- " Nerd tree
- map <C-n> :NERDTreeToggle<CR>
- " Closes if only tab is NERDTree
- autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
- " Terminal emulator bindings
- if has('nvim')
- au TermOpen * setlocal nonumber norelativenumber
- tnoremap <Esc> <C-\><C-n>
- au TermOpen * setlocal nonumber | startinsert
- au TermClose * setlocal number | call feedkeys("\<C-\>\<C-n>")
- endif
- " Sets commentary on c as //
- autocmd FileType c,cpp,cs,java setlocal commentstring=//\ %s
- " Cleans out tex build files on file close
- autocmd VimLeave *.tex !texclear %
- autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
- autocmd FileType pandoc set syntax=markdown
- autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
- autocmd BufRead,BufNewFile *.tex set filetype=tex
- " When shortcut files are updated, renew bash and ranger configs with new material
- autocmd BufWritePost ~/.bmdirs,~/.bmfiles !shortcuts
- " Run xrdb whenever Xdefaults or Xresources are updated.
- autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
- " Autocompile vimwiki to html
- autocmd BufWritePost ~/main/vimwiki/*.markdown !compiler % &
- " Auto source .vimrc when saved. Nvim friendly
- autocmd! BufWritePost ~/.vimrc,~/.config/nvim/init.vim source $MYVIMRC
- " Too big to be with the rest of the variable definitions
- let g:rainbow_conf = {
- \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
- \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
- \ 'operators': '_,_',
- \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
- \ 'separately': {
- \ '*': {},
- \ 'tex': {
- \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'],
- \ },
- \ 'lisp': {
- \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'],
- \ },
- \ 'vim': {
- \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'],
- \ },
- \ 'html': {
- \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=#</\z1># fold'],
- \ },
- \ 'css': 0,
- \ }
- \}
- if exists('$TMUX')
- let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
- let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
- else
- let &t_SI = "\e[5 q"
- let &t_EI = "\e[2 q"
- endif
- set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
- \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
- \,sm:block-blinkwait175-blinkoff150-blinkon175
- " augroup vimrc
- " au BufReadPre * setlocal foldmethod=indent
- " au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
- " au BufWinEnter * norm zR
- " augroup END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement