Skip to content

Commit

Permalink
hard to say - too much changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendelski committed Sep 5, 2023
1 parent 6be8dff commit 9b9cd7c
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 99 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions nvim/.nvim/lua/plugin/comments.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local htmlComments = vim.tbl_extend("force", baseConfig, {

config.configure_language("conf", hashComments)
config.configure_language("makefile", hashComments)
config.configure_language("make", hashComments)
config.configure_language("dockerfile", hashComments)
config.configure_language("yaml", hashComments)
config.configure_language("tmux", hashComments)
Expand Down
78 changes: 39 additions & 39 deletions nvim/.nvim/lua/plugin/lsp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ for type, icon in pairs(signs) do
end

-- Bash
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#bashls
-- npm i -g bash-language-server
lspconfig.bashls.setup(config())

-- css, scss, less, html, json
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#cssls
-- npm i -g vscode-langservers-extracted
lspconfig.cssls.setup(config())
lspconfig.html.setup(config())
Expand All @@ -80,36 +78,60 @@ lspconfig.yamlls.setup(config({
},
},
}))
lspconfig.tailwindcss.setup(config({
filetypes = {
-- "rust",
"aspnetcorerazor",
"django-html",
"htmldjango",
"edge",
"eelixir",
"elixir",
"gohtml",
"handlebars",
"hbs",
"html",
"liquid",
"markdown",
"mdx",
"mustache",
"njk",
"nunjucks",
"php",
"twig",
"css",
"less",
"postcss",
"sass",
"scss",
"stylus",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"svelte",
},
}))

-- Eslint
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.txt#eslint
-- go install github.com/mattn/efm-langserver@latest
-- npm install -g eslint_d
lspconfig.eslint.setup(config())

-- Docker
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#dockerls
-- npm i -g dockerfile-language-server-nodejs
lspconfig.dockerls.setup(config())

-- GraphQL
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#graphql
-- npm i -g graphql-language-service-cli
lspconfig.graphql.setup(config())

-- Groovy
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#groovyls
-- https://github.com/prominic/groovy-language-server.git
-- lspconfig.groovyls.setup(config({
-- cmd = { vim.fn.expand("~/.nvim/lang/groovy/run.sh") },
-- }))

-- Go
require("plugin/lsp/lang/go").setup(config)

-- Rust
-- Handled by rust-tools

-- lspconfig.rust_analyzer.setup(lsconfig({
-- settings = {
-- -- Add clippy warnings to rust-anayzer
Expand All @@ -136,53 +158,27 @@ require("plugin/lsp/lang/go").setup(config)
-- },
-- }))

-- Java
-- java-language-server is unmaintained, migrated to jdtls
-- https://github.com/georgewfraser/java-language-server
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#java_language_server
-- lspconfig.java_language_server.setup(config({
-- cmd = { data_dir .. "/lang-servers/java-language-server/dist/lang_server_linux.sh" },
-- }))

-- Kotlin
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#kotlin_language_server
-- https://github.com/fwcd/kotlin-language-server
-- lspconfig.kotlin_language_server.setup(config({
-- cmd = { vim.fn.expand("~/.nvim/lang/kotlin/bin/kotlin-language-server") },
-- }))

-- Python
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#pyright
-- https://github.com/microsoft/pyright
-- npm i --global pyright
lspconfig.pyright.setup(config())

-- SQL
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#sqlls
-- https://github.com/joe-re/sql-language-server
-- npm i -g sql-language-server
lspconfig.sqlls.setup(config())

-- Svelte
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#svelte
-- https://github.com/sveltejs/language-tools/tree/master/packages/language-server
-- npm i -g svelte-language-server
lspconfig.svelte.setup(config())

-- Typescript
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#tsserver
-- https://github.com/theia-ide/typescript-language-server
-- npm i -g typescript typescript-language-server
lspconfig.tsserver.setup(config())

-- Vue
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#vuels
-- https://github.com/vuejs/vetur/tree/master/server
-- npm i -g vls
lspconfig.vuels.setup(config())

-- Stylelint
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#stylelint_lsp
-- npm i -g stylelint-lsp
lspconfig.stylelint_lsp.setup(config({
filetypes = {
Expand All @@ -192,6 +188,10 @@ lspconfig.stylelint_lsp.setup(config({
},
}))

-- Toml
-- cargo install --features lsp --locked taplo-cli
lspconfig.taplo.setup(config())

-- Lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls
-- https://github.com/luals/lua-language-server/wiki/Getting-Started#command-line
Expand Down
14 changes: 8 additions & 6 deletions nvim/.nvim/lua/plugin/lsp/on-attach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ local function diagnosticsOnHold(bufnr)
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
if vim.api.nvim_win_get_config(winid).zindex then
return
end
end
vim.diagnostic.open_float(nil, {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
Expand Down Expand Up @@ -64,7 +69,7 @@ return function(client, bufnr)
"<cmd>lua vim.lsp.buf.clear_references() vim.lsp.buf.document_highlight()<cr>",
opts
)
buf_set_keymap("n", prefix .. "t", "<cmd>lua vim.lsp.buf.type_definition()<cr>", opts)
buf_set_keymap("n", prefix .. "T", "<cmd>lua vim.lsp.buf.type_definition()<cr>", opts)
buf_set_keymap("n", prefix .. "n", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
buf_set_keymap("n", prefix .. "a", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
buf_set_keymap("n", prefix .. "r", "<cmd>lua vim.lsp.buf.references()<cr>", opts)
Expand Down Expand Up @@ -99,14 +104,11 @@ return function(client, bufnr)
-- Save and format
null_ls.configure_client(client, bufnr)
local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
local supports_format = client.server_capabilities.documentFormattingProvider or null_ls.has_formatter(filetype)
local supports_format = client.server_capabilities.documentFormattingProvider ~= nil
or null_ls.has_formatter(filetype)
if supports_format == true then
buf_set_keymap("n", "<c-s>", ":execute 'lua require(\"plugin/lsp/actions\").format()' | :w<cr>", opts)
buf_set_keymap("i", "<c-s>", "<esc>:execute 'lua require(\"plugin/lsp/actions\").format()' | :w<cr>", opts)
buf_set_keymap("x", "<c-s>", "<esc>:execute 'lua require(\"plugin/lsp/actions\").format()' | :w<cr>", opts)
else
buf_set_keymap("n", "<c-s>", "<cmd>:w<cr>", opts)
buf_set_keymap("i", "<c-s>", "<esc>:w<cr>", opts)
buf_set_keymap("x", "<c-s>", "<esc>:w<cr>", opts)
end
end
2 changes: 1 addition & 1 deletion nvim/.nvim/lua/plugin/null-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function M.config()
-- formatting
formatting.stylua,
formatting.shfmt,
formatting.prettier,
formatting.prettier.with({ disabled_filetypes = { "yaml" }, extra_filetypes = { "toml" } }),
-- liting
diagnostics.golangci_lint,
diagnostics.hadolint,
Expand Down
39 changes: 19 additions & 20 deletions nvim/.nvim/lua/plugin/nvim-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ cmp.setup({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.mapping.complete()
Expand Down Expand Up @@ -93,38 +93,23 @@ cmp.setup({
-- behavior = cmp.SelectBehavior.Select
-- }), { 'i', 'c' }),
},
sorting = {
priority_weight = 10,
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "luasnip" },
}, { buffersrc }),
}),
})

-- Lazy load rust crates completions
vim.api.nvim_exec(
[[
autocmd FileType toml lua require('cmp').setup.buffer({ sources = { { name = 'crates' } } })
]],
false
)

-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
}, {
buffersrc,
}),
})

-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
buffersrc,
},
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
Expand All @@ -134,3 +119,17 @@ cmp.setup.cmdline(":", {
{ name = "cmdline" },
}),
})

-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = { buffersrc },
})

-- Lazy load rust crates completions
vim.api.nvim_exec(
[[
autocmd FileType toml lua require('cmp').setup.buffer({ sources = { { name = 'crates' } } })
]],
false
)
21 changes: 17 additions & 4 deletions nvim/.nvim/lua/plugin/rust-tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local liblldb_path = vim.fn.expand(extension_path .. "/lldb/lib/liblldb.*")
-- local liblldb_path = extension_path .. '/lldb/lib/liblldb.so' -- linux

require("rust-tools").setup({
tools = { -- rust-tools options
tools = {
-- rust-tools options
-- Automatically set inlay hints (type hints)
autoSetHints = true,

Expand Down Expand Up @@ -107,16 +108,28 @@ require("rust-tools").setup({
flags = { debounce_text_changes = 150 },
settings = {
["rust-analyzer"] = {
assist = {
importGranularity = "module",
importPrefix = "self",
completion = { postfix = { enable = false } },
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
loadOutDirsFromCheck = true,
allFeatures = true,
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
diagnostics = {
enable = true,
disabled = { "unresolved-proc-macro" },
experimental = { enable = false },
},
checkOnSave = {
allFeatures = true,
overrideCommand = {
Expand Down
1 change: 0 additions & 1 deletion nvim/.nvim/lua/plugin/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local _M = {}

function _M.keymap()
local map = require("util").keymap
map("n", "<F1>", "<esc>")
map("n", "<leader>fx", ":Telescope<cr>")
map("n", "<leader>f;", ":Telescope commands<cr>")
map("n", "<leader>f:", ":Telescope command_history<cr>")
Expand Down
5 changes: 3 additions & 2 deletions nvim/.nvim/lua/plugin/tree/on-attach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ return function(bufnr)
vim.keymap.set("n", "v", api.node.open.vertical, opts("Open: Vertical Split"))
vim.keymap.set("n", "s", api.node.open.horizontal, opts("Open: Horizontal Split"))
vim.keymap.set("n", "t", api.node.open.tab, opts("Open: New Tab"))
vim.keymap.set("n", "R", api.tree.reload, opts("Refresh"))
vim.keymap.set("n", "a", api.fs.create, opts("Create"))
vim.keymap.set("n", "d", api.fs.trash, opts("Trash"))
vim.keymap.set("n", "D", api.fs.remove, opts("Delete"))
vim.keymap.set("n", "D", api.fs.trash, opts("Trash"))
vim.keymap.set("n", "d", api.fs.remove, opts("Delete"))
vim.keymap.set("n", "n", api.fs.rename, opts("Rename"))
vim.keymap.set("n", "N", api.fs.rename_sub, opts("Rename: Omit Filename"))
vim.keymap.set("n", "x", api.fs.cut, opts("Cut"))
Expand Down
27 changes: 8 additions & 19 deletions nvim/.nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ packer.startup({
use({
"hrsh7th/nvim-cmp",
requires = {
{ "onsails/lspkind-nvim", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" },
{ "hrsh7th/cmp-cmdline", after = "nvim-cmp" },
{ "hrsh7th/cmp-git", after = "nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" },
{ "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" },
{ "hrsh7th/cmp-path", after = "nvim-cmp" },
{ "hrsh7th/cmp-calc", after = "nvim-cmp" },
{ "onsails/lspkind-nvim", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" },
{ "hrsh7th/cmp-cmdline", after = "nvim-cmp" },
{ "hrsh7th/cmp-git", after = "nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" },
{ "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" },
{ "hrsh7th/cmp-path", after = "nvim-cmp" },
{ "hrsh7th/cmp-calc", after = "nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip", after = "nvim-cmp" },
},
event = "InsertEnter",
Expand All @@ -213,12 +213,6 @@ packer.startup({
tag = "*",
config = [[require("plugin/surround")]],
})
-- Auto pair parenthesis
use({
"windwp/nvim-autopairs",
after = "nvim-cmp",
config = [[require("plugin/autopairs")]],
})
-- Git
use({
"lewis6991/gitsigns.nvim",
Expand All @@ -242,11 +236,6 @@ packer.startup({
ft = "toml",
requires = { "nvim-lua/plenary.nvim" },
})
-- Toml
use({
"cespare/vim-toml",
ft = "toml",
})
-- CSS
use({
"norcalli/nvim-colorizer.lua",
Expand Down
Loading

0 comments on commit 9b9cd7c

Please sign in to comment.