Update nvim plugins

master
Ian Mancini 3 years ago
parent 89ef9a303c
commit 75a972df9d

@ -1,9 +1,14 @@
local get_buffer_name = function()
-- Prevent glob expansion on weird filenames
return "'" .. vim.api.nvim_buf_get_name(0) .. "'"
end
local prettier = function()
return {
exe = "prettier",
args = {
"--stdin-filepath", vim.api.nvim_buf_get_name(0), '--single-quote',
'--no-semi'
"--stdin-filepath", get_buffer_name(), '--single-quote',
'--no-semi', '--prose-wrap', 'always'
},
stdin = true
}
@ -12,7 +17,7 @@ end
local black = function()
return {
exe = "black",
args = {"-q", "--stdin-filename", vim.api.nvim_buf_get_name(0), "-"},
args = {"-q", "--stdin-filename", get_buffer_name(), "-"},
stdin = true
}
end
@ -20,33 +25,19 @@ end
local clang_format = function()
return {
exe = "clang-format",
args = {"--assume-filename", vim.api.nvim_buf_get_name(0)},
args = {"--assume-filename", get_buffer_name()},
stdin = true,
cwd = vim.fn.expand('%:p:h')
}
end
local gofmt = function()
return {
exe = "gofmt",
stdin = true
}
end
local gofmt = function() return {exe = "gofmt", stdin = true} end
local blade_formatter = function()
return {
exe = "blade-formatter",
args = {"--stdin"},
stdin = true
}
return {exe = "blade-formatter", args = {"--stdin"}, stdin = true}
end
local lua_formatter = function()
return {
exe = "lua-format",
stdin = true
}
end
local lua_formatter = function() return {exe = "lua-format", stdin = true} end
require('formatter').setup({
logging = false,
@ -62,6 +53,7 @@ require('formatter').setup({
php = {prettier},
css = {prettier},
html = {prettier},
yaml = {prettier},
python = {black},
lua = {lua_formatter}
}
@ -70,6 +62,6 @@ require('formatter').setup({
vim.api.nvim_exec([[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.c,*.h,*.cpp,*.go,*.html,*.css,*.js,*.ts,*.jsx,*.tsx,*.py,*.blade.php,*.php,*.lua FormatWrite
autocmd BufWritePost *.c,*.h,*.cpp,*.go,*.html,*.css,*.js,*.ts,*.jsx,*.tsx,*.py,*.blade.php,*.php,*.lua,*.yaml,*.yml FormatWrite
augroup END
]], true)

@ -12,21 +12,13 @@ return require('packer').startup(function()
}
-- File explorer
use {
'kevinhwang91/rnvimr',
config = [[require('plugins.rnvimr')]]
}
use {'kevinhwang91/rnvimr', config = [[require('plugins.rnvimr')]]}
use {
'kyazdani42/nvim-tree.lua',
config = [[require('plugins.nvim-tree')]]
}
use {'kyazdani42/nvim-tree.lua', config = [[require('plugins.nvim-tree')]]}
-- LSP config
use {
'neovim/nvim-lspconfig',
config = [[require('plugins.lsp')]]
}
use {'neovim/nvim-lspconfig', config = [[require('plugins.lsp')]]}
use {'williamboman/nvim-lsp-installer'}
-- Langugage specific LSP plugins
use {'tjdevries/nlua.nvim'}
@ -46,10 +38,7 @@ return require('packer').startup(function()
use {'stevearc/aerial.nvim'}
-- Diagnostics
use {
'folke/trouble.nvim',
config = [[require('plugins.trouble-nvim')]]
}
use {'folke/trouble.nvim', config = [[require('plugins.trouble-nvim')]]}
-- Tree-sitter
use {
@ -69,10 +58,7 @@ return require('packer').startup(function()
}
-- Completion
use {
'hrsh7th/nvim-compe',
config = [[require('plugins.nvim-compe')]]
}
use {'hrsh7th/nvim-compe', config = [[require('plugins.nvim-compe')]]}
-- Snippets
use {'hrsh7th/vim-vsnip'}
@ -91,10 +77,7 @@ return require('packer').startup(function()
config = [[require('plugins.gitsigns-nvim')]]
}
use {'tpope/vim-fugitive'}
use {
'kdheepak/lazygit.nvim',
config = [[require('plugins.lazygit-nvim')]]
}
use {'kdheepak/lazygit.nvim', config = [[require('plugins.lazygit-nvim')]]}
-- Indent lines
use {
@ -118,10 +101,7 @@ return require('packer').startup(function()
use {
'hoob3rt/lualine.nvim',
requires = {
'kyazdani42/nvim-web-devicons',
opt = true
},
requires = {'kyazdani42/nvim-web-devicons', opt = true},
config = [[require('plugins.lualine')]]
}
@ -132,10 +112,7 @@ return require('packer').startup(function()
use {'norcalli/nvim-colorizer.lua'}
-- Colorschemes
use {
'Th3Whit3Wolf/onebuddy',
requires = {'tjdevries/colorbuddy.vim'}
}
use {'Th3Whit3Wolf/onebuddy', requires = {'tjdevries/colorbuddy.vim'}}
use {'RRethy/nvim-base16'}
use {'NTBBloodbath/doom-one.nvim'}
use {'folke/tokyonight.nvim'}
@ -151,10 +128,7 @@ return require('packer').startup(function()
}
-- Python
use {
'petobens/poet-v',
config = [[require('plugins.poet-v')]]
}
use {'petobens/poet-v', config = [[require('plugins.poet-v')]]}
-- Blade
use {'Eduruiz/vim-blade'}

@ -2,18 +2,12 @@ local lsp = require("lspconfig")
local aerial = require("aerial")
vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
signs = true,
virtual_text = true,
underline = true
})
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics,
{signs = true, virtual_text = true, underline = true})
local noremap = function(lhs, rhs, mode)
mode = mode or 'n'
local opts = {
noremap = true,
silent = true
}
local opts = {noremap = true, silent = true}
vim.api.nvim_buf_set_keymap(0, mode, lhs, rhs, opts)
end
@ -23,9 +17,7 @@ local set_lsp_config = function(client, bufnr)
aerial.on_attach(client)
local mappings = {
v = {
['<leader>ca'] = '<cmd><C-U>Lspsaga range_code_action<CR'
},
v = {['<leader>ca'] = '<cmd><C-U>Lspsaga range_code_action<CR'},
n = {
['gD'] = '<cmd>lua vim.lsp.buf.declaration()<CR>',
['gd'] = '<cmd>lua vim.lsp.buf.definition()<CR>',
@ -53,25 +45,37 @@ local set_lsp_config = function(client, bufnr)
end
end
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
if server.name == "tailwindcss" then
opts.handlers = {
["tailwindcss/getConfiguration"] = function(_, _, params, _, bufnr,
_)
vim.lsp.buf_notify(bufnr,
"tailwindcss/getConfigurationResponse",
{_id = params._id})
end
}
end
server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
end)
-- Lua
require('nlua.lsp.nvim').setup(lsp, {
on_attach = set_lsp_config
})
require('nlua.lsp.nvim').setup(lsp, {on_attach = set_lsp_config})
-- C/C++
lsp.clangd.setup {
on_attach = set_lsp_config
}
lsp.clangd.setup {on_attach = set_lsp_config}
-- Golang
lsp.gopls.setup {
on_attach = set_lsp_config
}
lsp.gopls.setup {on_attach = set_lsp_config}
-- PHP
lsp.phpactor.setup {
on_attach = set_lsp_config
}
lsp.phpactor.setup {on_attach = set_lsp_config}
-- Typescript
lsp.tsserver.setup {
@ -82,9 +86,7 @@ lsp.tsserver.setup {
}
-- Python
lsp.pyright.setup {
on_attach = set_lsp_config
}
lsp.pyright.setup {on_attach = set_lsp_config}
local eslint = {
lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}",
@ -101,10 +103,7 @@ local flake8 = {
lintFormats = {"%f:%l:%c: %m"}
}
local isort = {
formatCommand = "isort --profile black -",
formatStdin = true
}
local isort = {formatCommand = "isort --profile black -", formatStdin = true}
local phpstan = {
lintCommand = "./vendor/bin/phpstan analyze --error-format raw --no-progress"

@ -6,17 +6,12 @@ require("toggleterm").setup {
start_in_insert = true,
direction = 'float',
close_on_exit = false,
float_opts = {
winblend = 0,
border = 'single'
}
float_opts = {winblend = 0, border = 'single'}
}
function _G.set_terminal_keymaps()
local opts = {
noremap = true
}
local opts = {noremap = true}
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
end
vim.cmd('autocmd! TermOpen term://(*toggleterm#* lua set_terminal_keymaps()')
vim.cmd('autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()')

Loading…
Cancel
Save