Skip to content

Instantly share code, notes, and snippets.

@scottshane
Last active March 16, 2021 21:49
Show Gist options
  • Save scottshane/9b58f63e1bba2454f8a98043ca3e56fe to your computer and use it in GitHub Desktop.
Save scottshane/9b58f63e1bba2454f8a98043ca3e56fe to your computer and use it in GitHub Desktop.
syntax on
call plug#begin()
" CSS --
Plug 'groenewege/vim-less'
" Plug 'skammer/vim-css-color'
Plug 'hail2u/vim-css3-syntax'
"Javascript
" Plug 'othree/javascript-libraries-syntax.vim'
" --Plug 'pangloss/vim-javascript'
" --Plug 'othree/yajs.vim'
"typesscript"
" Plug 'HerringtonDarkholme/yats.vim'
" Plug 'mhartington/nvim-typescript', {'build': './install.sh'}
"-- Plug 'leafgarland/typescript-vim'
"-- Plug 'peitalin/vim-jsx-typescript'
" Plug 'jelera/vim-javascript-syntax'
" Plug 'maxmellon/vim-jsx-pretty'
Plug 'sheerun/vim-polyglot'
" SCSS ---------------------------
Plug 'mlaursen/coc-scssmodules', {'do': 'npm install && npm run build'}
" COLORSCHEME ---------------------------
Plug 'mhartington/oceanic-next'
Plug 'arcticicestudio/nord-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Tim Pope ---------------------------
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-fugitive'
" The Primeagen ---------------------------
Plug 'mbbill/undotree'
" Help Vim do the right thing ----------------
"==BROKE AS F ---- Plug 'rstacruz/vim-closer'
Plug 'jiangmiao/auto-pairs'
" CoC ---------------------------
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Snippets ---------------------------
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
"
" Searching ---------------------------
Plug 'junegunn/fzf', {'do': {-> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'jremmen/vim-ripgrep'
call plug#end()
" always show signcolumns
set signcolumn=yes
let g:python3_host_prog = '/usr/local/bin/python3'
let g:user_emmet_leader_key='<c-e>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
""""""""""""""""""""""""""""""""""""""""""""""""""
" ColorScheme
"""""""""""""""""""""""""""""""""""""""""""""""""
" colorscheme OceanicNext
colorscheme nord
let g:airline_theme='nord'
let g:airline_powerline_fonts=1
""""""""""""""""""""""""""""""""""""""""""""""""""
" Coc
"""""""""""""""""""""""""""""""""""""""""""""""""
let g:coc_global_extensions = [
\ 'coc-emmet',
\ 'coc-css',
\ 'coc-scssmodules',
\ 'coc-html',
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-json',
\ ]
" prettier command for coc
command! -nargs=0 Prettier :CocCommand prettier.formatFile
""""""""""""""""""""""""""""""""""""""""""""""""""
" editor setup / config
""""""""""""""""""""""""""""""""""""""""""""""""""
set nowritebackup
set nobackup
set relativenumber
set hidden
set mouse=a
set noswapfile
set clipboard+=unnamedplus
set undofile
set undodir=~/.config/nvim/undo
set splitbelow
let mapleader=" "
" nnoremap <Space> <Nop>
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣
set nolist
autocmd FileType crontab setlocal nowritebackup
if (has("termguicolors"))
set termguicolors
endif
" inoremap {<CR> {<CR>}<C-o>O
""""""""""""""""""""""""""""""""""""""""""""""""""
" REMAPPING
" => MOTIONS
""""""""""""""""""""""""""""""""""""""""""""""""""
noremap j gj
noremap k gk
noremap gj j
noremap gk k
" Mimic termial motion in prompt
cnoremap <c-a> <home>
cnoremap <c-e> <end>a
" Easy window navigation
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
" => terminal
tnoremap <Esc> <C-\><C-n>
""""""""""""""""""""""""""""""""""""""""""""""""""
" => ESCAPE
""""""""""""""""""""""""""""""""""""""""""""""""""
inoremap jj <esc>
""""""""""""""""""""""""""""""""""""""""""""""""""
" => SEARCH
""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set nohlsearch
""""""""""""""""""""""""""""""""""""""""""""""""""
" => RG / GFIles / FZF
""""""""""""""""""""""""""""""""""""""""""""""""""
if executable('rg')
" let g:rg_command= 'rg --vimgrep -S'
let g:rg_derive_root='true'
endif
nnoremap <C-p> :GFiles<CR>
nnoremap <C-f> :Files<CR>
nnoremap <C-b> :Buffers<CR>
" Always enable preview window on the right with 60% width
let g:fzf_layout = { 'down':'~40%' }
let g:fzf_preview_window = 'right:60%'
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
""""""""""""""""""""""""""""""""""""""""""""""""""
" => INDENTS
""""""""""""""""""""""""""""""""""""""""""""""""""
set smartindent
set autoindent
""""""""""""""""""""""""""""""""""""""""""""""""""
" => TABS
""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
""""""""""""""""""""""""""""""""""""""""""""""""""
" => WILD MENU
""""""""""""""""""""""""""""""""""""""""""""""""""
set wildmode=longest:full,full
set wildmenu
""""""""""""""""""""""""""""""""""""""""
" FROM COC INSTALL
""""""""""""""""""""""""""""""""""""""""
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" 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.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> <leader>gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> g[ <Plug>(coc-diagnostic-prev)
nmap <silent> g] <Plug>(coc-diagnostic-next)
" use selected text in TM_SELECT type snippets
vmap <leader>s] <Plug>(coc-snippets-select)
"explorer
nmap <space>e :CocCommand explorer<CR>
" GoTo code navigation.
nmap <silent> <leader>rn <Plug>(coc-rename)
nnoremap <leader>cr :CocRestart
""""""""""""""""""""""""""""""""""""""""""""""""""
" => ENABLE CODE FOLDING
""""""""""""""""""""""""""""""""""""""""""""""""""
" set foldenable
" set foldmethod=manual
" set foldnestmax=10
" set foldlevel=1
augroup javascript_folding
au!
au FileType javascript setlocal foldmethod=manual
augroup END
" setlocal foldmethod=indent "syntax highlighting items specify folds
" setlocal foldcolumn=1 "defines 1 col at window left, to indicate folding
" let javascript_fold=1 "activate folding by JS syntax
""""""""""""""""""""""""""""""""""""""""""""""""""
" => EASY ALIGN
""""""""""""""""""""""""""""""""""""""""""""""""""
" Start interactive EasyAlign in visual mode (e.g. vipga)
" xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
" nmap ga <Plug>(EasyAlign)
""""""""""""""""""""""""""""""""""""""""""""""""""
" => NETRW
""""""""""""""""""""""""""""""""""""""""""""""""""
let g:netrw_liststyle=3
let g:netrw_browse_split=2
let g:netrw_altv=1
let g:netrw_winsize=30
""""""""""""""""""""""""""""""""""""""""""""""""""
" => UNDOTREE
""""""""""""""""""""""""""""""""""""""""""""""""""
cabbrev udt :UndotreeToggle
""""""""""""""""""""""""""""""""""""""""""""""""""
" => PRETTIER
""""""""""""""""""""""""""""""""""""""""""""""""""
" handled by Coc
""""""""""""""""""""""""""""""""""""""""""""""""""
" => Ultisnips
""""""""""""""""""""""""""""""""""""""""""""""""""
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
" let g:UltiSnipsExpandTrigger="<tab>"
" let g:UltiSnipsJumpForwardTrigger="<c-b>"
" let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"
" nnoremap <silent> <leader>gky <C-R>/[^\x00-\x7F]<CR>
nnoremap <leader>nac <C-R>?[^\x00-\x7F]
abbrev eini :e ~/.config/nvim/init.vim
cabbrev Finder :!open .
cabbrev Node !node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment