-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab6d6fe
commit 5bf5708
Showing
4 changed files
with
169 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
local on_windows = vim.loop.os_uname().version:match "Windows" | ||
|
||
local function join_paths(...) | ||
local path_sep = on_windows and "\\" or "/" | ||
local result = table.concat({ ... }, path_sep) | ||
return result | ||
end | ||
|
||
vim.opt.runtimepath = vim.env.VIMRUNTIME | ||
vim.opt.completeopt = "menu" | ||
|
||
local temp_dir = vim.loop.os_getenv "TEMP" or "/tmp" | ||
|
||
vim.opt.packpath = join_paths(temp_dir, "nvim-lsp-installer-debug", "site") | ||
|
||
local package_root = join_paths(temp_dir, "nvim-lsp-installer-debug", "site", "pack") | ||
local install_path = join_paths(package_root, "packer", "start", "packer.nvim") | ||
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua") | ||
|
||
local function load_plugins() | ||
require("packer").startup { | ||
{ | ||
"wbthomason/packer.nvim", | ||
"neovim/nvim-lspconfig", | ||
"williamboman/nvim-lsp-installer", | ||
"sheerun/vim-polyglot", | ||
"purescript-contrib/purescript-vim", | ||
}, | ||
config = { | ||
package_root = package_root, | ||
compile_path = compile_path, | ||
}, | ||
} | ||
end | ||
|
||
function _G.load_config() | ||
local lspconfig = require "lspconfig" | ||
|
||
local function on_attach(client, bufnr) | ||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") | ||
end | ||
|
||
require("nvim-lsp-installer").setup { | ||
log = vim.log.levels.DEBUG, | ||
} | ||
|
||
-- ================================================== | ||
-- ========= SETUP RELEVANT SERVER(S) HERE! ========= | ||
-- ================================================= | ||
-- | ||
-- lspconfig.sumneko_lua.setup { on_attach = on_attach } | ||
lspconfig.jdtls.setup({on_attach = on_attach}) | ||
lspconfig.purescriptls.setup {} | ||
end | ||
|
||
if vim.fn.isdirectory(install_path) == 0 then | ||
vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path } | ||
load_plugins() | ||
require("packer").sync() | ||
vim.cmd [[autocmd User PackerComplete ++once lua load_config()]] | ||
else | ||
load_plugins() | ||
require("packer").sync() | ||
_G.load_config() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,69 @@ | ||
local present, null_ls = pcall(require, "null-ls") | ||
|
||
if not present then | ||
return | ||
return | ||
end | ||
|
||
local b = null_ls.builtins | ||
|
||
local sources = { | ||
|
||
-- webdev stuff | ||
b.formatting.prettier.with { | ||
filetypes = { | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"css", | ||
"scss", | ||
"less", | ||
"html", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"markdown", | ||
"graphql", | ||
"handlebars", | ||
}, | ||
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, | ||
}, | ||
-- webdev stuff | ||
b.formatting.prettier.with({ | ||
filetypes = { | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"css", | ||
"scss", | ||
"less", | ||
"html", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"markdown", | ||
"graphql", | ||
"handlebars", | ||
}, | ||
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, | ||
}), | ||
|
||
-- Lua | ||
b.formatting.stylua, | ||
-- Lua | ||
b.formatting.stylua, | ||
|
||
-- Shell | ||
b.formatting.shfmt, | ||
b.diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" }, | ||
-- Shell | ||
b.formatting.shfmt, | ||
b.diagnostics.shellcheck.with({ diagnostics_format = "#{m} [#{c}]" }), | ||
|
||
-- Python | ||
b.formatting.black.with { extra_args = { "--fast" } }, | ||
b.diagnostics.flake8, | ||
-- Python | ||
b.formatting.black.with({ extra_args = { "--fast" } }), | ||
b.diagnostics.flake8, | ||
|
||
-- Rust | ||
b.formatting.rustfmt.with { extra_args = { "--edition", "2021" } }, | ||
-- Rust | ||
b.formatting.rustfmt.with({ extra_args = { "--edition", "2021" } }), | ||
|
||
-- SQL | ||
b.formatting.sqlfluff.with { | ||
extra_args = { "--dialect", "postgres" }, | ||
}, | ||
b.diagnostics.sqlfluff.with { | ||
extra_args = { "--dialect", "postgres" }, | ||
}, | ||
-- SQL | ||
b.formatting.sqlfluff.with({ | ||
extra_args = { "--dialect", "postgres" }, | ||
}), | ||
b.diagnostics.sqlfluff.with({ | ||
extra_args = { "--dialect", "postgres" }, | ||
}), | ||
|
||
-- Markdown | ||
b.formatting.markdownlint, | ||
b.diagnostics.markdownlint, | ||
-- Markdown | ||
b.formatting.markdownlint, | ||
b.diagnostics.markdownlint, | ||
|
||
-- Misc | ||
b.diagnostics.codespell.with{ extra_args = {"--ignore-words", "~/.config/codespell-ignore"}} | ||
} | ||
-- Java | ||
b.formatting.clang_format, | ||
|
||
null_ls.setup { | ||
debug = true, | ||
sources = sources, | ||
-- Misc | ||
b.diagnostics.codespell.with({ extra_args = { "--ignore-words", "~/.config/codespell-ignore" } }), | ||
} | ||
|
||
null_ls.setup({ | ||
debug = true, | ||
sources = sources, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters