nvim
This commit is contained in:
parent
9aa3669139
commit
6276c93767
5 changed files with 199 additions and 197 deletions
|
@ -59,7 +59,7 @@ M.gitsigns_keymaps = function(bufnr)
|
||||||
return "]c"
|
return "]c"
|
||||||
end
|
end
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
gs.next_hunk()
|
gs.nav_hunk('next')
|
||||||
end)
|
end)
|
||||||
return "<Ignore>"
|
return "<Ignore>"
|
||||||
end, "next hunk", bufnr)
|
end, "next hunk", bufnr)
|
||||||
|
@ -69,7 +69,7 @@ M.gitsigns_keymaps = function(bufnr)
|
||||||
return "[c"
|
return "[c"
|
||||||
end
|
end
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
gs.prev_hunk()
|
gs.nav_hunk('prev')
|
||||||
end)
|
end)
|
||||||
return "<Ignore>"
|
return "<Ignore>"
|
||||||
end, "previous hunk", bufnr)
|
end, "previous hunk", bufnr)
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
local lspconfig = require "lspconfig"
|
|
||||||
require "neodev".setup()
|
|
||||||
|
|
||||||
local capabilities = {}
|
|
||||||
|
|
||||||
local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
|
||||||
if has_cmp then
|
|
||||||
capabilities = cmp_lsp.default_capabilities()
|
|
||||||
end
|
|
||||||
|
|
||||||
local eslint = {
|
|
||||||
lintCommand = [[eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}]],
|
|
||||||
lintIgnoreExitCode = true,
|
|
||||||
lintStdin = true,
|
|
||||||
lintFormats = {
|
|
||||||
"%f(%l,%c): %tarning %m",
|
|
||||||
"%f(%l,%c): %rror %m",
|
|
||||||
},
|
|
||||||
lintSource = "eslint",
|
|
||||||
}
|
|
||||||
|
|
||||||
local shellcheck = {
|
|
||||||
lintCommand = "shellcheck -f gcc -x",
|
|
||||||
lintSource = "shellcheck",
|
|
||||||
lintFormats = {
|
|
||||||
"%f:%l:%c: %trror: %m",
|
|
||||||
"%f:%l:%c: %tarning: %m",
|
|
||||||
"%f:%l:%c: %tote: %m",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local servers = {
|
|
||||||
efm = {
|
|
||||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" },
|
|
||||||
init_options = { documentFormatting = true },
|
|
||||||
settings = {
|
|
||||||
rootMarkers = { ".git/" },
|
|
||||||
languages = {
|
|
||||||
typescript = { eslint },
|
|
||||||
typescriptreact = { eslint },
|
|
||||||
javascript = { eslint },
|
|
||||||
javascriptreact = { eslint },
|
|
||||||
sh = { shellcheck },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
gopls = {},
|
|
||||||
nil_ls = {
|
|
||||||
settings = {
|
|
||||||
['nil'] = {
|
|
||||||
formatting = {
|
|
||||||
command = { "nixpkgs-fmt" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rust_analyzer = {
|
|
||||||
assist = {
|
|
||||||
importGranularity = "module",
|
|
||||||
importPrefix = "self",
|
|
||||||
},
|
|
||||||
cargo = {
|
|
||||||
buildScripts = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
procMacro = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lua_ls = {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
|
||||||
},
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lexical = {
|
|
||||||
cmd = { "lexical" },
|
|
||||||
},
|
|
||||||
gleam = {},
|
|
||||||
ts_ls = {
|
|
||||||
root_dir = function(filename, _)
|
|
||||||
local deno = lspconfig.util.root_pattern("deno.json", "deno.jsonc")(filename)
|
|
||||||
if deno then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return lspconfig.util.root_pattern("package.json")(filename)
|
|
||||||
end,
|
|
||||||
single_file_support = false,
|
|
||||||
},
|
|
||||||
denols = {
|
|
||||||
root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
|
|
||||||
},
|
|
||||||
intelephense = {
|
|
||||||
settings = {
|
|
||||||
intelephense = {
|
|
||||||
files = { maxSize = 1000000000 },
|
|
||||||
format = { enable = false },
|
|
||||||
stubs = { "apache", "bcmath", "bz2", "calendar", "com_dotnet", "Core", "ctype", "curl", "date", "dba", "dom", "enchant", "exif", "FFI", "fileinfo", "filter", "fpm", "ftp", "gd", "gettext", "gmp", "hash", "iconv", "imap", "intl", "json", "ldap", "libxml", "mbstring", "meta", "mysqli", "oci8", "odbc", "openssl", "pcntl", "pcre", "PDO", "pdo_ibm", "pdo_mysql", "pdo_pgsql", "pdo_sqlite", "pgsql", "Phar", "posix", "pspell", "readline", "Reflection", "session", "shmop", "SimpleXML", "snmp", "soap", "sockets", "sodium", "SPL", "sqlite3", "standard", "superglobals", "sysvmsg", "sysvsem", "sysvshm", "tidy", "tokenizer", "xml", "xmlreader", "xmlrpc", "xmlwriter", "xsl", "wordpress", "Zend OPcache", "zip", "zlib", },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
zls = {},
|
|
||||||
bashls = {},
|
|
||||||
}
|
|
||||||
for lsp, settings in pairs(servers) do
|
|
||||||
lspconfig[lsp].setup(vim.tbl_extend("force", { capabilities = capabilities }, settings))
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
|
||||||
callback = function(args)
|
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
|
||||||
|
|
||||||
if client.server_capabilities.documentHighlightProvider then
|
|
||||||
vim.api.nvim_create_autocmd({ "CursorHold" }, {
|
|
||||||
callback = vim.lsp.buf.document_highlight,
|
|
||||||
buffer = args.buf,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
|
||||||
callback = vim.lsp.buf.clear_references,
|
|
||||||
buffer = args.buf,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,49 +0,0 @@
|
||||||
local telescope = require "telescope"
|
|
||||||
local builtin = require "telescope.builtin"
|
|
||||||
|
|
||||||
telescope.setup {
|
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true,
|
|
||||||
override_generic_sorter = true,
|
|
||||||
override_file_sorter = true,
|
|
||||||
case_mode = "smart_case",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local function project()
|
|
||||||
local exclusions = {
|
|
||||||
"**/.git/",
|
|
||||||
"*.svg",
|
|
||||||
"*.png",
|
|
||||||
"*.jpg",
|
|
||||||
}
|
|
||||||
|
|
||||||
local find_command = { "fd", "--hidden", "-t", "f" }
|
|
||||||
for _, value in ipairs(exclusions) do
|
|
||||||
table.insert(find_command, "--exclude")
|
|
||||||
table.insert(find_command, value)
|
|
||||||
end
|
|
||||||
|
|
||||||
builtin.find_files {
|
|
||||||
find_command = find_command,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local function dotfiles()
|
|
||||||
builtin.git_files {
|
|
||||||
shorten_path = true,
|
|
||||||
prompt_title = " ~ dotfiles ~ ",
|
|
||||||
cwd = vim.env.DOTFILES_DIRECTORY,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
telescope.load_extension("fzf")
|
|
||||||
telescope.load_extension("ui-select")
|
|
||||||
|
|
||||||
require("my.keymaps").telescope_keymaps {
|
|
||||||
project = project,
|
|
||||||
dotfiles = dotfiles,
|
|
||||||
builtin = builtin,
|
|
||||||
}
|
|
|
@ -1,12 +1,154 @@
|
||||||
|
local function config()
|
||||||
|
local lspconfig = require "lspconfig"
|
||||||
|
require "neodev".setup()
|
||||||
|
|
||||||
|
local capabilities = {}
|
||||||
|
|
||||||
|
local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
|
if has_cmp then
|
||||||
|
capabilities = cmp_lsp.default_capabilities()
|
||||||
|
end
|
||||||
|
|
||||||
|
local eslint = {
|
||||||
|
lintCommand = [[eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}]],
|
||||||
|
lintIgnoreExitCode = true,
|
||||||
|
lintStdin = true,
|
||||||
|
lintFormats = {
|
||||||
|
"%f(%l,%c): %tarning %m",
|
||||||
|
"%f(%l,%c): %rror %m",
|
||||||
|
},
|
||||||
|
lintSource = "eslint",
|
||||||
|
}
|
||||||
|
|
||||||
|
local shellcheck = {
|
||||||
|
lintCommand = "shellcheck -f gcc -x",
|
||||||
|
lintSource = "shellcheck",
|
||||||
|
lintFormats = {
|
||||||
|
"%f:%l:%c: %trror: %m",
|
||||||
|
"%f:%l:%c: %tarning: %m",
|
||||||
|
"%f:%l:%c: %tote: %m",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local servers = {
|
||||||
|
efm = {
|
||||||
|
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" },
|
||||||
|
init_options = { documentFormatting = true },
|
||||||
|
settings = {
|
||||||
|
rootMarkers = { ".git/" },
|
||||||
|
languages = {
|
||||||
|
typescript = { eslint },
|
||||||
|
typescriptreact = { eslint },
|
||||||
|
javascript = { eslint },
|
||||||
|
javascriptreact = { eslint },
|
||||||
|
sh = { shellcheck },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
gopls = {},
|
||||||
|
nil_ls = {
|
||||||
|
settings = {
|
||||||
|
['nil'] = {
|
||||||
|
formatting = {
|
||||||
|
command = { "nixpkgs-fmt" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rust_analyzer = {
|
||||||
|
assist = {
|
||||||
|
importGranularity = "module",
|
||||||
|
importPrefix = "self",
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
buildScripts = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lua_ls = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
},
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lexical = {
|
||||||
|
cmd = { "lexical" },
|
||||||
|
},
|
||||||
|
gleam = {},
|
||||||
|
ts_ls = {
|
||||||
|
root_dir = function(filename, _)
|
||||||
|
local deno = lspconfig.util.root_pattern("deno.json", "deno.jsonc")(filename)
|
||||||
|
if deno then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return lspconfig.util.root_pattern("package.json")(filename)
|
||||||
|
end,
|
||||||
|
single_file_support = false,
|
||||||
|
},
|
||||||
|
denols = {
|
||||||
|
root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
|
||||||
|
},
|
||||||
|
intelephense = {
|
||||||
|
settings = {
|
||||||
|
intelephense = {
|
||||||
|
files = { maxSize = 1000000000 },
|
||||||
|
format = { enable = false },
|
||||||
|
stubs = { "apache", "bcmath", "bz2", "calendar", "com_dotnet", "Core", "ctype", "curl", "date", "dba", "dom", "enchant", "exif", "FFI", "fileinfo", "filter", "fpm", "ftp", "gd", "gettext", "gmp", "hash", "iconv", "imap", "intl", "json", "ldap", "libxml", "mbstring", "meta", "mysqli", "oci8", "odbc", "openssl", "pcntl", "pcre", "PDO", "pdo_ibm", "pdo_mysql", "pdo_pgsql", "pdo_sqlite", "pgsql", "Phar", "posix", "pspell", "readline", "Reflection", "session", "shmop", "SimpleXML", "snmp", "soap", "sockets", "sodium", "SPL", "sqlite3", "standard", "superglobals", "sysvmsg", "sysvsem", "sysvshm", "tidy", "tokenizer", "xml", "xmlreader", "xmlrpc", "xmlwriter", "xsl", "wordpress", "Zend OPcache", "zip", "zlib", },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
zls = {},
|
||||||
|
bashls = {},
|
||||||
|
}
|
||||||
|
for lsp, settings in pairs(servers) do
|
||||||
|
lspconfig[lsp].setup(vim.tbl_extend("force", { capabilities = capabilities }, settings))
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
|
||||||
|
if not client then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
|
vim.api.nvim_create_autocmd({ "CursorHold" }, {
|
||||||
|
callback = vim.lsp.buf.document_highlight,
|
||||||
|
buffer = args.buf,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
||||||
|
callback = vim.lsp.buf.clear_references,
|
||||||
|
buffer = args.buf,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = { "folke/neodev.nvim", },
|
||||||
"folke/neodev.nvim",
|
config = config,
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require "my.lsp"
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"j-hui/fidget.nvim",
|
"j-hui/fidget.nvim",
|
||||||
|
|
|
@ -7,6 +7,54 @@ return {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require "my.telescope"
|
local telescope = require "telescope"
|
||||||
|
local builtin = require "telescope.builtin"
|
||||||
|
|
||||||
|
telescope.setup {
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true,
|
||||||
|
override_generic_sorter = true,
|
||||||
|
override_file_sorter = true,
|
||||||
|
case_mode = "smart_case",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local function project()
|
||||||
|
local exclusions = {
|
||||||
|
"**/.git/",
|
||||||
|
"*.svg",
|
||||||
|
"*.png",
|
||||||
|
"*.jpg",
|
||||||
|
}
|
||||||
|
|
||||||
|
local find_command = { "fd", "--hidden", "-t", "f" }
|
||||||
|
for _, value in ipairs(exclusions) do
|
||||||
|
table.insert(find_command, "--exclude")
|
||||||
|
table.insert(find_command, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
builtin.find_files {
|
||||||
|
find_command = find_command,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function dotfiles()
|
||||||
|
builtin.git_files {
|
||||||
|
shorten_path = true,
|
||||||
|
prompt_title = " ~ dotfiles ~ ",
|
||||||
|
cwd = vim.env.DOTFILES_DIRECTORY,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
telescope.load_extension("fzf")
|
||||||
|
telescope.load_extension("ui-select")
|
||||||
|
|
||||||
|
require("my.keymaps").telescope_keymaps {
|
||||||
|
project = project,
|
||||||
|
dotfiles = dotfiles,
|
||||||
|
builtin = builtin,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue