Many changes

This commit is contained in:
Fabian Becker 2022-10-16 15:44:07 +02:00
parent eb17f0ab25
commit f5a7947005
18 changed files with 222 additions and 122 deletions

View File

@ -0,0 +1,22 @@
version: 2
tools:
mix_credo: &mix_credo
lint-command: "MIX_ENV=test mix credo suggest --format=flycheck --read-from-stdin ${INPUT}"
lint-stdin: true
lint-formats:
- '%f:%l:%c: %t: %m'
- '%f:%l: %t: %m'
lint-ignore-exit-code: true
lint-category-map:
R: N
D: I
F: E
W: W
root-markers:
- mix.lock
- mix.exs
languages:
elixir:
- <<: *mix_credo

View File

@ -1,19 +1,40 @@
local Worktree = require("git-worktree") local Worktree = require("git-worktree")
local Job = require("plenary.job") local Job = require("plenary.job")
local function schedule_notify(message)
vim.schedule(function()
vim.notify.notify(message)
end)
end
local function is_massdriver() local function is_massdriver()
return not not (string.find(vim.loop.cwd(), "massdriver.git", 1, true)) return not not (string.find(vim.loop.cwd(), "massdriver.git", 1, true))
end end
Worktree.on_tree_change(function(op, metadata) Worktree.on_tree_change(function(op, metadata)
local compile_job = Job:new({ local compile_job = Job:new({
"mix", "compile" command = "mix",
args = { "compile" },
on_start = function()
schedule_notify("Compiling...")
end,
on_exit = function(_j, _return_val)
schedule_notify("Compiling done")
end
})
local deps_job = Job:new({
command = "mix",
args = { "deps.get" },
on_start = function()
schedule_notify("Fetching dependencies...")
end,
on_exit = function(_j, _return_val)
schedule_notify("Fetched dependencies")
end
}) })
if op == Worktree.Operations.Create and is_massdriver() then if op == Worktree.Operations.Create and is_massdriver() then
local deps_job = Job:new({
"mix", "deps.get"
})
deps_job:and_then(compile_job) deps_job:and_then(compile_job)
deps_job:sync() deps_job:sync()
compile_job:wait() compile_job:wait()

View File

@ -67,16 +67,23 @@ nnoremap('<leader>ta', ':TestSuite<CR>')
nnoremap('<leader>tl', ':TestLast<CR>') nnoremap('<leader>tl', ':TestLast<CR>')
nnoremap('<leader>tg', ':TestVisit<CR>') nnoremap('<leader>tg', ':TestVisit<CR>')
-- Vim Projectionist
nnoremap('<leader>a', ':A<CR>')
-- Reload init.lua -- Reload init.lua
nnoremap('<leader>sv', ':source $MYVIMRC<CR>') nnoremap('<leader>sv', ':source $MYVIMRC<CR>')
vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") nnoremap('<C-p>', ':Lspsaga diagnostic_jump_prev<CR>')
vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>") nnoremap('<C-y>', ':Lspsaga diagnostic_jump_next<CR>')
-- -- scroll down hover doc or scroll in definition preview
vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>") -- Harpoon
-- -- scroll up hover doc nnoremap("<leader>m", function() require("harpoon.mark").add_file() end)
vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>") nnoremap("<C-e>", function() require("harpoon.ui").toggle_quick_menu() end)
vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
nnoremap("<C-h>", function() require("harpoon.ui").nav_file(1) end)
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 -- Yank until end of line
nnoremap('Y', 'yg$') nnoremap('Y', 'yg$')

View File

@ -21,7 +21,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
) )
-- Setup for nvim-notify -- Setup for nvim-notify
vim.lsp.set_log_level(1 ) vim.lsp.set_log_level(2)
local convert_lsp_log_level_to_neovim_log_level = function(lsp_log_level) local convert_lsp_log_level_to_neovim_log_level = function(lsp_log_level)
if lsp_log_level == 1 then if lsp_log_level == 1 then
@ -151,6 +151,7 @@ local elixir = require('elixir')
elixir.setup(config({ elixir.setup(config({
-- repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls -- 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 -- 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({ settings = elixir.settings({
dialyzerEnabled = true, dialyzerEnabled = true,
fetchDeps = false, fetchDeps = false,
@ -186,6 +187,12 @@ 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({ require('rust-tools').setup({
tools = { tools = {
inlay_hints = { inlay_hints = {

View File

@ -1,6 +1,22 @@
require("neotest").setup({ local nnoremap = require('halfdan.keymap').nnoremap
local neotest = require('neotest')
neotest.setup({
adapters = { adapters = {
require("neotest-vim-test")({ allow_file_types = { "haskell"} }), require("neotest-elixir"),
require("neotest-elixir") -- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
}, },
}) })
nnoremap("<leader>nt", function ()
neotest.run.run()
end)
nnoremap("<leader>nf", function ()
neotest.run.run(vim.fn.expand("%"))
end)
nnoremap("<leader>nd", function ()
neotest.run.run({strategy = "dap"})
end)

View File

@ -1,3 +1,5 @@
require('notify').setup({ require('notify').setup({
background_colour = "#000000", background_colour = "#000000",
max_width = 120,
max_height = 10,
}) })

View File

@ -2,7 +2,7 @@ local dap = require('dap')
dap.adapters.mix_task = { dap.adapters.mix_task = {
type = 'executable', type = 'executable',
command = '/home/halfdan/opt/elixir-ls/bin/debugger.sh', -- debugger.bat for windows command = '/usr/local/opt/elixir-ls/rel/debugger.sh', -- debugger.bat for windows
args = {} args = {}
} }

View File

@ -1,21 +1,21 @@
require("halfdan.settings")
require("halfdan.packer") require("halfdan.packer")
require("halfdan.settings")
require("impatient") require("impatient")
require("halfdan.neogit") require("halfdan.neogit")
require("halfdan.neorg")
require('halfdan.globals') require('halfdan.globals')
require('halfdan.keymap') require('halfdan.keymap')
require('halfdan.cmp')
require('halfdan.luasnip')
require('halfdan.colorscheme') require('halfdan.colorscheme')
require('halfdan.treesitter') require('halfdan.treesitter')
require('halfdan.telescope') require('halfdan.telescope')
require('halfdan.lualine') require('halfdan.lualine')
require('halfdan.themes.nord')
require('halfdan.autocmds') require('halfdan.autocmds')
require('halfdan.debugger') require('halfdan.debugger')

View File

@ -8,8 +8,8 @@ require'lualine'.setup {
}, },
sections = { sections = {
lualine_a = { 'mode' }, lualine_a = { 'mode' },
lualine_b = {'branch'}, lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename', 'diff' }, lualine_c = { 'filename' },
lualine_x = { "require'lsp-status'.status()", 'filetype' }, lualine_x = { "require'lsp-status'.status()", 'filetype' },
lualine_y = { 'progress' }, lualine_y = { 'progress' },
lualine_z = { 'location' } lualine_z = { 'location' }
@ -32,5 +32,8 @@ require'lualine'.setup {
lualine_x = {}, lualine_x = {},
lualine_y = {}, lualine_y = {},
lualine_z = {} lualine_z = {}
},
inactive_winbar = {
lualine_c = { 'filename' },
} }
} }

View File

@ -1,7 +1,11 @@
local neogit = require('neogit') local neogit = require('neogit')
local nnoremap = require('halfdan.keymap').nnoremap local nnoremap = require('halfdan.keymap').nnoremap
neogit.setup {} neogit.setup {
integrations = {
diffview = true
}
}
nnoremap("<leader>gs", function() nnoremap("<leader>gs", function()
neogit.open({ }) neogit.open({ })

View File

@ -28,5 +28,10 @@ neorg.setup({
}, },
}, },
["core.integrations.telescope"] = {}, ["core.integrations.telescope"] = {},
["core.norg.esupports.metagen"] = {
config = {
type = "auto",
},
},
} }
}) })

View File

@ -37,7 +37,7 @@ return require("packer").startup({
use 'lewis6991/impatient.nvim' use 'lewis6991/impatient.nvim'
use {'TimUntersberger/neogit' } use {'TimUntersberger/neogit', requires = {'sindrets/diffview.nvim' } }
use {'airblade/vim-gitgutter'} use {'airblade/vim-gitgutter'}
-- use {'andymass/vim-matchup'} -- use {'andymass/vim-matchup'}
@ -52,7 +52,6 @@ return require("packer").startup({
use {'tpope/vim-dispatch'} use {'tpope/vim-dispatch'}
-- Treesitter -- Treesitter
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate', run = ':TSUpdate',
@ -86,15 +85,9 @@ return require("packer").startup({
use {'rcarriga/nvim-notify'} use {'rcarriga/nvim-notify'}
use { use { "nvim-neorg/neorg" }
"nvim-neorg/neorg", use {'nvim-neorg/neorg-telescope'}
event = "BufEnter", use{ "mickael-menu/zk-nvim" }
after = "nvim-treesitter",
config = function()
require 'halfdan.neorg'
end
}
use {'nvim-neorg/neorg-telescope', after = "neorg"}
use {'justinmk/vim-sneak'} use {'justinmk/vim-sneak'}
@ -107,13 +100,7 @@ return require("packer").startup({
'williamboman/nvim-lsp-installer', 'williamboman/nvim-lsp-installer',
} }
use { use {'L3MON4D3/LuaSnip'}
'L3MON4D3/LuaSnip',
event = "InsertEnter",
config = function()
require 'halfdan.luasnip'
end,
}
use {"rafamadriz/friendly-snippets", after="LuaSnip"} use {"rafamadriz/friendly-snippets", after="LuaSnip"}
use { use {
@ -127,12 +114,7 @@ return require("packer").startup({
{ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' }, { 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-cmdline', after = 'nvim-cmp', event = 'CmdlineEnter' }, { 'hrsh7th/cmp-cmdline', after = 'nvim-cmp', event = 'CmdlineEnter' },
{'tzachar/cmp-tabnine', run = './install.sh', after = 'nvim-cmp' } {'tzachar/cmp-tabnine', run = './install.sh', after = 'nvim-cmp' }
}, }
config = function()
require 'halfdan.cmp'
end,
event = 'InsertEnter',
after = 'LuaSnip',
} }
use {'glepnir/lspsaga.nvim'} use {'glepnir/lspsaga.nvim'}
@ -140,7 +122,7 @@ return require("packer").startup({
-- Used to display LSP status in Lualine -- Used to display LSP status in Lualine
use {'nvim-lua/lsp-status.nvim'} use {'nvim-lua/lsp-status.nvim'}
--use {'simrat39/symbols-outline.nvim'} use {'simrat39/symbols-outline.nvim'}
use { use {
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function() config = function()
@ -150,11 +132,10 @@ return require("packer").startup({
-- Telescope fuzzy find files/grep -- Telescope fuzzy find files/grep
use {'nvim-lua/popup.nvim'} use {'nvim-lua/popup.nvim'}
use {'nvim-lua/plenary.nvim'} use {'nvim-lua/plenary.nvim'}
use {'nvim-telescope/telescope.nvim'} use {'nvim-telescope/telescope.nvim'}
use {'theprimeagen/git-worktree.nvim'} use {'theprimeagen/git-worktree.nvim'}
use {'theprimeagen/harpoon'}
-- Debugging -- Debugging
use("mfussenegger/nvim-dap") use("mfussenegger/nvim-dap")
@ -170,10 +151,12 @@ return require("packer").startup({
-- vim.g.latex_to_unicode_auto = 1 -- vim.g.latex_to_unicode_auto = 1
-- themes & colorschemes -- themes & colorschemes
use {'arcticicestudio/nord-vim'}
use {'joshdick/onedark.vim'}
use {'gruvbox-community/gruvbox'} use {'gruvbox-community/gruvbox'}
use {'luisiacc/gruvbox-baby'} use {'luisiacc/gruvbox-baby'}
use {
'https://gitlab.com/__tpb/monokai-pro.nvim',
as = 'monokai-pro.nvim'
}
end, end,
config = { config = {
display = { display = {

View File

@ -1,29 +1,26 @@
vim.notify = require("notify") vim.notify = require("notify")
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" vim.opt.iskeyword:append("-") -- treat dash separated words as a word text object"
vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
vim.cmd('set inccommand=split') -- Make substitution work in realtime vim.opt.inccommand = "split" -- Make substitution work in realtime
vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers
vim.o.title = true vim.o.title = true
TERMINAL = vim.fn.expand('$TERMINAL')
vim.cmd('let &titleold="'..TERMINAL..'"')
vim.o.titlestring="%<%F%=%l/%L - nvim" vim.o.titlestring="%<%F%=%l/%L - nvim"
vim.wo.wrap = false -- Display long lines as just one line vim.wo.wrap = false -- Display long lines as just one line
vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys -- vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
vim.cmd('syntax on') -- syntax highlighting -- vim.cmd('syntax on') -- syntax highlighting
vim.o.pumheight = 10 -- Makes popup menu smaller vim.o.pumheight = 10 -- Makes popup menu smaller
vim.o.fileencoding = "utf-8" -- The encoding written to file vim.o.fileencoding = "utf-8" -- The encoding written to file
vim.o.cmdheight = 1 -- More space for displaying messages vim.o.cmdheight = 1 -- More space for displaying messages
vim.cmd('set colorcolumn=99999') -- fix indentline for now
vim.o.mouse = "a" -- Enable your mouse vim.o.mouse = "a" -- Enable your mouse
vim.o.splitbelow = true -- Horizontal splits will automatically be below vim.o.splitbelow = true -- Horizontal splits will automatically be below
vim.o.termguicolors = true -- set term gui colors most terminals support this vim.o.termguicolors = true -- set term gui colors most terminals support this
vim.o.splitright = true -- Vertical splits will automatically be to the right vim.o.splitright = true -- Vertical splits will automatically be to the right
vim.opt.conceallevel = 2 vim.opt.conceallevel = 2
vim.opt.concealcursor = 'nc' vim.opt.concealcursor = 'nc'
vim.cmd('set ts=2') -- Insert 4 spaces for a tab vim.o.tabstop = 2 -- Insert 4 spaces for a tab
vim.cmd('set sw=2') -- Change the number of space characters inserted for indentation vim.o.shiftwidth = 2 -- Change the number of space characters inserted for indentation
vim.cmd('set expandtab') -- Converts tabs to spaces vim.o.expandtab = true -- Converts tabs to spaces
vim.bo.smartindent = false -- Makes indenting smart vim.bo.smartindent = false -- Makes indenting smart
vim.wo.number = true -- set numbered lines vim.wo.number = true -- set numbered lines
vim.wo.relativenumber = true -- set relative number vim.wo.relativenumber = true -- set relative number

View File

@ -7,8 +7,6 @@ require('telescope').setup {
defaults = { defaults = {
find_command = { 'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, find_command = { 'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' },
file_ignore_patterns = { "_build", "node_modules", "deps" }, file_ignore_patterns = { "_build", "node_modules", "deps" },
prompt_position = "bottom",
--prompt_prefix = " ",
prompt_prefix = "", prompt_prefix = "",
selection_caret = "", selection_caret = "",
entry_prefix = " ", entry_prefix = " ",
@ -17,6 +15,7 @@ require('telescope').setup {
sorting_strategy = "descending", sorting_strategy = "descending",
layout_strategy = "horizontal", layout_strategy = "horizontal",
layout_defaults = { horizontal = { mirror = false }, vertical = { mirror = false } }, layout_defaults = { horizontal = { mirror = false }, vertical = { mirror = false } },
layout_config = { prompt_position = "bottom" },
file_sorter = require 'telescope.sorters'.get_fuzzy_file, file_sorter = require 'telescope.sorters'.get_fuzzy_file,
generic_sorter = require 'telescope.sorters'.get_generic_fuzzy_sorter, generic_sorter = require 'telescope.sorters'.get_generic_fuzzy_sorter,
shorten_path = true, shorten_path = true,
@ -62,6 +61,18 @@ require('telescope').setup {
} }
} }
}, },
pickers = {
buffers = {
mappings = {
n = {
['d'] = actions.delete_buffer
}, -- n
i = {
['<c-d>'] = actions.delete_buffer
},
}
}
},
extensions = { extensions = {
fzy_native = { fzy_native = {
override_generic_sorter = false, override_generic_sorter = false,

View File

@ -1,4 +0,0 @@
vim.g.nord_cursor_line_number_background = 1
vim.g.nord_bold = 1
vim.g.nord_italic = 1
vim.g.nord_italic_comments = 1

View File

@ -1,16 +1,14 @@
require('nvim-treesitter.configs').setup({ require('nvim-treesitter.configs').setup({
ensure_installed = { "python", "go", "elixir", "rust", "gomod", "json", "lua", "ruby", "yaml", "org" }, ensure_installed = { "python", "go", "elixir", "rust", "gomod", "json", "lua", "ruby", "yaml", "norg", "query" },
ignore_install = { "haskell" }, ignore_install = { "haskell" },
highlight = { highlight = {
enable = true, enable = true,
additional_vim_regex_highlighting = {'org'},
}, },
indent = { indent = {
enable = true, enable = true,
disable = { 'org' },
}, },
incremental_selection = { incremental_selection = {
enable = false, enable = true,
keymaps = { keymaps = {
init_selection = "gnn", init_selection = "gnn",
node_incremental = "grn", node_incremental = "grn",

View File

@ -73,6 +73,7 @@ set -g default-terminal "screen-256color"
# Terminal type configuration # Terminal type configuration
set -ga terminal-overrides ",screen-256color:RGB" set -ga terminal-overrides ",screen-256color:RGB"
set -ag terminal-overrides ",alacritty:RGB"
# Start window numbering at specific num # Start window numbering at specific num
set -g base-index 1 set -g base-index 1
@ -80,6 +81,9 @@ set -g base-index 1
# Renumber windows on window close # Renumber windows on window close
set -g renumber-windows on set -g renumber-windows on
# Set vi mode
setw -g mode-keys vi
####################################################### #######################################################
# KEY BINDING # KEY BINDING
####################################################### #######################################################
@ -103,6 +107,11 @@ bind-key C-a send-prefix
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind P paste-buffer
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
###################################################################### ######################################################################
# END OF GENERAL CONFIGURATIONS # END OF GENERAL CONFIGURATIONS
###################################################################### ######################################################################

View File

@ -0,0 +1,19 @@
local wezterm = require"wezterm"
return {
-- Font settings
font = wezterm.font_with_fallback {
'FiraCode Nerd Font Mono',
'Jetbrains Mono'
},
font_size = 18,
color_scheme = "Gruvbox Dark",
-- Tab bar
show_tab_index_in_tab_bar = false,
hide_tab_bar_if_only_one_tab = true,
-- Window look
window_decorations = "RESIZE",
-- Wayland
enable_wayland = true,
}