mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-09-10 19:56:24 +00:00
Severel changes.
This commit is contained in:
35
.config/nvim/after/plugin/jira.lua
Normal file
35
.config/nvim/after/plugin/jira.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local nnoremap = require('halfdan.keymap').nnoremap
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require "telescope.actions.state"
|
||||
local worktree = require("git-worktree")
|
||||
|
||||
local function create_workspace_for_issue()
|
||||
require'telescope'.extensions.jira.live_search({
|
||||
attach_mappings =function ()
|
||||
actions.select_default:replace(
|
||||
function ()
|
||||
local selection = action_state.get_selected_entry()
|
||||
local branch_name = "fb/" .. selection.key:lower()
|
||||
vim.schedule(function ()
|
||||
-- Create worktree
|
||||
worktree.create_worktree(branch_name, branch_name, "origin")
|
||||
|
||||
end)
|
||||
end
|
||||
)
|
||||
return true
|
||||
end,
|
||||
assignee = "fbecker@adobe.com",
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
nnoremap("<leader>jw", function ()
|
||||
create_workspace_for_issue()
|
||||
end)
|
||||
|
||||
nnoremap("<leader>js", function ()
|
||||
require'telescope'.extensions.jira.live_search({
|
||||
project="BES"
|
||||
})
|
||||
end)
|
@@ -5,16 +5,12 @@ local inoremap = Remap.inoremap
|
||||
vim.fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"})
|
||||
vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"})
|
||||
vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"})
|
||||
vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
|
||||
-- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
|
||||
|
||||
-- Set Default Prefix.
|
||||
-- Note: You can set a prefix per lsp server in the lv-globals.lua file
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
-- virtual_text = {
|
||||
-- prefix = "",
|
||||
-- spacing = 1,
|
||||
-- },
|
||||
signs = true,
|
||||
underline = true,
|
||||
}
|
||||
@@ -42,6 +38,7 @@ local levels = {
|
||||
"DEBUG",
|
||||
[0] = "TRACE",
|
||||
}
|
||||
---@diagnostic disable-next-line: unused-vararg
|
||||
vim.lsp.handlers["window/showMessage"] = function(_, result, ...)
|
||||
if require("vim.lsp.log").should_log(convert_lsp_log_level_to_neovim_log_level(result.type)) then
|
||||
vim.notify(result.message, levels[result.type])
|
||||
@@ -50,63 +47,36 @@ end
|
||||
|
||||
-- symbols for autocomplete
|
||||
vim.lsp.protocol.CompletionItemKind = {
|
||||
" (Text) ",
|
||||
" (Method)",
|
||||
" (Function)",
|
||||
" (Constructor)",
|
||||
" ﴲ (Field)",
|
||||
"[] (Variable)",
|
||||
" (Class)",
|
||||
" ﰮ (Interface)",
|
||||
" (Module)",
|
||||
" 襁 (Property)",
|
||||
" (Unit)",
|
||||
" (Value)",
|
||||
" 練 (Enum)",
|
||||
" (Keyword)",
|
||||
" (Snippet)",
|
||||
" (Color)",
|
||||
" (File)",
|
||||
" (Reference)",
|
||||
" (Folder)",
|
||||
" (EnumMember)",
|
||||
" ﲀ (Constant)",
|
||||
" ﳤ (Struct)",
|
||||
" (Event)",
|
||||
" (Operator)",
|
||||
" (TypeParameter)"
|
||||
" (Text) ",
|
||||
" (Method)",
|
||||
" (Function)",
|
||||
" (Constructor)",
|
||||
" ﴲ (Field)",
|
||||
"[] (Variable)",
|
||||
" (Class)",
|
||||
" ﰮ (Interface)",
|
||||
" (Module)",
|
||||
" 襁 (Property)",
|
||||
" (Unit)",
|
||||
" (Value)",
|
||||
" 練 (Enum)",
|
||||
" (Keyword)",
|
||||
" (Snippet)",
|
||||
" (Color)",
|
||||
" (File)",
|
||||
" (Reference)",
|
||||
" (Folder)",
|
||||
" (EnumMember)",
|
||||
" ﲀ (Constant)",
|
||||
" ﳤ (Struct)",
|
||||
" (Event)",
|
||||
" (Operator)",
|
||||
" (TypeParameter)"
|
||||
}
|
||||
|
||||
local function documentHighlight(client, bufnr)
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]],
|
||||
false
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- -- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
|
||||
-- vim.cmd([[
|
||||
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
|
||||
-- au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||
-- ]])
|
||||
|
||||
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>Lspsaga show_line_diagnostics<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- LSP settings
|
||||
@@ -116,16 +86,19 @@ lsp_status.register_progress()
|
||||
local lspconfig = require 'lspconfig'
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
nnoremap("gd", function() vim.lsp.buf.definition() end)
|
||||
nnoremap("gd", "<cmd>Lspsaga peek_definition<CR>")
|
||||
nnoremap("<leader>gd", function ()
|
||||
vim.lsp.buf.definition()
|
||||
end)
|
||||
nnoremap("gD", function() vim.lsp.buf.declaration() end)
|
||||
nnoremap("K", function() vim.lsp.buf.hover() end)
|
||||
nnoremap("K", "<cmd>Lspsaga hover_doc<CR>")
|
||||
nnoremap("gW", function() vim.lsp.buf.workspace_symbol() end)
|
||||
nnoremap("<leader>vd", function() vim.diagnostic.open_float() end)
|
||||
nnoremap("[d", function() vim.diagnostic.goto_next() end)
|
||||
nnoremap("]d", function() vim.diagnostic.goto_prev() end)
|
||||
nnoremap("<leader>ca", function() vim.lsp.buf.code_action() end)
|
||||
nnoremap("[d", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
||||
nnoremap("]d", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
||||
nnoremap("<leader>ca", "<cmd>Lspsaga code_action<CR>")
|
||||
nnoremap("gr", function() vim.lsp.buf.references() end)
|
||||
nnoremap("<leader>rn", function() vim.lsp.buf.rename() end)
|
||||
nnoremap("<leader>rn", "<cmd>Lspsaga rename<CR>")
|
||||
nnoremap("<leader>cl", function() vim.lsp.codelens.run() end)
|
||||
nnoremap("<leader>fa", function() vim.lsp.buf.format{async = true} end)
|
||||
inoremap("<C-h>", function() vim.lsp.buf.signature_help() end)
|
||||
@@ -187,18 +160,26 @@ lspconfig.sumneko_lua.setup(config({
|
||||
}
|
||||
}))
|
||||
|
||||
-- Generic language server. Used to run credo
|
||||
lspconfig.efm.setup(config({
|
||||
on_attach = on_attach,
|
||||
filetypes = {"elixir"}
|
||||
}))
|
||||
|
||||
require('rust-tools').setup({
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
parameter_hints_prefix = "← ",
|
||||
other_hints_prefix = "➜ ",
|
||||
}
|
||||
tools = {
|
||||
runnables = {
|
||||
use_telescope = true,
|
||||
},
|
||||
inlay_hints = {
|
||||
auto = true,
|
||||
parameter_hints_prefix = "",
|
||||
other_hints_prefix = "",
|
||||
}
|
||||
},
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
@@ -1 +1,3 @@
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
-- Load ows snippets
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./snippets" } })
|
||||
|
@@ -2,21 +2,28 @@ local nnoremap = require('halfdan.keymap').nnoremap
|
||||
local neotest = require('neotest')
|
||||
|
||||
neotest.setup({
|
||||
log_level = vim.log.levels.DEBUG,
|
||||
adapters = {
|
||||
require("neotest-elixir"),
|
||||
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
|
||||
require("neotest-elixir")({
|
||||
args = { "--trace" },
|
||||
}),
|
||||
require("neotest-rust"),
|
||||
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
|
||||
},
|
||||
})
|
||||
|
||||
nnoremap("<leader>nt", function ()
|
||||
nnoremap("<leader>nt", function()
|
||||
neotest.run.run()
|
||||
end)
|
||||
|
||||
nnoremap("<leader>nf", function ()
|
||||
nnoremap("<leader>nf", function()
|
||||
neotest.run.run(vim.fn.expand("%"))
|
||||
end)
|
||||
|
||||
nnoremap("<leader>nd", function ()
|
||||
neotest.run.run({strategy = "dap"})
|
||||
nnoremap("<leader>nd", function()
|
||||
neotest.run.run({ strategy = "dap" })
|
||||
end)
|
||||
|
||||
nnoremap("<leader>ns", function()
|
||||
neotest.summary.toggle()
|
||||
end)
|
||||
|
12
.config/nvim/after/plugin/null-ls.lua
Normal file
12
.config/nvim/after/plugin/null-ls.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local ok, nls = pcall(require, 'null-ls')
|
||||
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
nls.setup({
|
||||
sources = {
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.diagnostics.credo,
|
||||
},
|
||||
})
|
@@ -10,7 +10,12 @@ nnoremap("<C-p>", function()
|
||||
end)
|
||||
|
||||
nnoremap("<Leader>ff", function()
|
||||
builtin.find_files()
|
||||
builtin.find_files({
|
||||
hidden=true,
|
||||
})
|
||||
end)
|
||||
nnoremap("<Leader>fh", function()
|
||||
builtin.find_files{cwd=vim.fn.expand('%:p:h')}
|
||||
end)
|
||||
|
||||
nnoremap("<Leader>fs", function()
|
||||
|
Reference in New Issue
Block a user