Skip to content

Instantly share code, notes, and snippets.

@daveyholler
Created November 18, 2021 03:54
Show Gist options
  • Select an option

  • Save daveyholler/88da09b0556cba24e4719d184f8fb968 to your computer and use it in GitHub Desktop.

Select an option

Save daveyholler/88da09b0556cba24e4719d184f8fb968 to your computer and use it in GitHub Desktop.
call plug#begin('~/.vim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'neovim/nvim-lspconfig'
Plug 'mattn/emmet-vim'
Plug 'qpkorr/vim-bufkill'
Plug 'mattn/webapi-vim'
Plug 'mattn/vim-gist'
call plug#end()
" Kill the buffer without closing the window
map <Leader>kl :BD<cr>
" Fix My JS
noremap <Leader><Leader>e :Fixmyjs<CR>
" NERDTree Reload
nmap <Leader>rn :NERDTreeFocus<cr>R<c-w><c-p>
vnoremap <C-c> "+y
map <C-p> "+p
map <j> :noh
set termguicolors
colorscheme olivia
hi Normal guibg=None ctermbg=None
hi LineNr guibg=None ctermbg=None
hi SignColumn guibg=None ctermbg=None
hi CursorLine guibg=None ctermbg=None
hi FoldColumn guibg=None ctermbg=None
hi NonText guibg=None ctermbg=None
" Set Emmet trigger keys
let g:user_emmet_leader_key=","
" Line length
:set colorcolumn=80
" Press * to search and leader-r for replacing
nnoremap <Leader>r :%s///g<Left><Left>
nnoremap <Leader>rc :%s///gc<Left><Left><Left>
" Set Ctrl-P to the project directory
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_user_command =
\ ['.git', 'cd %s && git ls-files -co --exclude-standard']
" Allow passing optional flags into the Rg command
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case " . <q-args>, 1, <bang>0)
" Enable mouse support
set mouse=a
set clipboard=unnamedplus
" set autochdir
let g:gist_use_password_in_gitconfig = 1
""""""""""""""""""""""""""""""""
" Fix that pesky capital error when saving
""""""""""""""""""""""""""""""""
command WQ wq
command Wq wq
command! W w
command Q q
""""""""""""""""""""""""""""""
" LSP Configuration
""""""""""""""""""""""""""""""
set completeopt=menu,menuone,noselect
lua << EOF
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
end,
},
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
require'lspconfig'.tsserver.setup{
capabilities = capabilities
}
require'lspconfig'.solargraph.setup{
capabilities = capabilities
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment