-
-
Save skywind3000/dc795fb50e929edb3e27fe9789c90b04 to your computer and use it in GitHub Desktop.
Mi configuración .vimrc y coc-settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scriptencoding utf-8 " basic | |
set nocompatible " basic | |
filetype off " basic | |
filetype plugin on " Enable filetype plugins | |
filetype indent on " Enable loading the indent file for specific file types | |
syntax enable " Enable syntax highlighting | |
set encoding=utf-8 " Encoding (needed in youcompleteme) | |
set fileencoding=utf-8 " The encoding written to file. | |
set noerrorbells " No annoying sound on errors | |
set number " Line numbers on | |
set hidden " Allow buffer switching without saving | |
set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility | |
set lazyredraw " Don't redraw while executing macros (good performance config) | |
set magic " For regular expressions turn magic on | |
set showmatch " Show matching brackets/parenthesis | |
set mat=2 " How many tenths of a second to blink when matching brackets | |
set autoread " Detect changes | |
set t_vb= " Flashing screen is annoying | |
set ruler " Always show current position | |
set cmdheight=1 " Height of the command bar | |
set showcmd " Show command in status bar | |
set autoindent " Auto indent | |
set formatoptions=tcqj " Format options, each letter means something | |
set history=10000 " Sets how many lines of history VIM has to remember | |
set so=5 " Set 7 lines to the cursor - when moving vertically using j/k | |
set backspace=indent,eol,start " fix: backspace past start of operation | |
set linespace=0 " No extra spaces between rows | |
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too | |
set ff=unix " Use Unix as the standard file type | |
set ffs=unix,dos,mac " This gives the end-of-line (<EOL>) formats that will be tried | |
set virtualedit=block " If you need to define a block in visual block mode with bounds outside the actual text (that is, past the end of lines), you can allow this with: | |
set relativenumber " Use relative numbers instead of absolute | |
set wrap! " Don't wrap long lines | |
set background=dark " Dark | |
set shiftwidth=2 " Use indents of 2 spaces | |
set expandtab " Tabs are spaces, not tabs | |
set tabstop=2 " An indentation every four columns | |
set softtabstop=2 " Let backspace delete indent | |
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) | |
set ai " Auto indent | |
set si " Smart indent | |
set switchbuf=useopen,usetab " Specify the behavior when switching between buffers | |
set hlsearch " Highlight search results | |
set incsearch " Makes search act like search in modern browsers | |
set ignorecase " Ignore case when searching | |
set smartcase " When searching try to be smart about cases | |
set gdefault " Add g (global) to substitute operations, :s/pattern/replacement/ | |
set splitbelow " Open split below | |
set splitright " Open split right | |
set listchars=trail:- | |
augroup basic | |
autocmd! | |
" If you don’t require the error feedback, you can turn off the flashing screen for the “visual bell”: | |
autocmd GUIEnter * set vb t_vb= | |
augroup END | |
" Leader Key | |
let mapleader=" " | |
let maplocalleader = "\\" | |
" Copy text to the end of line | |
nnoremap Y y$ | |
" Repeat last command | |
nnoremap g. @: | |
" Scroll viewport faster: > | |
nnoremap <C-e> 2<C-e> | |
nnoremap <C-y> 2<C-y> | |
" Deleting to blackhole | |
nnoremap <leader>x "_x | |
nnoremap <leader>d "_d | |
nnoremap <leader>c "_c | |
" Refresh | |
nnoremap <F5> :e<CR> | |
" Save | |
nnoremap <C-s> :w!<CR> | |
vnoremap <C-s> <Esc>:w!<CR> | |
inoremap <C-s> <Esc>:w!<CR> | |
""""""""""""""""""""""" | |
" Clipboard | |
""""""""""""""""""""""" | |
" Clipboard share | |
if has('clipboard') | |
if has('unnamedplus') | |
" When possible use + register for copy-paste | |
set clipboard=unnamed,unnamedplus | |
else | |
" On mac and Windows, use * register for copy-paste | |
set clipboard=unnamed | |
endif | |
endif | |
" Don't lose clipboard when pasting | |
vnoremap p pgvy | |
""""""""""""""""""""""" | |
" Wildmenu | |
""""""""""""""""""""""" | |
set wildmenu " Show list instead of just completing | |
set wildignore=*.o,*~,*.pyc " Ignore compiled files | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store | |
""""""""""""""""""""""" | |
" Vim info, backup, swap | |
""""""""""""""""""""""" | |
" Create vim dir if not exists | |
if !isdirectory($HOME."/.vim") | |
call mkdir($HOME."/.vim","p") | |
endif | |
" The idea of "viminfo" is to save info from one editing session for the next by saving the data in an "viminfo file". | |
" So next time I satrt up Vim I can use the search patterns from the search history and the commands from the command line again. I can also load files again with a simple ":b bufname". | |
" And Vim also remember where the cursor was in the files I edited. See ":help viminfo" for more info on Vim's "viminfo". :-} | |
" https://www.guckes.net/vim/setup.html | |
" Neovim has different viminfo structure | |
" if (!has("nvim")) | |
" set viminfo='50,<500,s100,:0,n$HOME/.vim/viminfo | |
" endif | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Files, backups and undo | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" For Unix and Win32, if a directory ends in two path separators "//" or "\\", the swap file name will be built from the complete path to the file with all path separators substituted to percent '%' signs. This will ensure file name uniqueness in the preserve directory. | |
set backupdir=$HOME/.vim/tmp// | |
set directory=$HOME/.vim/tmp// | |
set undodir=$HOME/.vim/tmp// | |
set undofile | |
command! TmpFilesClean !rm ~/.vim/tmp/** | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" search replace | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" don't move cursor on * | |
nmap * *N | |
" Clear search | |
nnoremap <silent> <leader><Esc> :let @/=""<cr> | |
" No highlight search | |
nnoremap <leader>/ :nohlsearch<cr> | |
" don't higlight search when sourcing .vimrc | |
let @/ = "" | |
" Visual mode pressing * or # searches for the current selection | |
vnoremap <silent> * :<C-u>call EscapedSearch()<CR>/<C-R>=@/<CR><CR>N | |
vnoremap <silent> # :<C-u>call EscapedSearch()<CR>?<C-R>=@/<CR><CR>N | |
" <leader>r replace one by one | |
nnoremap <silent> <leader>r viw:call EscapedSearch()<CR>cgn | |
vnoremap <silent> <leader>r :call EscapedSearch()<CR>cgn | |
" <leader>R replace all | |
nnoremap <silent> <leader>R viw:call EscapedSearch()<CR>:call CmdLine("%s".'/'.@/.'/'.@/)<CR> | |
vnoremap <silent> <leader>R :call EscapedSearch()<CR>:call CmdLine("%s".'/'.@/.'/'.@/)<CR> | |
function! EscapedSearch() range | |
" Backup what's in default register | |
let l:saved_reg = @" | |
" Copy selection | |
execute 'normal! vgvy' | |
" Escape special chars | |
let l:pattern = escape(@", "\\/.*'$^~[]") | |
let l:pattern = substitute(l:pattern, "\n$", "", "") | |
" Set search | |
let @/ = l:pattern | |
" Restore default register | |
let @" = l:saved_reg | |
endfunction | |
function! CmdLine(str) | |
call feedkeys(":" . a:str) | |
endfunction | |
" Copy all search matches | |
function! CopyMatches(reg) | |
let hits = [] | |
%s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/gne | |
let reg = empty(a:reg) ? '+' : a:reg | |
execute 'let @'.reg.' = join(hits, "\n") . "\n"' | |
endfunction | |
command! -register CopyMatches call CopyMatches(<q-reg>) | |
" Display registers | |
nnoremap <localleader>r :registers<cr> | |
" spanish keyboard | |
nnoremap ñ / | |
""""""""""""""""""""""""""""""""""" | |
" Appereance / GUI | |
""""""""""""""""""""""""""""""""""" | |
colorscheme desert | |
" wrap/unwrap | |
nnoremap <leader>gw :set wrap<CR> | |
nnoremap <leader>gW :set wrap!<CR> | |
" Set extra options when running in GUI mode | |
if has("gui_running") | |
set guioptions-=m "remove menu bar | |
set guioptions-=T "remove toolbar | |
" Good fonts: source code pro, jetbrains mono, consolas, cascadia | |
" select with: set guifont=* | |
" check current with: :echo &guifont | |
set guifont=CascadiaCode-Regular:h13 | |
" set guifont=Cascadia_Code_SemiBold:h10:W600:cANSI:qDRAFT | |
" in windows, set render option for ligatures <> != >= <= | |
if (has('win32') || has('win64')) | |
set renderoptions=type:directx | |
endif | |
else | |
" Cursor in terminal | |
" https://vim.fandom.com/wiki/Configuring_the_cursor | |
" 1 or 0 -> blinking block | |
" 2 solid block | |
" 3 -> blinking underscore | |
" 4 solid underscore | |
" Recent versions of xterm (282 or above) also support | |
" 5 -> blinking vertical bar | |
" 6 -> solid vertical bar | |
if &term =~ '^xterm' | |
" normal mode | |
let &t_EI .= "\<Esc>[3 q" | |
" insert mode | |
let &t_SI .= "\<Esc>[6 q" | |
endif | |
endif | |
" Run maximized in GUI | |
if ((has('win32') || has('win64')) && has("gui_running")) | |
set lines=999 columns=999 | |
autocmd GUIEnter * simalt ~x " https://vim.fandom.com/wiki/Maximize_or_set_initial_window_size | |
endif | |
" save dialog | |
function! SaveAsNative() | |
browse confirm saveas | |
endfunction | |
command! SaveAsNative :call SaveAsNative() | |
" Open finder/explorer | |
if (has('win32') || has('win64')) | |
nnoremap <leader>e :!start explorer /e,%:p:h<CR> | |
nnoremap <leader>E :execute "!start explorer /e," . shellescape(getcwd(),1)<CR> | |
endif | |
if(has('unix')) | |
if(has('macunix')) | |
nnoremap <leader>e :silent execute '![ -f "%:p" ] && open -R "%:p" \|\| open "%:p:h"'<CR> | |
nnoremap <leader>E :!open .<CR> | |
else | |
nnoremap <leader>e :execute '!explorer.exe `wslpath -w ' . expand('%:p:h'). '`'<CR> | |
nnoremap <leader>E :!explorer.exe .<CR> | |
endif | |
endif | |
""""""""""""""""""""""""""""""""""" | |
" Neovim | |
""""""""""""""""""""""""""""""""""" | |
if (has("nvim")) | |
" Shows the effects of a command incrementally, as you type. | |
set inccommand=nosplit | |
" Fixes copying special chars | |
lang en_US | |
endif | |
""""""""""""""""""""""""" | |
" File Explorer Netrw | |
""""""""""""""""""""""""" | |
let g:netrw_altfile = 1 " Don't register netrw as the alternate buffer | |
noremap <F4> :Explore<CR> | |
" Change dir to current path | |
command! ChangeDir :cd %:p:h<CR> | |
"""""""""""""" | |
" File names | |
"""""""""""""" | |
" Expand %% to current dir in command line | |
cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR> | |
" Expand ^^ to current file path in command line | |
cnoremap ^^ <C-R>=fnameescape(expand("%:p"))<CR> | |
" Expand && to only file name (tail) | |
cnoremap && <C-R>=fnameescape(expand("%:t"))<CR> | |
" Insert filename | |
nnoremap <localleader>fn i<C-R>=expand("%:t:r")<CR><ESC> | |
inoremap <localleader>fn <C-R>=expand("%:t:r")<CR> | |
"""""""""""""" | |
" Movement | |
"""""""""""""" | |
" Move while in insert mode | |
" inoremap <C-h> <left> | |
" inoremap <C-l> <right> | |
" inoremap <C-j> <down> | |
" inoremap <C-k> <up> | |
" Lines | |
nnoremap <C-l> g_ | |
vnoremap <C-l> g_ | |
nnoremap <C-h> ^ | |
vnoremap <C-h> ^ | |
" Buffers | |
nnoremap <C-j> :bn<CR> | |
nnoremap <C-k> :bp<CR> | |
" Alternate buffer | |
nnoremap <leader>k :b#<CR> | |
" Tabs | |
nnoremap <leader>tt :tabnew<CR> | |
nnoremap <leader>tc :tabclose<CR> | |
nnoremap ]t :tabnext<CR> | |
nnoremap [t :tabprevious<CR> | |
" Go to end of page and center | |
nnoremap G Gzz | |
"""""""""""""""""""""""""""""""""""""""" | |
" Saving, closing | |
"""""""""""""""""""""""""""""""""""""""" | |
nnoremap <leader>q :bd<CR> | |
nnoremap <leader>Q :bd!<CR> | |
nnoremap <leader>gq :qa!<CR> | |
nnoremap <leader>w :w!<CR> | |
nnoremap <leader>o :only<CR> | |
nnoremap <leader>bd :%bd<CR> | |
""""""""""""""""""" | |
" Splits | |
""""""""""""""""""" | |
nnoremap <leader><up> :resize -5<CR> | |
nnoremap <leader><down> :resize +5<CR> | |
nnoremap <leader><left> :vertical resize -5<CR> | |
nnoremap <leader><right> :vertical resize +5<CR> | |
"""""""""""""""""""""""""""" | |
" Visual Shortcuts | |
"""""""""""""""""""""""""""" | |
" Visual line | |
nnoremap <leader>l _vg_ | |
" Visual document | |
nnoremap <leader>a ggVG | |
" Move lines in visual mode | |
vnoremap N :m '>+1<CR>gv=gv | |
vnoremap P :m '<-2<CR>gv=gv | |
" J K just move | |
vnoremap J j | |
vnoremap K k | |
""""""""""""""""""""""""" | |
" Quick fix | |
""""""""""""""""""""""""" | |
nnoremap [c :cprevious<cr> | |
nnoremap ]c :cnext<cr> | |
nnoremap <leader>co :copen<CR>; | |
nnoremap <leader>cc :cclose<CR>; | |
""""""""""""""""""""""""" | |
" Macros | |
""""""""""""""""""""""""" | |
" Execute macro q | |
nnoremap Q @q | |
" Execute macro q on visual selection | |
vnoremap Q :normal @q<CR> | |
"""""""""""""""""""" | |
" Editor Utils | |
"""""""""""""""""""" | |
" Delete all registers | |
command! WipeReg for i in range(34,122) | silent! call setreg(nr2char(i), []) | endfor | |
" Duplicate File | |
function! s:duplicate(name) | |
if a:name != '' | |
execute "w %:h/" . a:name | |
execute "e %:h/" . a:name | |
endif | |
endfunction | |
:command! -nargs=1 -bar Duplicate :call s:duplicate(<f-args>) | |
""""""""""""""""""""""""" | |
" Code formatting | |
""""""""""""""""""""""""" | |
" Indent all document | |
nnoremap == gg=G | |
" Delete blank lines | |
:command! DeleteBlankLines g/^\s*$/d | |
" Replace multiple blank lines for single line | |
function! DoubleBlankLinesRemove(...) | |
let save_pos = getpos(".") | |
silent! %s/\(\n\n\)\n\+/\1/e | |
nohlsearch | |
call setpos('.', save_pos) | |
endfunction | |
command! DoubleBlankLinesRemove :call DoubleBlankLinesRemove() | |
" Replace multiple horizontal spacing to single space | |
function! DoubleSpacesRemove(...) | |
let save_pos = getpos(".") | |
silent! %s/\S\zs \+/ /e | |
nohlsearch | |
call setpos('.', save_pos) | |
endfunction | |
command! DoubleSpacesRemove :call DoubleSpacesRemove() | |
" Delete trailing white space | |
function! DeleteTrailingWhiteSpace(...) | |
let save_pos = getpos(".") | |
silent! %s/\s\+$//e | |
call setpos('.', save_pos) | |
endfunction | |
command! DeleteTrailingWhiteSpace :call DeleteTrailingWhiteSpace() | |
" Clean bad spaces | |
command! SpacesClean :call DeleteTrailingWhiteSpace() | call DoubleSpacesRemove() | call DoubleBlankLinesRemove() | |
""""""""""""""""""""""""""""""""""" | |
" Filetypes | |
""""""""""""""""""""""""""""""""""" | |
augroup filetypes | |
autocmd! | |
" PHP | |
autocmd BufReadPost *.php setlocal iskeyword-=- | |
" Blade filetype | |
autocmd BufRead,BufNewFile *.blade.php set filetype=blade | |
autocmd BufReadPost *.blade.php setlocal iskeyword+=-,$ | |
" Txt as markdown | |
autocmd BufReadPost *.txt set filetype=markdown | |
" Html | |
autocmd BufRead,BufNewFile {*.html,*.css,*.scss} setlocal iskeyword+=#,-,$ | |
autocmd BufRead,BufNewFile *.html setlocal formatprg=prettier\ --parser=html\ --print-width=999 | |
" Css | |
autocmd BufRead,BufNewFile *.css setlocal iskeyword+=#,- | |
" Scss | |
autocmd BufRead,BufNewFile *.scss setlocal iskeyword+=#,-,$ | |
augroup END | |
""""""""""""""""""""""""""""""""""" | |
" Utils | |
""""""""""""""""""""""""""""""""""" | |
" Date | |
nnoremap <localleader>dd i<c-r>=strftime("%Y-%m-%d")<CR><esc> | |
inoremap <localleader>dd <c-r>=strftime("%Y-%m-%d")<CR><esc> | |
" Underline | |
nnoremap <leader>- "zyy"zpVr-o<esc> | |
nnoremap <leader>= "zyy"zpVr=o<esc> | |
" Append colon and semicolon | |
nnoremap <leader>, A,<ESC> | |
nnoremap <leader>; A;<ESC> | |
""""""""""""""""""""""""""""""""""" | |
" Share via paste.rs | |
" | |
" Visual select and :Share | |
" | |
" Add .extension to url to format code | |
" Example: .markdown | |
""""""""""""""""""""""""""""""""" | |
function! s:share() range | |
let n = @n | |
silent! normal gv"ny | |
let out = system("echo '" . @n . "' | curl --silent --data-binary @- https://paste.rs") | |
let @n = n | |
normal `> | |
put ='' | |
put ='Share:' | |
put =out | |
" also copy to clipboard? | |
let @+ = out | |
endfunction | |
command! -range Share :call s:share()<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""""""""""""""""""""""""""" | |
" Format Style | |
" https://stylelint.io/user-guide/cli | |
"""""""""""""""""""""""""""" | |
fun! FmtStyle() | |
let save_pos = getpos(".") | |
silent write | |
call xolox#misc#os#exec({'command':'prettier --write --tab-width=2 '.expand('%:.').' stylelint --fix '.expand('%:.'),'async':0,'check':0}) | |
silent edit | |
call setpos('.', save_pos) | |
echo "Formatted with prettier & stylelint" | |
endfun | |
:command! FmtStyle :call FmtStyle() | |
" Enable / disable | |
:command! FmtStyleAutoDisable :autocmd! BufWritePre *.scss | |
:command! FmtStyleAuto :autocmd BufWritePre *.scss :call FmtStyle() | |
" Enabled by default | |
" :FmtStyleAutoDisable | |
" :FmtStyleAuto | |
" mapping | |
nmap <leader>fs :FmtStyle<CR> | |
""""""""""""""""""""""""""" | |
" Format js | |
""""""""""""""""""""""""""" | |
" No se usa prettier directamente porque eslint no hace fixes usando --stdin igual que prettier | |
fun! FmtJs() | |
let save_pos = getpos(".") | |
silent write | |
call xolox#misc#os#exec({'command':'prettier --write --print-width=99 --single-quote=true --trailing-comma=es5 --tab-width=2 '.expand('%:.').' && eslint --fix'.expand('%:.'),'async':0,'check':0}) | |
silent edit | |
call setpos('.', save_pos) | |
echo "Formated with prettier, eslint" | |
endfun | |
:command! FmtJs :call FmtJs() | |
" Enable / disable | |
:command! FmtJsAutoDisable :autocmd! BufWritePre *.js | |
:command! FmtJsAuto :autocmd BufWritePre *.js :call FmtJs() | |
" Enabled by default | |
" :FmtJsAutoDisable | |
" :FmtJsAuto | |
" mapping | |
nnoremap <leader>fj :FmtJs<CR> | |
""""""""""""""""""""""""""" | |
" Format html | |
""""""""""""""""""""""""""" | |
fun! FmtHtml() | |
" https://prettier.io/docs/en/options.html | |
" silent! %! prettier --stdin --parser=html --print-width=999 | |
let save_pos = getpos(".") | |
silent write | |
call xolox#misc#os#exec({'command':'prettier --write --print-width=999 '.expand('%:.'),'async':0,'check':0}) | |
silent edit | |
call setpos('.', save_pos) | |
echo "Format HTML with prettier ok" | |
endfun | |
:command! FmtHtml :call FmtHtml() | |
" Enable / disable | |
:command! FmtHtmlAutoDisable :autocmd! BufWritePre *.html | |
:command! FmtHtmlAuto :autocmd BufWritePre *.html :call FmtHtml() | |
" Enabled by default | |
" :FmtHtmlAutoDisable | |
" :FmtHtmlAuto | |
" mapping | |
nnoremap <leader>fh :FmtHtml<CR> | |
""""""""""""""""""""""""""" | |
" Format php | |
"""""""""""""""""""""""""""" | |
" https://github.com/FriendsOfPhp/PHP-CS-Fixer | |
" https://mlocati.github.io/php-cs-fixer-configurator/#version:2.16 | |
" Laravel style: | |
" curl https://gist.githubusercontent.com/laravel-shift/cab527923ed2a109dda047b97d53c200/raw/1db6b058ee3672ebd1a88bac9d8182aed449eb05/.php_cs.laravel.php -o .php_cs.dist | |
" let l:command= l:command . ' && phpcbf --standard=PSR2 -q '.expand('%') | |
" let l:command='php-cs-fixer fix '.expand('%') | |
if (has('unix')) | |
fun! FmtPhp(...) | |
call DeleteTrailingWhiteSpace() | |
call DoubleSpacesRemove() | |
call DoubleBlankLinesRemove() | |
silent write | |
let save_pos = getpos(".") | |
silent !prettier --write % && php-cs-fixer fix % | |
silent edit | |
call setpos('.', save_pos) | |
endfun | |
:command! FmtPhp :call FmtPhp() | |
" Enable / disable | |
:command! FmtPhpAutoDisable :autocmd! BufWritePre *.php | |
:command! FmtPhpAuto :autocmd BufWritePre *.php if &ft!="blade" | :call FmtPhp() | |
endif | |
" mapping | |
nnoremap <leader>fp :FmtPhp<CR> | |
""""""""""""""""""""""""""" | |
" Format blade | |
""""""""""""""""""""""""""" | |
fun! FmtBlade(...) | |
silent write | |
" silent! !blade-formatter --write % | |
call xolox#misc#os#exec({'command':'blade-formatter --write --indent-size=2 --wrap=999 '.expand('%:.'),'async':0,'check':0}) | |
silent edit | |
echo "FormatBlade ok" | |
endfun | |
:command! FmtBlade :call FmtBlade() | |
" Enable / disable | |
:command! FmtBladeAutoDisable :autocmd! BufWritePre *.blade.php | |
:command! FmtBladeAuto :autocmd BufWritePre *.blade.php :call FmtBlade() | |
" Enabled by default | |
" :FmtBladeAutoDisable | |
" :FmtBladeAuto | |
" mapping | |
nnoremap <leader>fb :FmtBlade<CR> | |
""""""""""""""""""""""""" | |
" Format functions | |
""""""""""""""""""""""""" | |
fun! FormatDocument() | |
if(&ft == 'blade') | |
SpacesClean | |
% !blade-formatter --stdin --indent-size=2 --wrap=999 | |
else | |
PrettierAsync | |
endif | |
endfun | |
nnoremap <leader>ff :call FormatDocument()<Cr> | |
""""""""""""""""""""""""" | |
" Edit Vimrc | |
""""""""""""""""""""""""" | |
:command! Vrc :e $HOME/scripts/.vimrc | e $HOME/scripts/.vimrcplugins | e $HOME/scripts/.vimrcextra | |
:command! Rcedit :edit $HOME/scripts/.commonrc | |
if ((has('win32') || has('win64')) && has("gui_running")) | |
:command! VrcReload :source $HOME/_vimrc | |
else | |
:command! VrcReload :source $HOME/.vimrc | |
endif | |
""""""""""""""""""" | |
" CSS | |
""""""""""""""""""" | |
" go class | |
nnoremap <localleader>c 0?class<cr>2f":noh<cr> | |
" tc To BEM Class | |
nnoremap <leader>tb I&__<ESC>A{}<ESC> | |
fun! s:extractBem() | |
" clean | |
let @a='' | |
" extract | |
g/__[a-z-]*/y A | |
" new file | |
e temp | |
" paste | |
normal "aP | |
" substitute everthing outside capture group and add $ and {} | |
%s/.*\(__[a-z-]*\).*/\&\1{}/g | |
" yank all | |
normal ggyG | |
" no highlight | |
:nohlsearch | |
" exit | |
bd! | |
" echo | |
" echo 'copied to clipboard' | |
endfun | |
:command! ExtractBem :call s:extractBem() | |
""""""""""""""""""""" | |
" TimeDifference | |
" | |
" Calculate time difference between dates in the same day | |
" Select two lines with time stamps and execute :TimeDifference | |
" | |
" Example: | |
" 03:42:53 | |
" 08:13:18 | |
" 4 hrs 30 min 25 sec | |
" | |
""""""""""""""""""""" | |
function! GetTimeDifference(line1,line2) | |
" Split in : | |
let l:t1List = split( getline(a:line1), ":" ) | |
let l:t2List = split( getline(a:line2), ":" ) | |
" Difference in seconds | |
let l:diffSec = abs( (l:t1List[0] * 3600 + l:t1List[1] * 60 + l:t1List[2]) - (l:t2List[0] * 3600 + l:t2List[1] * 60 + l:t2List[2]) ) | |
let l:sec=trunc(fmod(l:diffSec,60)) | |
let l:min=trunc(fmod(l:diffSec,3600) / 60) " 60x60 | |
let l:hrs=trunc(l:diffSec / 3600) | |
" Append result below line 2 | |
call append(a:line2, printf("%.0f hrs %.0f min %.0f sec", l:hrs,l:min,l:sec)) | |
endfunction | |
" Command TimeDifference | |
command! -range TimeDifference :call GetTimeDifference(<line1>,<line2>) | |
"""""""""""""""""""""" | |
" Extract images | |
"""""""""""""""""""""" | |
command! -nargs=1 ExtractImagesFromUrl :r!curl -s <args> | grep -shoP 'http[^" ]+(jpg|png)' | |
"""""""""""""""""""""""""""""""""" | |
" Markdown | |
"""""""""""""""""""""""""""""""""" | |
" Search for hours | |
" set hlsearch | |
" command! SearchHours1 /\d\+\.\d\+h | |
:command! HoursSearch /\d*\.*\d\+h | |
"""""""""""""""""""""""""""""""" | |
" Css convert to rem: | |
"""""""""""""""""""""""""""""""" | |
command! Pxtorem s#\v(\d+)px#\=string(submatch(1)/16.0)."rem" | |
command! Pxtoremglobal %s#\v(\d+)px#\=string(submatch(1)/16.0)."rem" | |
"""""""""""" | |
" Macros " | |
"""""""""""" | |
" PHP construct args to class attributes | |
command! PhpConstructorArgsProcess delmarks z | exec('norm mzlywOpublic $pa;`zjo$this->pa=$pa;`z') | |
"""""""""""""""""""" | |
" CSS Dictionaries | |
"""""""""""""""""""" | |
fun! DictionaryDistStylesApp() | |
!grep '{' dist/styles/app.css | sed 's/\.//g; s/{//g; s/}//g; s/\\//g' | sort -u > .cssdict | |
set dictionary+=.cssdict | |
endfun | |
command! DictionaryDistStylesApp :call DictionaryDistStylesApp() | |
" Generate Boostrap dictionary: | |
" ctags -R --fields=+aimlS --languages=css --exclude=node_modules -f - | cut -f1 | uniq | sed 's/\.//' > ~/.vim/dict/bootstrap | |
" Download boostrap and generate classes: | |
" curl -s https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.css | egrep '{' | egrep -o '\.[a-z0-9:-]+' | sed 's/\.//g' | sort -u > ~/.vim/dict/bootstrap4 | |
:command! DictBoostrap4 :set dictionary+=~/.vim/dict/bootstrap4 | |
:command! DictBoostrap4Remove :set dictionary-=~/.vim/dict/bootstrap4 | |
""""""""""""""" | |
" PHP | |
""""""""""""""" | |
:command! Lararoutes 0,$d | read !php artisan route:list | |
:command! -nargs=1 Lararoutegrep read !php artisan route:list | grep <args> | |
:command! LaravelRouteResourceExplicit :normal 0iroute::WWyiwg;a"viwguea('WWWWyiWg;Pla,'WWWWWWWWyiWg;Pf)a->name('WWWWWWyiWg;Pf)a;lD | |
:command! CommentsHtmlToLaravel :%s/<!--\(.*\)-->/{{-- \1 --}} | |
function! PhpEchoToBlade() | |
s/<?php echo/{{ | |
s/?>/}} | |
endfunction | |
command! PhpEchoToBlade :call PhpEchoToBlade() | |
""""""""""""""" | |
" html | |
""""""""""""""" | |
" go to class | |
nnoremap \c ?class<CR>2f":noh<CR> | |
""""""""""""""" | |
" Query execution to mysql | |
""""""""""""""" | |
function! Query() | |
" Copy query | |
0,$ y | |
" Remove previous splits | |
silent only | |
" Open a split with query results | |
split query-results | |
" Delete to blackhole | |
0,$ delete _ | |
" Put query | |
put | |
" Send to mysql ( set credentials in ~/.my.cnf ) | |
" [client] | |
" user=dev | |
" password=asdf | |
silent%! mysql | |
" Make pretty columns | |
Tabularize /\t | |
endfunction | |
:command! Query :call Query() | |
""""""""""""""" | |
" Json | |
""""""""""""""" | |
" JsonGet the-url-here | |
:command! -nargs=1 JsonGet read! curl --silent <args> | jq | |
""""""""""""""" | |
" Tailwind | |
""""""""""""""" | |
:command! TailwindOnTheRight :vsplit | vertical resize 40 | e tailwind.config.js | norm <c-w>h<cr> | |
""""""""""""""""""""""""" | |
" Share code via paste.rs | |
""""""""""""""""""""""""" | |
" command Sharecode '<,'>:w !curl --data-binary @- https://paste.rs/ | |
" get a message: | |
" :w !curl --data-binary @- https://paste.rs/ | |
" lines replaced: | |
" !curl --silent --data-binary @- https://paste.rs | |
""""""""""""""""""""""""" | |
" Open script | |
""""""""""""""""""""""""" | |
:command! Scripts Files ~/scripts | |
" Generate password | |
noremap <localleader>p :r!pwgen -sN 1 40<cr> | |
inoremap <localleader>p <esc>:r!pwgen -sN 1 40<cr>i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Download vim-plug if not exists | |
if !filereadable($HOME."/.vim/autoload/plug.vim") | |
!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
endif | |
" Create plugged dir if not exists | |
if !isdirectory($HOME."/.vim/plugged") | |
call mkdir($HOME."/.vim/plugged","p") | |
endif | |
" set runtimepath to use .vim folder instead of vimfiles | |
set rtp+=$HOME/.vim | |
call plug#begin('$HOME/.vim/plugged') | |
" surround with ys | |
Plug 'tpope/vim-surround' | |
" Create html tag | |
" nmap <localleader>t yslt | |
" imap <localleader>t <C-o>yslt | |
" Better repeating | |
Plug 'tpope/vim-repeat' | |
" Comment with gc / gcc | |
Plug 'tomtom/tcomment_vim' | |
" Git Fugitive | |
Plug 'tpope/vim-fugitive' | |
nnoremap <leader>gs :Gstatus<cr> | |
nnoremap <leader>ga :Git add -A<cr> | |
nnoremap <leader>gl :Git log<cr> | |
nnoremap <leader>gp :Gpush<cr> | |
" git diff | |
nnoremap <leader>gd :Gdiffsplit<cr> | |
" git merge left-right | |
nnoremap <leader>mh :diffget //2<cr> | |
nnoremap <leader>ml :diffget //3<cr> | |
" git commit browser :GV commits :GV commits for current file | |
Plug 'junegunn/gv.vim' | |
" Shows a git diff in the sign column. | |
Plug 'mhinz/vim-signify' | |
" Maximizes and restores the current window in Vim. | |
Plug 'szw/vim-maximizer' | |
nnoremap <leader>z :MaximizerToggle<CR> | |
vnoremap <leader>z :MaximizerToggle<CR>gv | |
" NerdTree | |
Plug 'scrooloose/nerdtree', { 'on': [ 'NERDTreeToggle', 'NERDTreeFind', 'NERDTreeCWD' ] } | |
let NERDTreeShowHidden=1 | |
nnoremap <F7> :NERDTreeToggle<CR> | |
nnoremap <F8> :NERDTreeFind<CR> | |
" Change current dir to current file | |
nnoremap <leader>cd :cd %:p:h<CR>:NERDTreeCWD<CR> | |
" Auto close brackets | |
Plug 'jiangmiao/auto-pairs' | |
let g:AutoPairsShortcutToggle='' | |
let g:AutoPairsMapCh=0 " don't map this one | |
" RipGrep :Rg | |
Plug 'jremmen/vim-ripgrep' | |
" Sessions | |
Plug 'romgrk/vim-session' | |
let g:session_autoload = 'no' | |
let g:session_autosave = 'yes' | |
let g:session_directory = $HOME."/.vim/sessions" | |
let g:session_extension = '' | |
" Create dir if not exists | |
if !isdirectory($HOME."/.vim/sessions") | |
call mkdir($HOME."/.vim/sessions","p") | |
endif | |
" Open session (project) | |
nnoremap <leader>s :OpenSession | |
" Highlight yank | |
Plug 'machakann/vim-highlightedyank' | |
" Status/tabline | |
Plug 'vim-airline/vim-airline' | |
let g:airline#extensions#tabline#enabled = 1 | |
" Show just the filename | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
" Show terminal buffers | |
let g:airline#extensions#tabline#ignore_bufadd_pat = 'defx|gundo|nerd_tree|startify|tagbar|undotree|vimfiler' | |
" Color | |
set background=dark | |
set termguicolors | |
" if terminal has 256 colors | |
if !has("gui_running") | |
let g:rehash256 = 1 | |
endif | |
" Mejores | |
Plug 'tomasr/molokai' | |
Plug 'joshdick/onedark.vim' | |
Plug 'drewtempelmeyer/palenight.vim' | |
" Buenos | |
Plug 'morhetz/gruvbox' | |
" Plug 'safv12/andromeda.vim' | |
" Useful commands | |
Plug 'tpope/vim-eunuch' | |
" :Delete: Delete a buffer and the file on disk simultaneously. | |
" :Unlink: Like :Delete, but keeps the now empty buffer. | |
" :Move: Rename a buffer and the file on disk simultaneously. | |
" :Rename: Like :Move, but relative to the current file's containing directory. | |
" :Chmod: Change the permissions of the current file. | |
" :Mkdir: Create a directory, defaulting to the parent of the current file. | |
" :Cfind: Run find and load the results into the quickfix list. | |
" :Clocate: Run locate and load the results into the quickfix list. | |
" :Lfind/:Llocate: Like above, but use the location list. | |
" :Wall: Write every open window. Handy for kicking off tools like guard. | |
" :SudoWrite: Write a privileged file with sudo. | |
" :SudoEdit: Edit a privileged file with sudo. | |
" File type detection for sudo -e is based on original file name. | |
" New files created with a shebang line are automatically made executable. | |
" New init scripts are automatically prepopulated with /etc/init.d/skeleton. | |
" Treesitter | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update | |
" Language syntax | |
Plug 'sheerun/vim-polyglot' | |
let g:vim_markdown_new_list_item_indent = 0 | |
" Blade syntax | |
" Plug 'jwalton512/vim-blade', { 'for': 'blade' } | |
" Improved integration between Vim and its environment | |
Plug 'xolox/vim-misc' | |
Plug 'xolox/vim-shell' | |
" the :Maximize command and <Control-F11> mapping toggle Vim between normal and maximized state: They show/hide Vim's menu bar, tool bar and/or tab line without hiding the operating system task bar. | |
" | |
" execute async functions with: | |
" call xolox#misc#os#exec({'command':'echo hola > ok.txt','async':1}) | |
" Calculate formulas | |
Plug 'sk1418/HowMuch' | |
let g:HowMuch_scale = 8 | |
vmap <leader>hm <Plug>AutoCalcAppendWithEq | |
vmap <leader>hms <Plug>AutoCalcAppendWithEqAndSum | |
vmap <leader>hmr <Plug>AutoCalcReplace | |
" FZF Fuzzy Finder | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
if executable('rg') | |
" Use RipGrep to list files for fzf, include dotfiles in current directory | |
let $FZF_DEFAULT_COMMAND='{ rg --files; find . -type f -name ".*" -depth 1 }' | |
nnoremap <C-p> :Files<CR> | |
else | |
" Open GIT files if is a git repo, otherwise, just list files | |
nnoremap <expr> <C-p> (len(system('git rev-parse')) ? ':Files' : ':GFiles --exclude-standard --others --cached')."\<cr>" | |
endif | |
" History files | |
noremap <leader>h :History<CR> | |
" Commands History | |
nnoremap <leader>: :History:<CR> | |
" All lines in all buffers | |
nnoremap <leader>j :Lines<CR> | |
" Find buffer | |
nnoremap <C-f> :Buffers<CR> | |
" fzf Appeareance | |
" let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.5 } } | |
" let g:fzf_preview_window = '' | |
" Align in | with :Tabularize /| | |
Plug 'godlygeek/tabular' | |
" Display markers " | |
Plug 'kshenoy/vim-signature' | |
" Css Color | |
Plug 'ap/vim-css-color', { 'for': [ 'css', 'scss' ] } | |
" Vue | |
" Plug 'posva/vim-vue', { 'for': ['vue' ] } | |
" Change case (casing) | |
Plug 'arthurxavierx/vim-caser' | |
" gsm/gsp MixedCase or PascalCase | |
" gsc camelCase | |
" gs_ snake_case | |
" gst Title Case | |
" gss Sentence case | |
" gs<space> space case | |
" gs- dash-case | |
" gs. dot.case | |
"""""""""""""""""""""""""""""""""""""""""" | |
" Markdown | |
"""""""""""""""""""""""""""""""""""""""""" | |
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } | |
"""""""""""""""""""""""""""""""""""""""""" | |
" React / typescript | |
" https://thoughtbot.com/blog/modern-typescript-and-react-development-in-vim | |
"""""""""""""""""""""""""""""""""""""""""" | |
Plug 'pangloss/vim-javascript', { 'for': 'javascript' } | |
Plug 'leafgarland/typescript-vim', { 'for': 'javascript' } | |
Plug 'peitalin/vim-jsx-typescript', { 'for': 'javascript' } | |
Plug 'styled-components/vim-styled-components', { 'branch': 'main', 'for':'javascript' } | |
"""""""""""""""""""""""""""""""""""""""""" | |
" Codi REPL tinker | |
" https://github.com/metakirby5/codi.vim | |
"""""""""""""""""""""""""""""""""""""""""" | |
" Plug 'metakirby5/codi.vim' | |
"""""""""""""""""""""""""""""""""""""""""" | |
" Prettier | |
" https://github.com/prettier/vim-prettier | |
"""""""""""""""""""""""""""""""""""""""""" | |
Plug 'prettier/vim-prettier', { | |
\ 'do': 'yarn install', | |
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html', 'php'] } | |
let g:prettier#exec_cmd_path = "/usr/local/bin/prettier" | |
"""""""""""""""""""""""""""""""""""""""""" | |
" vim-sendtowindow | |
" https://github.com/karoliskoncevicius/vim-sendtowindow | |
"""""""""""""""""""""""""""""""""""""""""" | |
Plug 'karoliskoncevicius/vim-sendtowindow' | |
let g:sendtowindow_use_defaults=0 | |
" nmap L <Plug>SendRight | |
" xmap L <Plug>SendRightV | |
" nmap H <Plug>SendLeft | |
" xmap H <Plug>SendLeftV | |
" nmap K <Plug>SendUp | |
" xmap K <Plug>SendUpV | |
nmap <localleader>t <Plug>SendDown | |
xmap <localleader>t <Plug>SendDownV | |
"""""""""""""""""""""""""""""""""""""""""" | |
" CoC Code Completion | |
" https://github.com/neoclide/coc.nvim | |
"""""""""""""""""""""""""""""""""""""""""" | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
let g:coc_filetype_map = { | |
\ 'blade.php': 'blade', | |
\ } | |
" " Install if not installed | |
" let g:coc_global_extensions = [ | |
" \ 'coc-snippets', | |
" \ 'coc-dictionary', | |
" \ 'coc-html', | |
" \ 'coc-css' , | |
" \ 'coc-tsserver', | |
" \ 'coc-json', | |
" \ 'coc-eslint', | |
" \ 'coc-yaml', | |
" \ 'coc-vetur' | |
" \ ] | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=50 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time diagnostics appear/become resolved. | |
set signcolumn=yes | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? coc#_select_confirm() : | |
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
let g:coc_snippet_next = '<c-j>' | |
let g:coc_snippet_prev = '<c-k>' | |
" Use <C-j> for both expand and jump (make expand higher priority.) | |
imap <C-j> <Plug>(coc-snippets-expand-jump) | |
" Use <leader>x for convert visual selected code to snippet | |
" xmap <leader>x <Plug>(coc-convert-snippet) | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current | |
" position. Coc only does snippet and additional edit on confirm. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
else | |
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
" navigate diagnostics `[g` and `]g` | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" GoTo code navigation. | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gr <Plug>(coc-references) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
" nmap <silent> gi <Plug>(coc-implementation) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
augroup cursor | |
autocmd! | |
" Highlight the symbol and its references when holding the cursor. | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
augroup END | |
" Symbol renaming. | |
nmap <leader>crn <Plug>(coc-rename) | |
" Range format like <leader>fip | |
vmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
" augroup mygroup | |
" autocmd! | |
" Setup formatexpr specified filetype(s). | |
" autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder. | |
" autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
" augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>ca <Plug>(coc-codeaction-selected) | |
nmap <leader>ca <Plug>(coc-codeaction-selected) | |
" Remap keys for applying codeAction to the current line. | |
" nmap <leader>ac <Plug>(coc-codeaction) | |
" " Apply AutoFix to problem on the current line. | |
nnoremap <leader>cf <Plug>(coc-fix-current) | |
" Introduce function text object | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
" xmap if <Plug>(coc-funcobj-i) | |
" xmap af <Plug>(coc-funcobj-a) | |
" omap if <Plug>(coc-funcobj-i) | |
" omap af <Plug>(coc-funcobj-a) | |
" Use <TAB> for selections ranges. | |
" NOTE: Requires 'textDocument/selectionRange' support from the language server. | |
" coc-tsserver, coc-python are the examples of servers that support it. | |
" nmap <silent> <TAB> <Plug>(coc-range-select) | |
" xmap <silent> <TAB> <Plug>(coc-range-select) | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Mappings using CoCList: | |
" Show all diagnostics. | |
" nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions. | |
" nnoremap <silent> <space>e :<C-u>CocList extensions<cr> | |
" Show commands. | |
" nnoremap <silent> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document. | |
" nnoremap <silent> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols. | |
" nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
" nnoremap <silent> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
" nnoremap <silent> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list. | |
" nnoremap <silent> <space>p :<C-u>CocListResume<CR> | |
" | |
"""""""""""""""""""""""""""" | |
" Coc snippets | |
" https://github.com/neoclide/coc-snippets | |
"""""""""""""""""""""""""""" | |
" Use <C-l> for trigger snippet expand. | |
" imap <C-l> <Plug>(coc-snippets-expand) | |
" Use <C-j> for select text for visual placeholder of snippet. | |
" vmap <C-j> <Plug>(coc-snippets-select) | |
" Use <C-j> for jump to next placeholder, it's default of coc.nvim | |
let g:coc_snippet_next = '<c-n>' | |
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim | |
let g:coc_snippet_prev = '<c-p>' | |
" Use <C-j> for both expand and jump (make expand higher priority.) | |
" imap <C-j> <Plug>(coc-snippets-expand-jump) | |
" Edit snippets | |
nnoremap <leader>u :CocCommand snippets.editSnippets<CR> | |
" Add to CocConfig | |
" { | |
" 'snippets': { | |
" 'userSnippetsDirectory': '~/scripts/vim/ultisnips' | |
" }, | |
" 'languageserver': { | |
" 'intelephense': { | |
" 'command': 'intelephense', | |
" 'args': ['--stdio'], | |
" 'filetypes': ['php'], | |
" 'initializationOptions': { | |
" 'storagePath': '/tmp/intelephense' | |
" } | |
" } | |
" }, | |
" 'stylelint.enable': true, | |
" 'stylelint.config': '~/.stylelint' | |
" } | |
" | |
call plug#end() | |
" After loading plugins | |
colorscheme onedark | |
" colorscheme palenight | |
" colorscheme molokai | |
" Better cursor highlighting | |
hi Search cterm=NONE ctermfg=255 guifg=#eeeeee ctermbg=88 guibg=#870000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"languageserver": { | |
"intelephense": { | |
"command": "intelephense", | |
"args": ["--stdio"], | |
"filetypes": ["php"], | |
"initializationOptions": { | |
"storagePath": "/tmp/intelephense" | |
} | |
} | |
}, | |
"snippets.userSnippetsDirectory": "~/scripts/vim/ultisnips", | |
"coc.preferences.formatOnType": true, | |
"coc.preferences.formatOnSaveFiletypes": ["php", "vue"], | |
"prettier.tabWidth": 2, | |
"prettier.trailingComma": "es5", | |
"prettier.singleQuote": true, | |
"prettier.eslintIntegration": true, | |
"vetur.format.defaultFormatter.html": "prettier", | |
"vetur.format.defaultFormatter.css": "prettier", | |
"vetur.format.defaultFormatter.js": "prettier-eslint", | |
"vetur.format.defaultFormatterOptions": { | |
"prettier": { | |
"singleQuote": true, | |
"trailingComma": "es5", | |
"tabWidth": 2 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment