Skip to content

Instantly share code, notes, and snippets.

@bfagundez
Created April 20, 2022 20:05
Show Gist options
  • Save bfagundez/175e2a0412fa51103e5a0f535b416410 to your computer and use it in GitHub Desktop.
Save bfagundez/175e2a0412fa51103e5a0f535b416410 to your computer and use it in GitHub Desktop.
-- Auto install plugin manager
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
packer_bootstrap = vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
-- Plugins configurations
return require'packer'.startup {
function(use)
-- Let packer manage itself
use {
'wbthomason/packer.nvim',
config = function()
vim.cmd "autocmd BufWritePost init.lua source <afile> | PackerCompile"
end
}
-- Syntax highlighting and objects
use {
'nvim-treesitter/nvim-treesitter',
requires = {
"godlygeek/tabular",
"tpope/vim-sleuth"
},
run = ':TSUpdate',
config = function()
require'nvim-treesitter.configs'.setup {
ensure_installed = {"json", "lua", "dockerfile", "javascript", "jsdoc", "prisma", "ruby", "scss", "typescript", "yaml", "vue"};
highlight = {
enable = true
}
}
end
}
use {
'scrooloose/nerdtree',
config = function()
vim.api.nvim_set_keymap(
'n',
[[<leader>\]],
':NERDTreeToggle<CR>',
{noremap = true})
end
}
use { 'SirVer/ultisnips',
config = function()
vim.g.UltiSnipsExpandTrigger = '<tab>';
vim.g.UltiSnipsJumpForwardTrigger = '<tag>';
vim.g.UltiSnipsJumpBackwardTrigger = "<s-tab>";
vim.g.UltiSnipsSnippetsDir = '/Users/geekymartian/.codeSnippets/'
vim.g.UltiSnipsSnippetDirectories = {'/Users/geekymartian/.codeSnippets'}
vim.g.UltiSnipsEditSplit = 'vertical';
end
}
use { 'airblade/vim-gitgutter'}
use { 'alvan/vim-closetag'}
use { 'bling/vim-airline',
config = function ()
vim.g.airline_powerline_fonts = 1
vim.g.airline_powerline_fonts = 1
vim.g.airline_powerline_section_b = '%strftime("%c")}'
vim.g['airline#extensions#tabline#enabled'] = 1
vim.g['airline#extensions#tabline#formatter'] = 'default'
vim.g['airline#extensions#tmuxline#enabled'] = 0
vim.g['airline#extensions#ale#enabled'] = 0
end
}
use { 'cloudhead/neovim-fuzzy',
config = function()
vim.api.nvim_set_keymap(
'n',
'<C-p>',
':Files<CR>',
{noremap = true})
vim.api.nvim_set_keymap(
'n',
'<leader>f',
':FuzzySearch<CR>',
{noremap = true})
end
}
use { 'craigemery/vim-autotag'}
use { 'drewtempelmeyer/palenight.vim'}
use { 'dyng/ctrlsf.vim',
config = function()
vim.api.nvim_set_keymap(
'n',
'<C-S-f>',
':CtrlSF<space>',
{noremap = true})
end
}
use { 'edkolev/tmuxline.vim'}
use { 'flazz/vim-colorschemes'}
use { 'ggvgc/vim-fuzzysearch'}
use { 'honza/vim-snippets'}
use { 'isRuslan/vim-es6'}
use { 'jiangmiao/auto-pairs'}
use { 'jparise/vim-graphql'}
use { 'junegunn/fzf', run = function() vim.fn['fzf#install'](0) end }
use { 'junegunn/fzf.vim' }
use { 'Shougo/deoplete.nvim',run = ':UpdateRemotePlugins'}
use { 'junegunn/vim-easy-align'}
use { 'justinmk/vim-sneak'}
use { 'kshenoy/vim-signature'}
use { 'leafgarland/typescript-vim'}
use { 'mattn/emmet-vim'}
use { 'prettier/vim-prettier'}
use { 'mattn/vim-gist',
requires = {
'mattn/webapi-vim',
},
}
use { 'mattn/webapi-vim'}
use { 'pangloss/vim-javascript'}
use { 'posva/vim-vue'}
use { 'ryanoasis/vim-devicons'}
use { 'scrooloose/nerdcommenter'}
use { 'thanethomson/vim-jenkinsfile'}
use { 'tmux-plugins/vim-tmux-focus-events'}
use { 'tpope/vim-dadbod'}
use { 'kristijanhusak/vim-dadbod-ui'}
use { 'tpope/vim-fugitive'}
use { 'tpope/vim-rhubarb'}
use { 'tpope/vim-sensible'}
use { 'tpope/vim-surround'}
use { 'tyru/open-browser-github.vim'}
use { 'tyru/open-browser.vim'}
use { 'vim-airline/vim-airline-themes'}
use { 'xolox/vim-colorscheme-switcher'}
use { 'xolox/vim-misc'}
use { 'tpope/vim-abolish'}
use { 'neovim/nvim-lspconfig'}
use { 'github/copilot.vim'}
-- Star search on visual selection
use {
'bronson/vim-visual-star-search',
keys = {
{'v', '*'}
}
}
-- Git
use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
},
config = function()
require('gitsigns').setup({
})
end
}
use {
'APZelos/blamer.nvim',
config = function()
vim.g.blamer_enabled = 1
vim.g.blamer_show_in_visual_modes = 0
vim.g.blamer_relative_time = 1
end
}
-- Language server protocol
use {
'williamboman/nvim-lsp-installer',
requires = {
'neovim/nvim-lspconfig',
},
run = function()
local required_servers = {
"bashls",
"diagnosticls",
"dockerls",
"tsserver",
"yamlls",
"cssmodules_ls",
"volar",
"tailwindcss",
"prismals",
"quick_lint_js",
"jsonls",
"vuels"
}
require "nvim-lsp-installer.ui.status-win"().open()
local lsp_installer_servers = require'nvim-lsp-installer.servers'
for _, required_server in pairs(required_servers) do
local _, server = lsp_installer_servers.get_server(required_server)
if not server:is_installed() then
server:install()
end
end
end,
config = function()
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap('n', '<space>=', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
vim.cmd [[ do User LspAttachBuffers ]]
end
}
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment