Skip to content

Commit

Permalink
add plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderHott committed Dec 4, 2022
1 parent ab6d6fe commit 5bf5708
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 78 deletions.
65 changes: 65 additions & 0 deletions minimal_debug_init.lua
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
79 changes: 51 additions & 28 deletions plugins/init.lua
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
local override = require("custom.plugins.override")

local exists, treesitter_config = pcall(require, "nvim-treesitter.configs")
if exists then
vim.notify("treesitter config exists")
treesitter_config.setup({
context_commentstring = {
enable = true,
},
})
else
vim.notify("treesitter config not exists")
end
-- local exists, treesitter_config = pcall(require, "nvim-treesitter.configs")
-- if exists then
-- vim.notify("treesitter config exists")
-- treesitter_config.setup({
-- context_commentstring = {
-- enable = true,
-- },
-- })
-- else
-- vim.notify("treesitter config not exists")
-- end

return {

------
-- New
------
------------------------------------------------------------------------------
-------------------------------------- New -----------------------------------
------------------------------------------------------------------------------

["p00f/nvim-ts-rainbow"] = { -- rainbow brackets
-- rainbow brackets
["p00f/nvim-ts-rainbow"] = {
after = "nvim-treesitter",
},
["JoosepAlviste/nvim-ts-context-commentstring"] = { -- correct comments inside of jsx code
-- correct comments inside of jsx code
["JoosepAlviste/nvim-ts-context-commentstring"] = {
after = "nvim-treesitter",
},

["jose-elias-alvarez/null-ls.nvim"] = { -- extensive formatting and diagnostics
-- extensive formatting and diagnostics
["jose-elias-alvarez/null-ls.nvim"] = {
after = "nvim-lspconfig",
config = function()
require("custom.plugins.null-ls")
end,
},
-- UI lib for plugin
["RishabhRD/popfix"] = {},

-- Doesn't work with LspInstaller
-- ["andreadev-it/shade.nvim"] = { -- dim unactive windows
-- -- module = "shade",
Expand All @@ -48,21 +53,27 @@ return {
-- require "vim-matchup"
-- end,
-- },

-- React snippets
["mlaursen/vim-react-snippets"] = {
after = "LuaSnip",
},
-- Automatically find and keep track of different projects
["ahmedkhalf/project.nvim"] = {
-- after = "telescope.nvim",
config = function()
require("custom.plugins.project")
end,
},
-- Debugger adapter protocol
["mfussenegger/nvim-dap"] = {
config = function()
require("custom.plugins.dap")
end,
},
-- Git integration with :G
["tpope/vim-fugitive"] = {},
-- use jk kj for escape
["max397574/better-escape.nvim"] = {
config = function()
require("better_escape").setup({
Expand All @@ -74,9 +85,13 @@ return {
end,
override_options = override.better_escape,
},
-- outline all the tokens of a file (AST)
["simrat39/symbols-outline.nvim"] = {},
-- AI autocomplete
["github/copilot.vim"] = {},
-- Copilot in completion window
["zbirenbaum/copilot-cmp"] = {},
-- surround blocks with []{}()""''<> and html tags
["tpope/vim-surround"] = {
keys = { "c", "d", "y" },
},
Expand All @@ -87,6 +102,7 @@ return {
require("hop").setup({ keys = "asdfghjkl;qwertyuiop" })
end,
},
-- automatically close html/jsx tags
["windwp/nvim-ts-autotag"] = {
ft = { "html", "md", "javascriptreact", "typescriptreact" },
after = "nvim-treesitter",
Expand All @@ -98,6 +114,7 @@ return {
end
end,
},
-- rest client
["rest-nvim/rest.nvim"] = {
requires = { "nvim-lua/plenary.nvim" },
config = function()
Expand Down Expand Up @@ -137,30 +154,36 @@ return {
})
end,
},
-- cht.sh integration
["RishabhRD/nvim-cheat.sh"] = {},
-- commenting
["tpope/vim-commentary"] = {},

-- ["williamboman/mason-lspconfig.nvim"] = {
-- after = "nvim-lspconfig",
-- config = function()
-- require("custom.plugins.mason-lspconfig")
-- end,
-- },
-- ["williamboman/mason-lspconfig.nvim"] = {
-- after = "nvim-lspconfig",
-- config = function()
-- require("custom.plugins.mason-lspconfig")
-- end,
-- },
-- View undo history
["mbbill/undotree"] = {},

--------------------
-- Already installed
--------------------
------------------------------------------------------------------------------
-------------------------------------- Already installed ---------------------
------------------------------------------------------------------------------

["goolord/alpha-nvim"] = { -- start screen
-- start screen
["goolord/alpha-nvim"] = {
disable = false,
config = function()
require("custom.plugins.alpha")
end,
override_options = override.alpha,
},
-- Show keymaps
["folke/which-key.nvim"] = { disable = false },

-- LSP
["neovim/nvim-lspconfig"] = {
config = function()
require("plugins.configs.lspconfig")
Expand Down
99 changes: 51 additions & 48 deletions plugins/null-ls.lua
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,
})
4 changes: 2 additions & 2 deletions plugins/override.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ M.mason = {
"emmet-ls",
-- Other
"codespell",
"lua-language-serve",
"lua-language-server",
"actionlint",
"rust-analyze",
"rust-analyzer",
},
}

Expand Down

0 comments on commit 5bf5708

Please sign in to comment.