2021-04-12 00:49:42 +00:00
|
|
|
" Plugins
|
|
|
|
"--------
|
|
|
|
|
|
|
|
" Install vim-plugged if not installed
|
|
|
|
if empty(glob('$HOME/.config/nvim/autoload/plug.vim'))
|
|
|
|
silent !curl -fLo $HOME/.config/nvim/autoload/plug.vim --create-dirs
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
autocmd VimEnter * PlugInstall --sync | source $HOME/.config/nvim/init.vim
|
|
|
|
endif
|
|
|
|
|
|
|
|
" All plugins
|
|
|
|
call plug#begin('$HOME/.config/nvim/plugged')
|
|
|
|
|
|
|
|
" Core plugins
|
2021-05-12 23:00:31 +00:00
|
|
|
Plug 'nvim-lua/plenary.nvim' " Prerequisite library for other plugins
|
|
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (prerequisite for fzf.vim)
|
2021-04-12 00:49:42 +00:00
|
|
|
Plug 'junegunn/fzf.vim' " Actual fuzzyfinder
|
2021-05-12 23:00:31 +00:00
|
|
|
Plug 'morhetz/gruvbox' " Colorscheme
|
2021-04-12 00:49:42 +00:00
|
|
|
Plug 'tpope/vim-surround' " Enables paren editing
|
|
|
|
Plug 'sheerun/vim-polyglot' " Syntax for every language
|
2021-05-12 23:00:31 +00:00
|
|
|
Plug 'lewis6991/gitsigns.nvim' " Git next to line numbers
|
2021-04-12 00:49:42 +00:00
|
|
|
Plug 'tpope/vim-commentary' " Use gc or gcc to comment
|
2021-05-10 01:58:06 +00:00
|
|
|
Plug 'phaazon/hop.nvim' " Quick jump around the buffer
|
2021-05-12 23:00:31 +00:00
|
|
|
Plug 'neovim/nvim-lspconfig' " Language server linting
|
|
|
|
Plug 'jiangmiao/auto-pairs' " Parentheses
|
2021-05-13 12:50:36 +00:00
|
|
|
Plug 'rafamadriz/friendly-snippets'
|
|
|
|
Plug 'hrsh7th/vim-vsnip'
|
|
|
|
Plug 'hrsh7th/vim-vsnip-integ'
|
2021-05-12 23:00:31 +00:00
|
|
|
Plug 'hrsh7th/nvim-compe' " Auto-complete
|
2021-05-13 12:50:36 +00:00
|
|
|
Plug 'tpope/vim-repeat' " Actually repeat using .
|
2021-04-12 00:49:42 +00:00
|
|
|
|
|
|
|
" Ancillary plugins
|
2021-05-10 01:58:06 +00:00
|
|
|
Plug 'godlygeek/tabular' " Spacing and alignment
|
2021-04-12 00:49:42 +00:00
|
|
|
Plug 'unblevable/quick-scope' " Hints for f and t
|
|
|
|
Plug 'vimwiki/vimwiki' " Wiki Markdown System
|
|
|
|
Plug 'airblade/vim-rooter' " Change directory to git route
|
|
|
|
Plug 'tpope/vim-fugitive' " Other git commands
|
|
|
|
Plug 'itchyny/lightline.vim' " Status bar
|
2021-04-22 13:34:57 +00:00
|
|
|
Plug 'tpope/vim-eunuch' " File manipulation in Vim
|
2021-04-12 00:49:42 +00:00
|
|
|
Plug 'tpope/vim-vinegar' " Fixes netrw file explorer
|
|
|
|
Plug 'christoomey/vim-tmux-navigator' " Hotkeys for tmux panes
|
|
|
|
|
|
|
|
call plug#end()
|
2021-05-12 23:00:31 +00:00
|
|
|
|
|
|
|
" Enable plugins
|
|
|
|
lua << EOF
|
|
|
|
require('lspconfig').rust_analyzer.setup{}
|
|
|
|
require('lspconfig').pyls.setup{}
|
|
|
|
require('gitsigns').setup()
|
|
|
|
require'compe'.setup({
|
|
|
|
enabled = true,
|
|
|
|
source = {
|
|
|
|
path = true,
|
|
|
|
buffer = true,
|
|
|
|
nvim_lsp = true,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
EOF
|
2021-05-13 12:50:36 +00:00
|
|
|
|
|
|
|
lua << EOF
|
|
|
|
local t = function(str)
|
|
|
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
|
|
end
|
|
|
|
|
|
|
|
local check_back_space = function()
|
|
|
|
local col = vim.fn.col('.') - 1
|
|
|
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Use (s-)tab to:
|
|
|
|
--- move to prev/next item in completion menuone
|
|
|
|
--- jump to prev/next snippet's placeholder
|
|
|
|
_G.tab_complete = function()
|
|
|
|
if vim.fn.pumvisible() == 1 then
|
|
|
|
return t "<C-n>"
|
|
|
|
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
|
|
|
return t "<Plug>(vsnip-expand-or-jump)"
|
|
|
|
elseif check_back_space() then
|
|
|
|
return t "<Tab>"
|
|
|
|
else
|
|
|
|
return vim.fn['compe#complete']()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
_G.s_tab_complete = function()
|
|
|
|
if vim.fn.pumvisible() == 1 then
|
|
|
|
return t "<C-p>"
|
|
|
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
|
|
|
return t "<Plug>(vsnip-jump-prev)"
|
|
|
|
else
|
|
|
|
return t "<S-Tab>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
_G.cr_complete = function()
|
|
|
|
-- if vim.fn.pumvisible() == 1
|
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
|
|
EOF
|