diff --git a/.config/efm-langserver/config.yaml b/.config/efm-langserver/config.yaml new file mode 100644 index 0000000..a6c0c8a --- /dev/null +++ b/.config/efm-langserver/config.yaml @@ -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 diff --git a/.config/nvim/after/plugin/git-worktree.lua b/.config/nvim/after/plugin/git-worktree.lua index a6ebb5c..2e38c5b 100644 --- a/.config/nvim/after/plugin/git-worktree.lua +++ b/.config/nvim/after/plugin/git-worktree.lua @@ -1,19 +1,40 @@ local Worktree = require("git-worktree") local Job = require("plenary.job") +local function schedule_notify(message) + vim.schedule(function() + vim.notify.notify(message) + end) +end + local function is_massdriver() return not not (string.find(vim.loop.cwd(), "massdriver.git", 1, true)) end -Worktree.on_tree_change(function (op, metadata) +Worktree.on_tree_change(function(op, metadata) 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 - local deps_job = Job:new({ - "mix", "deps.get" - }) deps_job:and_then(compile_job) deps_job:sync() compile_job:wait() diff --git a/.config/nvim/after/plugin/keymappings.lua b/.config/nvim/after/plugin/keymappings.lua index 53114d0..048862e 100644 --- a/.config/nvim/after/plugin/keymappings.lua +++ b/.config/nvim/after/plugin/keymappings.lua @@ -67,16 +67,23 @@ nnoremap('ta', ':TestSuite') nnoremap('tl', ':TestLast') nnoremap('tg', ':TestVisit') +-- Vim Projectionist +nnoremap('a', ':A') + -- Reload init.lua nnoremap('sv', ':source $MYVIMRC') -vim.cmd("nnoremap :Lspsaga diagnostic_jump_prev") -vim.cmd("nnoremap :Lspsaga diagnostic_jump_next") --- -- scroll down hover doc or scroll in definition preview -vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll_with_saga(1)") --- -- scroll up hover doc -vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1)") -vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') +nnoremap('', ':Lspsaga diagnostic_jump_prev') +nnoremap('', ':Lspsaga diagnostic_jump_next') + +-- Harpoon +nnoremap("m", function() require("harpoon.mark").add_file() end) +nnoremap("", function() require("harpoon.ui").toggle_quick_menu() end) + +nnoremap("", function() require("harpoon.ui").nav_file(1) end) +nnoremap("", function() require("harpoon.ui").nav_file(2) end) +nnoremap("", function() require("harpoon.ui").nav_file(3) end) +nnoremap("", function() require("harpoon.ui").nav_file(4) end) -- Yank until end of line nnoremap('Y', 'yg$') diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 9aee52f..db2c989 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -21,7 +21,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( ) -- 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) if lsp_log_level == 1 then @@ -151,6 +151,7 @@ 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, @@ -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({ tools = { inlay_hints = { diff --git a/.config/nvim/after/plugin/neotest.lua b/.config/nvim/after/plugin/neotest.lua index c3bc03b..819bed3 100644 --- a/.config/nvim/after/plugin/neotest.lua +++ b/.config/nvim/after/plugin/neotest.lua @@ -1,6 +1,22 @@ -require("neotest").setup({ +local nnoremap = require('halfdan.keymap').nnoremap +local neotest = require('neotest') + +neotest.setup({ adapters = { - require("neotest-vim-test")({ allow_file_types = { "haskell"} }), - require("neotest-elixir") + require("neotest-elixir"), +-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }), }, }) + +nnoremap("nt", function () + neotest.run.run() +end) + +nnoremap("nf", function () + neotest.run.run(vim.fn.expand("%")) +end) + +nnoremap("nd", function () + neotest.run.run({strategy = "dap"}) +end) + diff --git a/.config/nvim/after/plugin/notify.lua b/.config/nvim/after/plugin/notify.lua index ba4462b..8a87aba 100644 --- a/.config/nvim/after/plugin/notify.lua +++ b/.config/nvim/after/plugin/notify.lua @@ -1,3 +1,5 @@ require('notify').setup({ background_colour = "#000000", + max_width = 120, + max_height = 10, }) diff --git a/.config/nvim/lua/halfdan/debugger/elixir.lua b/.config/nvim/lua/halfdan/debugger/elixir.lua index f120aa7..b4ba915 100644 --- a/.config/nvim/lua/halfdan/debugger/elixir.lua +++ b/.config/nvim/lua/halfdan/debugger/elixir.lua @@ -2,7 +2,7 @@ local dap = require('dap') dap.adapters.mix_task = { 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 = {} } diff --git a/.config/nvim/lua/halfdan/init.lua b/.config/nvim/lua/halfdan/init.lua index 85600c5..200d32b 100644 --- a/.config/nvim/lua/halfdan/init.lua +++ b/.config/nvim/lua/halfdan/init.lua @@ -1,21 +1,21 @@ -require("halfdan.settings") require("halfdan.packer") +require("halfdan.settings") + require("impatient") require("halfdan.neogit") +require("halfdan.neorg") require('halfdan.globals') require('halfdan.keymap') - +require('halfdan.cmp') +require('halfdan.luasnip') require('halfdan.colorscheme') require('halfdan.treesitter') require('halfdan.telescope') - require('halfdan.lualine') -require('halfdan.themes.nord') - require('halfdan.autocmds') require('halfdan.debugger') diff --git a/.config/nvim/lua/halfdan/lualine.lua b/.config/nvim/lua/halfdan/lualine.lua index e288782..2488586 100644 --- a/.config/nvim/lua/halfdan/lualine.lua +++ b/.config/nvim/lua/halfdan/lualine.lua @@ -1,4 +1,4 @@ -require'lualine'.setup { +require 'lualine'.setup { options = { icons_enabled = true, theme = 'gruvbox-baby', @@ -7,18 +7,18 @@ require'lualine'.setup { disabled_filetypes = {} }, sections = { - lualine_a = {'mode'}, - lualine_b = {'branch'}, - lualine_c = { 'filename', 'diff' }, - lualine_x = {"require'lsp-status'.status()", 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { "require'lsp-status'.status()", 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } }, inactive_sections = { lualine_a = {}, lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, lualine_y = {}, lualine_z = {} }, @@ -28,9 +28,12 @@ require'lualine'.setup { lualine_a = { }, lualine_b = {}, - lualine_c = {'filename' }, + lualine_c = { 'filename' }, lualine_x = {}, lualine_y = {}, lualine_z = {} + }, + inactive_winbar = { + lualine_c = { 'filename' }, } } diff --git a/.config/nvim/lua/halfdan/neogit.lua b/.config/nvim/lua/halfdan/neogit.lua index 95d2a5b..314ffdf 100644 --- a/.config/nvim/lua/halfdan/neogit.lua +++ b/.config/nvim/lua/halfdan/neogit.lua @@ -1,7 +1,11 @@ local neogit = require('neogit') local nnoremap = require('halfdan.keymap').nnoremap -neogit.setup {} +neogit.setup { + integrations = { + diffview = true + } +} nnoremap("gs", function() neogit.open({ }) diff --git a/.config/nvim/lua/halfdan/neorg.lua b/.config/nvim/lua/halfdan/neorg.lua index 990103c..fee47f7 100644 --- a/.config/nvim/lua/halfdan/neorg.lua +++ b/.config/nvim/lua/halfdan/neorg.lua @@ -1,32 +1,37 @@ local neorg = require("neorg") neorg.setup({ - load = { - ["core.defaults"] = {}, - ["core.norg.dirman"] = { - config = { - workspaces = { - work = "~/org/work", - home = "~/org/home", - } - } - }, - ["core.gtd.base"] = { - config = { - workspace = "work", - }, - }, - ["core.norg.completion"] = { - config = { - engine = "nvim-cmp", - }, - }, - ["core.norg.concealer"] = {}, - ["core.norg.journal"] = { - config = { - strategy = "flat", - }, - }, - ["core.integrations.telescope"] = {}, - } + load = { + ["core.defaults"] = {}, + ["core.norg.dirman"] = { + config = { + workspaces = { + work = "~/org/work", + home = "~/org/home", + } + } + }, + ["core.gtd.base"] = { + config = { + workspace = "work", + }, + }, + ["core.norg.completion"] = { + config = { + engine = "nvim-cmp", + }, + }, + ["core.norg.concealer"] = {}, + ["core.norg.journal"] = { + config = { + strategy = "flat", + }, + }, + ["core.integrations.telescope"] = {}, + ["core.norg.esupports.metagen"] = { + config = { + type = "auto", + }, + }, + } }) diff --git a/.config/nvim/lua/halfdan/packer.lua b/.config/nvim/lua/halfdan/packer.lua index 6ee74bb..74e7d5a 100644 --- a/.config/nvim/lua/halfdan/packer.lua +++ b/.config/nvim/lua/halfdan/packer.lua @@ -37,7 +37,7 @@ return require("packer").startup({ use 'lewis6991/impatient.nvim' - use {'TimUntersberger/neogit' } + use {'TimUntersberger/neogit', requires = {'sindrets/diffview.nvim' } } use {'airblade/vim-gitgutter'} -- use {'andymass/vim-matchup'} @@ -52,7 +52,6 @@ return require("packer").startup({ use {'tpope/vim-dispatch'} -- Treesitter - use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', @@ -86,15 +85,9 @@ return require("packer").startup({ use {'rcarriga/nvim-notify'} - use { - "nvim-neorg/neorg", - event = "BufEnter", - after = "nvim-treesitter", - config = function() - require 'halfdan.neorg' - end - } - use {'nvim-neorg/neorg-telescope', after = "neorg"} + use { "nvim-neorg/neorg" } + use {'nvim-neorg/neorg-telescope'} + use{ "mickael-menu/zk-nvim" } use {'justinmk/vim-sneak'} @@ -107,13 +100,7 @@ return require("packer").startup({ 'williamboman/nvim-lsp-installer', } - use { - 'L3MON4D3/LuaSnip', - event = "InsertEnter", - config = function() - require 'halfdan.luasnip' - end, - } + use {'L3MON4D3/LuaSnip'} use {"rafamadriz/friendly-snippets", after="LuaSnip"} use { @@ -127,12 +114,7 @@ return require("packer").startup({ { 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' }, { 'hrsh7th/cmp-cmdline', after = 'nvim-cmp', event = 'CmdlineEnter' }, {'tzachar/cmp-tabnine', run = './install.sh', after = 'nvim-cmp' } - }, - config = function() - require 'halfdan.cmp' - end, - event = 'InsertEnter', - after = 'LuaSnip', + } } use {'glepnir/lspsaga.nvim'} @@ -140,7 +122,7 @@ return require("packer").startup({ -- Used to display LSP status in Lualine use {'nvim-lua/lsp-status.nvim'} - --use {'simrat39/symbols-outline.nvim'} + use {'simrat39/symbols-outline.nvim'} use { 'numToStr/Comment.nvim', config = function() @@ -150,11 +132,10 @@ return require("packer").startup({ -- Telescope fuzzy find files/grep use {'nvim-lua/popup.nvim'} use {'nvim-lua/plenary.nvim'} - use {'nvim-telescope/telescope.nvim'} - use {'theprimeagen/git-worktree.nvim'} + use {'theprimeagen/harpoon'} -- Debugging use("mfussenegger/nvim-dap") @@ -170,10 +151,12 @@ return require("packer").startup({ -- vim.g.latex_to_unicode_auto = 1 -- themes & colorschemes - use {'arcticicestudio/nord-vim'} - use {'joshdick/onedark.vim'} use {'gruvbox-community/gruvbox'} use {'luisiacc/gruvbox-baby'} + use { + 'https://gitlab.com/__tpb/monokai-pro.nvim', + as = 'monokai-pro.nvim' + } end, config = { display = { diff --git a/.config/nvim/lua/halfdan/settings.lua b/.config/nvim/lua/halfdan/settings.lua index 8a5d163..a51d4ae 100644 --- a/.config/nvim/lua/halfdan/settings.lua +++ b/.config/nvim/lua/halfdan/settings.lua @@ -1,29 +1,26 @@ vim.notify = require("notify") -vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" -vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. -vim.cmd('set inccommand=split') -- Make substitution work in realtime +vim.opt.iskeyword:append("-") -- treat dash separated words as a word text object" +vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|. +vim.opt.inccommand = "split" -- Make substitution work in realtime vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers vim.o.title = true -TERMINAL = vim.fn.expand('$TERMINAL') -vim.cmd('let &titleold="'..TERMINAL..'"') vim.o.titlestring="%<%F%=%l/%L - nvim" 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('syntax on') -- syntax highlighting +-- vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys +-- vim.cmd('syntax on') -- syntax highlighting vim.o.pumheight = 10 -- Makes popup menu smaller vim.o.fileencoding = "utf-8" -- The encoding written to file 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.splitbelow = true -- Horizontal splits will automatically be below 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.opt.conceallevel = 2 vim.opt.concealcursor = 'nc' -vim.cmd('set ts=2') -- Insert 4 spaces for a tab -vim.cmd('set sw=2') -- Change the number of space characters inserted for indentation -vim.cmd('set expandtab') -- Converts tabs to spaces +vim.o.tabstop = 2 -- Insert 4 spaces for a tab +vim.o.shiftwidth = 2 -- Change the number of space characters inserted for indentation +vim.o.expandtab = true -- Converts tabs to spaces vim.bo.smartindent = false -- Makes indenting smart vim.wo.number = true -- set numbered lines vim.wo.relativenumber = true -- set relative number diff --git a/.config/nvim/lua/halfdan/telescope.lua b/.config/nvim/lua/halfdan/telescope.lua index e46f5d9..ce122aa 100644 --- a/.config/nvim/lua/halfdan/telescope.lua +++ b/.config/nvim/lua/halfdan/telescope.lua @@ -5,10 +5,8 @@ require("telescope").load_extension("git_worktree") -- Global remapping require('telescope').setup { defaults = { - find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, - file_ignore_patterns = {"_build", "node_modules", "deps" }, - prompt_position = "bottom", - --prompt_prefix = " ", + find_command = { 'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, + file_ignore_patterns = { "_build", "node_modules", "deps" }, prompt_prefix = "  ", selection_caret = " ", entry_prefix = " ", @@ -16,9 +14,10 @@ require('telescope').setup { selection_strategy = "reset", sorting_strategy = "descending", layout_strategy = "horizontal", - layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, + layout_defaults = { horizontal = { mirror = false }, vertical = { mirror = false } }, + layout_config = { prompt_position = "bottom" }, + file_sorter = require 'telescope.sorters'.get_fuzzy_file, + generic_sorter = require 'telescope.sorters'.get_generic_fuzzy_sorter, shorten_path = true, winblend = 0, width = 0.75, @@ -26,15 +25,15 @@ require('telescope').setup { results_height = 1, results_width = 0.8, border = {}, - borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, + borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, color_devicons = true, use_less = true, - set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, + set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil, + file_previewer = require 'telescope.previewers'.vim_buffer_cat.new, + grep_previewer = require 'telescope.previewers'.vim_buffer_vimgrep.new, + qflist_previewer = require 'telescope.previewers'.vim_buffer_qflist.new, -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, + buffer_previewer_maker = require 'telescope.previewers'.buffer_previewer_maker, mappings = { i = { [""] = actions.move_selection_next, @@ -62,6 +61,18 @@ require('telescope').setup { } } }, + pickers = { + buffers = { + mappings = { + n = { + ['d'] = actions.delete_buffer + }, -- n + i = { + [''] = actions.delete_buffer + }, + } + } + }, extensions = { fzy_native = { override_generic_sorter = false, diff --git a/.config/nvim/lua/halfdan/themes/nord.lua b/.config/nvim/lua/halfdan/themes/nord.lua deleted file mode 100644 index 39ff3e9..0000000 --- a/.config/nvim/lua/halfdan/themes/nord.lua +++ /dev/null @@ -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 diff --git a/.config/nvim/lua/halfdan/treesitter.lua b/.config/nvim/lua/halfdan/treesitter.lua index 6d1e96f..9235149 100644 --- a/.config/nvim/lua/halfdan/treesitter.lua +++ b/.config/nvim/lua/halfdan/treesitter.lua @@ -1,16 +1,14 @@ 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" }, highlight = { enable = true, - additional_vim_regex_highlighting = {'org'}, }, indent = { enable = true, - disable = { 'org' }, }, incremental_selection = { - enable = false, + enable = true, keymaps = { init_selection = "gnn", node_incremental = "grn", diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index d59e683..aa26e59 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -73,6 +73,7 @@ set -g default-terminal "screen-256color" # Terminal type configuration set -ga terminal-overrides ",screen-256color:RGB" +set -ag terminal-overrides ",alacritty:RGB" # Start window numbering at specific num set -g base-index 1 @@ -80,6 +81,9 @@ set -g base-index 1 # Renumber windows on window close set -g renumber-windows on +# Set vi mode +setw -g mode-keys vi + ####################################################### # 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 -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 ###################################################################### diff --git a/.config/wezterm/wezterm.lua b/.config/wezterm/wezterm.lua new file mode 100644 index 0000000..b342ca7 --- /dev/null +++ b/.config/wezterm/wezterm.lua @@ -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, +}