Skip to content

Instantly share code, notes, and snippets.

@vinchi777
Created August 23, 2021 13:01
Show Gist options
  • Save vinchi777/0f84a1de0d953f8c228e6e270cba4144 to your computer and use it in GitHub Desktop.
Save vinchi777/0f84a1de0d953f8c228e6e270cba4144 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
" let Vundle manage Vundle, required
" Plug 'gmarik/Vundle.vim'
" Color schemes
"Plug 'phanviet/vim-monokai-pro'
"Plug 'liuchengxu/space-vim-dark'
"Plug 'dracula/vim'
"Plug 'morhetz/gruvbox'
"Plug 'chriskempson/base16-vim'
"Plug 'joshdick/onedark.vim'
"Plug 'flrnprz/candid.vim'
"Plug 'Rigellute/shades-of-purple.vim'
"Plug 'rakr/vim-one'
"Plug 'nightsense/strawberry'
"Plug 'ksevelyar/joker.vim'
Plug 'edkolev/tmuxline.vim'
"Plug 'nightsense/snow'
Plug 'arzg/vim-colors-xcode'
"Plug 'connorholyday/vim-snazzy'
"Plug 'folke/tokyonight.nvim'
"Plug 'NLKNguyen/papercolor-theme'
" Editor Extensions
"Plug 'SirVer/ultisnips'
Plug 'tpope/vim-rhubarb'
Plug 'mhinz/vim-startify'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jiangmiao/auto-pairs'
"Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
"Plug 'honza/vim-snippets'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'mileszs/ack.vim'
Plug 'slim-template/vim-slim'
Plug 'terryma/vim-multiple-cursors'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-ragtag'
Plug 'mg979/vim-xtabline'
"Plug 'sbdchd/neoformat'
"Plug 'shumphrey/fugitive-gitlab.vim'
"Plug 'leafgarland/typescript-vim'
Plug 'alvan/vim-closetag'
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'mhinz/vim-signify'
" Languages
Plug 'sheerun/vim-polyglot'
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'ryanoasis/vim-devicons'
"Plug 'posva/vim-vue'
call plug#end()
" map escape
imap jj <esc>
" map paste toggle
set pastetoggle=<F2>
" show line numbers
set number
" trailing whitespace
set listchars=tab:\ \ ,trail:~,extends:>
set list
"FUGITIVE
let g:loaded_keeppad = 20
" map nerdtree toggle
nmap 9i :NERDTreeToggle<CR>
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let NERDTreeMinimalUI=1
set splitright
" no swapfile
set noswapfile
" map autocompletion
inoremap <Nul> <C-n>
"auto copy to clipboard
"set clipboard=unnamedplus
"remove trailing whitespace
nnoremap <silent> dt :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
nnoremap <CR> :noh<CR><CR>
" INDENTING
autocmd BufNewFile,BufReadPost *.html.erb,*.html setl shiftwidth=2 expandtab
autocmd BufNewFile,BufReadPost *.vue,*.php setl shiftwidth=4 expandtab
autocmd BufNewFile,BufReadPost *.go setl shiftwidth=4 tabstop=4 noexpandtab
autocmd BufNewFile,BufReadPost *.js,*.ts,*.tsx setl shiftwidth=2 expandtab
autocmd BufNewFile,BufReadPost *.css,*.scss setl shiftwidth=2
autocmd FileType yaml setl shiftwidth=2 expandtab
" set filetypes as typescript.tsx
"autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescript.tsx
" vim-closetag
let g:closetag_filenames = '*.html,*.js,*.vue,*.html.erb,*.tsx'
" COC
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Golang
let g:go_info_mode='gopls'
let g:go_doc_keywordprg_enabled = 0
"autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
set signcolumn=yes
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gf <Plug>(coc-references)
nmap <leader> hf <Plug>(coc-float-hide)
inoremap <silent><expr> <c-space> coc#refresh()
" Use K to show documentation in preview window
nnoremap <silent>K :call CocAction('doHover')<CR>
" FORMATTING
nmap <leader>qf <Plug>(coc-fix-current)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=0 FormatJS :CocCommand eslint.executeAutofix
command! -nargs=0 FormatTS :CocCommand tslint.fixAllProblems
command! BufOnly silent! execute "%bd|e#|bd#"
"set shortmess+=c
"set cmdheight=2
" AIRLINE
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}'
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}'
"let g:airline_section_info = '%{airline#util#wrap(airline#extensions#coc#get_info(),0)}'
let g:airline_theme='xcodelight'
"let g:airline_theme='light' "atomic,owo,fruit_punch,violet,kolor
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#bufferline#enabled = 1
" airline curved corners
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" tmuxline curved corners
" needs edkolev/tmuxline.vim installed
let g:tmuxline_separators = {
\ 'left' : '',
\ 'left_alt': '>',
\ 'right' : '',
\ 'right_alt' : '<',
\ 'space' : ' '}
"XTABLINE
let g:xtabline_settings = get(g:, 'xtabline_settings', {})
let g:xtabline_settings.tabline_modes = ['buffers', 'tabs', 'arglist']
let g:xtabline_settings.tab_number_in_left_corner = 0
let g:xtabline_settings.show_right_corner = 0
set colorcolumn=80
"Ack
nmap <D-S-F> :Ack<space>
" use the silver searcher in Ack
let g:ackprg = 'ag --nogroup --nocolor --column'
" Startify
let g:startify_files_number = 4
let g:startify_padding_left = (&columns - (&columns/2)) - 30
let g:startify_enable_special = 1
let g:startify_change_to_dir = 0
autocmd User Startified setlocal buflisted
" Simplify the startify list to just recent files and sessions
let g:startify_lists = [
\ { 'type': 'dir', 'header': startify#pad(['Recent files']) },
\ { 'type': 'sessions', 'header': startify#pad(['Saved sessions']) },
\ ]
" Fancy custom header
let g:startify_custom_header = startify#center([
\ " ",
\ " ",
\ " ",
\ " ",
\ " ",
\ ' ╻ ╻ ╻ ┏┳┓',
\ ' ┃┏┛ ┃ ┃┃┃',
\ ' ┗┛ ╹ ╹ ╹',
\ ' ',
\ ' ',
\ ' ',
\ ])
" Customize fzf colors to match your color scheme
" 'hl': ['fg', 'PreProc'],
"\ 'hl': ['fg', 'PreProc'],
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Identifier'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Identifier'],
\ 'info': ['fg', 'Comment'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
let g:fzf_action = {
\ 'B': 'bd|e'}
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <C-l> :Buffers<CR>
nnoremap <C-s> :Ag
" Change Ag list color and show preview
autocmd VimEnter * command! -nargs=* Ag call fzf#vim#ag(<q-args>, '--color-path 400 --color-line-number 400', fzf#vim#with_preview())
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
set hidden
"BUFFERS
nnoremap qq :w\|bd<cr>
autocmd BufEnter *.png,*.jpg,*gif exec "! open ".expand("%") | :bw
" Buffer navigation
nmap gt :XTabNextBuffer<CR>
nmap gr :XTabPrevBuffer<CR>
" COLOR THEMES
"
set t_Co=256
set background=light
"set background=dark
if (has("termguicolors"))
set termguicolors
endif
syntax on "load polyglot language packs
syntax enable
"colorscheme base16-tomorrow
"colorscheme dracula
"colorscheme candid
"colorscheme monokai_pro
"colorscheme shades_of_purple
"colorscheme joker
"colorscheme onedark
"colorscheme one
"colorscheme strawberry-light
"colorscheme space-vim-dark
"colorscheme gruvbox
"colorscheme xcodelight
colorscheme xcodelightcustom
"colorscheme alien-moon-light
"colorscheme xcodelighthc
"colorscheme xcodedark
"colorscheme tokyonight
"colorscheme snazzy
"colorscheme PaperColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment