Skip to content

Instantly share code, notes, and snippets.

@DanaCase
Created July 31, 2020 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanaCase/cf86db38d91feceba7298555e5a64f20 to your computer and use it in GitHub Desktop.
Save DanaCase/cf86db38d91feceba7298555e5a64f20 to your computer and use it in GitHub Desktop.
nvim init file
"for allowing vundles
"set nocompatible
"filetype plugin indent on
"filetype plugin on
"syntax on
set backspace=2
if system('uname -s') == "Darwin\n"
set clipboard=unnamed "OSX
else
set clipboard=unnamedplus "Linux
endif
set t_Co=256
set background=dark
let g:solarized_temrcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="high"
let g:solarized_visibility="high"
set encoding=utf8
set guifont=Source\ Code\ Pro\ Light:h12
"let g:php_annotations_syntax=1
imap jj <ESC>
imap JJ <ESC>
imap jJ <ESC>
imap Jj <ESC>
" set auto indent and bind F9 to tun it off (when pasting)
" -- use = to automatically reindent
set autoindent
set smartindent
set pastetoggle=<F9>
au InsertLeave * set nopaste
" set soft tabs to 4 spaces in all cases
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
"show hidden files
let NERDTreeShowHidden=1
autocmd vimenter * NERDTree
"call ag instead of ack
if executable('ag')
let g:ackprg = 'ag --nogroup --nocolor --column'
endif
"lets you use the god damned mouse like a human
set mouse=a
"lets you specify local vimrc
"
"let g:local_vimrc = {'names':['.vimrc'],'hash_fun':'LVRHashOfFile'}
"When opening or creating a .vue file set the filetype to HTML for proper rendering
autocmd BufNewFile,BufRead *.vue set filetype=html
"autocmd BufNewFile,BufRead *.ts set filetype=typescript
"set runtimepath^=~/.vim/bundle/ctrlp.vim
call plug#begin('~/.vim/plugged')
Plug 'drewtempelmeyer/palenight.vim'
"Plug 'wookiehangover/jshint.vim'
Plug 'pangloss/vim-javascript'
"Plug 'othree/javascript-libraries-syntax.vim'
Plug 'mxw/vim-jsx'
Plug 'othree/html5.vim'
Plug 'mileszs/ack.vim'
Plug 'delimitMate.vim'
Plug 'qbbr/vim-symfony'
Plug 'vim-scripts/closetag.vim'
Plug 'mattn/emmet-vim'
"Plug 'gregsexton/matchtag'
Plug 'maksimr/vim-jsbeautify'
Plug 'chase/vim-ansible-yaml'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'ervandew/supertab'
"Plug 'SirVer/ultisnips'
"Plug 'honza/vim-snippets'
Plug 'mmozuras/snipmate-mocha'
Plug 'posva/vim-vue'
"Plug 'MarcWeber/vim-addon-local-vimrc'
Plug 'tpope/vim-fugitive'
"Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'lepture/vim-jinja'
Plug 'vimwiki/vimwiki'
Plug 'majutsushi/tagbar'
Plug 'vim-syntastic/syntastic'
Plug 'chriskempson/base16-vim'
Plug 'digitaltoad/vim-jade'
Plug 'Quramy/tsuquyomi'
Plug 'tpope/vim-markdown'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
"Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
"Plug 'jparise/vim-graphql'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'chrisbra/unicode.vim'
"npm install instant-markdown
"Plug 'suan/vim-instant-markdown'
"pip install instant-rst
Plug 'gu-fan/InstantRst'
Plug 'dearrrfish/vim-applescript'
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
call plug#end()
"COC settings
"inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <silent><expr> <C-space> coc#refresh()
"GoTo code navigation
nmap <leader>g <C-o>
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gt <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <leader>rn <Plug>(coc-rename)
"show all diagnostics.
nnoremap <silent> <space>d :<C-u>CocList diagnostics<cr>
"manage extensions.
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <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>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <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','')}
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint')
let g:coc_global_extensions += ['coc-eslint']
endif
" end COC settings
" vimwiki/vimwiki
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
let g:used_javascript_libs = 'jquery,underscore,angularjs,angularuirouter,react'
"Make YCM compatable with UltiSnips (using supertab)
"let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
"let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
"let g:SuperTabDefaultCompletionType = '<C-n>'
"Snippets config
"let g:UltiSnipsExpandTrigger="<tab>"
"let g:UltiSnipsJumpForwardTrigger="<tab>"
"let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
"let g:UltiSnipsSnippetDirectories=["UltiSnips"]
"Jinja comments
let g:NERDAltDelims_jinja = 1
"jsx comments
let g:NERDCustomDelimiters = { 'javascript.jsx': { 'left': '//', 'leftAlt': '{/*', 'rightAlt': '*/}' } }
"Syntastic checkers
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_typescript_checkers = ['tslint'] " You shouldn't use 'tsc' checker.
" Hex read
nmap <Leader>hr :%!xxd<CR> :set filetype=xxd<CR>
" Hex write
nmap <Leader>hw :%!xxd -r<CR> :set binary<CR> :set filetype=<CR>
"ctrl p ignore
"let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
colorscheme palenight
set shell=bash\ -i
"" Statusline (requires Powerline font)
set statusline=
set statusline+=%(%{&buflisted?bufnr('%'):''}\ >\ %)
set statusline+=%< " Truncate line here
set statusline+=%f\ " File path, as typed or relative to current directory
set statusline+=%{&modified?'+\ ':''}
set statusline+=%{&readonly?'🔒':''}
set statusline+=%= " Separation point between left and right aligned items
set statusline+=\ %{&filetype!=#''?&filetype:'none'}
set statusline+=%(\ %{(&bomb\|\|&fileencoding!~#'^$\\\|utf-8'?'\ '.&fileencoding.(&bomb?'-bom':''):'')
\.(&fileformat!=#(has('win32')?'dos':'unix')?'\ '.&fileformat:'')}%)
set statusline+=%(\ %{&modifiable?(&expandtab?'et\ ':'noet\ ').&shiftwidth:''}%)
set statusline+=\ %{&number?'':printf('%2d,',line('.'))} " Line number
set statusline+=%-2v " Virtual column number
set statusline+=\ %2p%% " Percentage through file in lines as in |CTRL-G|
" ------------------------ 8< ------------------------
" Statusline with highlight groups (requires Powerline font, using Solarized theme)
"set statusline=
"set statusline+=%(%{&buflisted?bufnr('%'):''}\ \ %)
"set statusline+=%< " Truncate line here
"set statusline+=%f\ " File path, as typed or relative to current directory
"set statusline+=%{&modified?'+\ ':''}
"set statusline+=%{&readonly?'\ ':''}
"set statusline+=%1*\ " Set highlight group to User1
"set statusline+=%= " Separation point between left and right aligned items
"set statusline+=\ %{&filetype!=#''?&filetype:'none'}
"set statusline+=%(\ %{(&bomb\|\|&fileencoding!~#'^$\\\|utf-8'?'\ '.&fileencoding.(&bomb?'-bom':''):'')
"\.(&fileformat!=#(has('win32')?'dos':'unix')?'\ '.&fileformat:'')}%)
"set statusline+=%(\ \ %{&modifiable?(&expandtab?'et\ ':'noet\ ').&shiftwidth:''}%)
"set statusline+=\ %* " Restore normal highlight
"set statusline+=\ %{&number?'':printf('%2d,',line('.'))} " Line number
"set statusline+=%-2v " Virtual column number
"set statusline+=\ %2p%% " Percentage through file in lines as in |CTRL-G|
"" Logic for customizing the User1 highlight group is the following
"" - if StatusLine colors are reverse, then User1 is not reverse and User1 fg = StatusLine fg
"hi StatusLine cterm=reverse gui=reverse ctermfg=14 ctermbg=8 guifg=#93a1a1 guibg=#002732
"hi StatusLineNC cterm=reverse gui=reverse ctermfg=11 ctermbg=0 guifg=#657b83 guibg=#073642
"hi User1 ctermfg=14 ctermbg=0 guifg=#93a1a1 guibg=#073642
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment