mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-09-10 19:56:24 +00:00
nvim
This commit is contained in:
13
.config/nvim/after/plugin/elixir.lua
Normal file
13
.config/nvim/after/plugin/elixir.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
local elixir = require("elixir")
|
||||
|
||||
elixir.setup {
|
||||
nextls = {
|
||||
enable = true, -- defaults to false
|
||||
},
|
||||
credo = {
|
||||
enable = false, -- defaults to true
|
||||
},
|
||||
elixirls = {
|
||||
enable = false,
|
||||
}
|
||||
}
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local Worktree = require("git-worktree")
|
||||
local Job = require("plenary.job")
|
||||
local FTerm = require("FTerm")
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local nnoremap = require('halfdan.keymap').nnoremap
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require "telescope.actions.state"
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
local Remap = require("halfdan.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local vnoremap = Remap.vnoremap
|
||||
@@ -5,17 +6,23 @@ local inoremap = Remap.inoremap
|
||||
local xnoremap = Remap.xnoremap
|
||||
local nmap = Remap.nmap
|
||||
|
||||
-- better window movement
|
||||
-- nnoremap('<C-h>', '<C-w>h')
|
||||
-- nnoremap('<C-j>', '<C-w>j')
|
||||
-- nnoremap('<C-k>', '<C-w>k')
|
||||
-- nnoremap('<C-l>', '<C-w>l')
|
||||
-- Yank until end of line
|
||||
nnoremap('Y', 'yg$')
|
||||
-- Next item, but center line
|
||||
nnoremap('n', 'nzzzv')
|
||||
nnoremap('N', 'Nzzzv')
|
||||
-- Join line but keep cursor intact
|
||||
nnoremap('J', 'mzJ`z')
|
||||
|
||||
-- resize with arrows
|
||||
nnoremap('<C-Up>', ':resize -2<CR>')
|
||||
nnoremap('<C-Down>', ':resize +2<CR>')
|
||||
nnoremap('<C-Left>', ':vertical resize -2<CR>')
|
||||
nnoremap('<C-Right>', ':vertical resize +2<CR>')
|
||||
-- Move selected line / block of text in visual mode
|
||||
xnoremap('J', ':move \'>+1<CR>gv-gv')
|
||||
xnoremap('K', ':move \'<-2<CR>gv-gv')
|
||||
|
||||
nnoremap('Q', '<Nop>')
|
||||
|
||||
-- better indenting
|
||||
vnoremap('<', '<gv')
|
||||
vnoremap('>', '>gv')
|
||||
|
||||
-- improved keyboard support for navigation (especially terminal)
|
||||
nnoremap('<leader>h', '<C-w>h')
|
||||
@@ -31,6 +38,17 @@ nnoremap('<A-l>', '<C-w>l')
|
||||
nnoremap('<leader>th', '<C-w>t<C-w>H')
|
||||
nnoremap('<leader>tk', '<C-w>t<C-w>K')
|
||||
|
||||
-- Keybindings below this are neovim cli only
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
-- resize with arrows
|
||||
nnoremap('<C-Up>', ':resize -2<CR>')
|
||||
nnoremap('<C-Down>', ':resize +2<CR>')
|
||||
nnoremap('<C-Left>', ':vertical resize -2<CR>')
|
||||
nnoremap('<C-Right>', ':vertical resize +2<CR>')
|
||||
|
||||
-- Make adjusting split sizes a bit more friendly
|
||||
vim.cmd([[
|
||||
noremap <silent> <C-Left> :vertical resize +3<CR>
|
||||
@@ -39,10 +57,6 @@ vim.cmd([[
|
||||
noremap <silent> <C-Down> :resize -3<CR>
|
||||
]])
|
||||
|
||||
-- better indenting
|
||||
vnoremap('<', '<gv')
|
||||
vnoremap('>', '>gv')
|
||||
|
||||
-- Tab switch buffer
|
||||
nnoremap('<TAB>', ':bnext<CR>')
|
||||
nnoremap('<S-TAB>', ':bprevious<CR>')
|
||||
@@ -51,11 +65,6 @@ nnoremap('<S-TAB>', ':bprevious<CR>')
|
||||
nnoremap('[q', ':cprev<CR>')
|
||||
nnoremap(']q', ':cnext<CR>')
|
||||
|
||||
-- Move selected line / block of text in visual mode
|
||||
xnoremap('J', ':move \'>+1<CR>gv-gv')
|
||||
xnoremap('K', ':move \'<-2<CR>gv-gv')
|
||||
|
||||
nnoremap('Q', '<Nop>')
|
||||
|
||||
-- Tagbar
|
||||
nnoremap('<Leader>hl', ':nohl<CR>')
|
||||
@@ -85,10 +94,3 @@ nnoremap("<C-t>", function() require("harpoon.ui").nav_file(2) end)
|
||||
nnoremap("<C-n>", function() require("harpoon.ui").nav_file(3) end)
|
||||
nnoremap("<C-s>", function() require("harpoon.ui").nav_file(4) end)
|
||||
|
||||
-- Yank until end of line
|
||||
nnoremap('Y', 'yg$')
|
||||
-- Next item, but center line
|
||||
nnoremap('n', 'nzzzv')
|
||||
nnoremap('N', 'Nzzzv')
|
||||
-- Join line but keep cursor intact
|
||||
nnoremap('J', 'mzJ`z')
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local Remap = require("halfdan.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
@@ -120,45 +124,76 @@ local function config(_config)
|
||||
return _config
|
||||
end
|
||||
|
||||
local elixir = require('elixir')
|
||||
elixir.setup(config({
|
||||
-- repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls
|
||||
-- branch = "mh/all-workspace-symbols", -- defaults to nil, just checkouts out the default branch, mutually exclusive with the `tag` option
|
||||
cmd = {"/usr/local/opt/elixir-ls/rel/language_server.sh"},
|
||||
settings = elixir.settings({
|
||||
dialyzerEnabled = true,
|
||||
fetchDeps = false,
|
||||
enableTestLenses = true,
|
||||
suggestSpecs = false,
|
||||
}),
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
|
||||
local map_opts = { buffer = true, noremap = true}
|
||||
|
||||
-- remove the pipe operator
|
||||
vim.keymap.set("n", "<leader>fp", ":ElixirFromPipe<cr>", map_opts)
|
||||
-- add the pipe operator
|
||||
vim.keymap.set("n", "<leader>tp", ":ElixirToPipe<cr>", map_opts)
|
||||
vim.keymap.set("v", "<leader>em", ":ElixirExpandMacro<cr>", map_opts)
|
||||
end
|
||||
}))
|
||||
local elixir = require("elixir")
|
||||
local elixirls = require("elixir.elixirls")
|
||||
|
||||
elixir.setup {
|
||||
credo = {},
|
||||
elixirls = {
|
||||
enabled = true,
|
||||
settings = elixirls.settings {
|
||||
dialyzerEnabled = false,
|
||||
enableTestLenses = false,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
|
||||
end,
|
||||
}
|
||||
}
|
||||
-- local elixir = require('elixir')
|
||||
-- elixir.setup(config({
|
||||
-- -- repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls
|
||||
-- -- branch = "mh/all-workspace-symbols", -- defaults to nil, just checkouts out the default branch, mutually exclusive with the `tag` option
|
||||
-- cmd = {"/opt/elixir-ls/rel/language_server.sh"},
|
||||
-- settings = elixir.settings({
|
||||
-- dialyzerEnabled = true,
|
||||
-- fetchDeps = false,
|
||||
-- enableTestLenses = true,
|
||||
-- suggestSpecs = false,
|
||||
-- }),
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- on_attach(client, bufnr)
|
||||
--
|
||||
-- local map_opts = { buffer = true, noremap = true}
|
||||
--
|
||||
-- -- remove the pipe operator
|
||||
-- vim.keymap.set("n", "<leader>fp", ":ElixirFromPipe<cr>", map_opts)
|
||||
-- -- add the pipe operator
|
||||
-- vim.keymap.set("n", "<leader>tp", ":ElixirToPipe<cr>", map_opts)
|
||||
-- vim.keymap.set("v", "<leader>em", ":ElixirExpandMacro<cr>", map_opts)
|
||||
-- end
|
||||
-- }))
|
||||
--
|
||||
-- Enable the following language servers
|
||||
local servers = { 'gopls', 'julials', 'rust_analyzer', 'pyright' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup(config())
|
||||
end
|
||||
|
||||
lspconfig.sumneko_lua.setup(config({
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require('rust-tools').setup({
|
||||
tools = {
|
||||
|
@@ -1,5 +1,9 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local saga = require 'lspsaga'
|
||||
saga.init_lsp_saga({
|
||||
saga.setup({
|
||||
-- symbols in winbar
|
||||
-- symbol_in_winbar = {
|
||||
-- enable = true,
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
-- Load ows snippets
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./snippets" } })
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local nnoremap = require('halfdan.keymap').nnoremap
|
||||
local neotest = require('neotest')
|
||||
|
||||
@@ -6,6 +10,7 @@ neotest.setup({
|
||||
adapters = {
|
||||
require("neotest-elixir")({
|
||||
args = { "--trace" },
|
||||
write_delay = 0,
|
||||
}),
|
||||
require("neotest-rust"),
|
||||
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
require('notify').setup({
|
||||
background_colour = "#000000",
|
||||
max_width = 120,
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local ok, nls = pcall(require, 'null-ls')
|
||||
|
||||
if not ok then
|
||||
|
@@ -1,8 +1,12 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd([[
|
||||
let g:sneak#label = 1
|
||||
let g:sneak#prompt = '🔎'
|
||||
let g:sneak#s_next = 1
|
||||
|
||||
let test#strategy = "neovim"
|
||||
let test#neovim#term_position = "vert rightbelow 50"
|
||||
let test#neovim#term_position = "vert rightbelow 80"
|
||||
]])
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local Remap = require("halfdan.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local builtin = require("telescope.builtin")
|
||||
@@ -10,9 +14,10 @@ nnoremap("<C-p>", function()
|
||||
end)
|
||||
|
||||
nnoremap("<Leader>ff", function()
|
||||
builtin.find_files({
|
||||
hidden=true,
|
||||
})
|
||||
require('telescope').extensions.smart_open.smart_open({cwd_only = true})
|
||||
-- builtin.find_files({
|
||||
-- hidden=true,
|
||||
-- })
|
||||
end)
|
||||
nnoremap("<Leader>fh", function()
|
||||
builtin.find_files{cwd=vim.fn.expand('%:p:h')}
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
textobjects = {
|
||||
select = {
|
||||
|
Reference in New Issue
Block a user