mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-11-01 13:06:03 +00:00
Refactor entire conf
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
local Remap = require("halfdan.keymap")
|
local Remap = require("halfdan.keymap")
|
||||||
local nnoremap = Remap.nnoremap
|
local nnoremap = Remap.nnoremap
|
||||||
local vnoremap = Remap.vnoremap
|
local vnoremap = Remap.vnoremap
|
||||||
local inoremap = Remap.inoremap
|
local inoremap = Remap.inoremap
|
||||||
local tnoremap = Remap.tnoremap
|
local tnoremap = Remap.tnoremap
|
||||||
local xnoremap = Remap.xnoremap
|
local xnoremap = Remap.xnoremap
|
||||||
local nmap = Remap.nmap
|
|
||||||
|
|
||||||
-- Yank until end of line
|
-- Yank until end of line
|
||||||
nnoremap('Y', 'yg$')
|
nnoremap('Y', 'yg$')
|
||||||
@@ -108,20 +106,23 @@ nnoremap('<leader>sv', ':source $MYVIMRC<CR>')
|
|||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
nnoremap("<leader>gg", function()
|
nnoremap("<leader>gg", function()
|
||||||
-- builtin.live_grep()
|
|
||||||
require "telescope".extensions.egrepify.egrepify { sorting_strategy = 'ascending' }
|
require "telescope".extensions.egrepify.egrepify { sorting_strategy = 'ascending' }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
nnoremap("<leader>gs", function()
|
||||||
|
require('neogit').open({ kind = 'split' })
|
||||||
|
end)
|
||||||
|
|
||||||
nnoremap("<C-p>", function()
|
nnoremap("<C-p>", function()
|
||||||
builtin.find_files()
|
builtin.find_files()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
nnoremap("<Leader>ff", function()
|
nnoremap("<Leader>ff", function()
|
||||||
require('telescope').extensions.smart_open.smart_open({cwd_only = true})
|
require('telescope').extensions.smart_open.smart_open({ cwd_only = true })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
nnoremap("<Leader>fh", function()
|
nnoremap("<Leader>fh", function()
|
||||||
builtin.find_files{cwd=vim.fn.expand('%:p:h')}
|
builtin.find_files { cwd = vim.fn.expand('%:p:h') }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
nnoremap("<leader>gw", function()
|
nnoremap("<leader>gw", function()
|
||||||
@@ -136,4 +137,18 @@ nnoremap("<leader>gc", function()
|
|||||||
builtin.git_branches()
|
builtin.git_branches()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
nnoremap("<leader>nt", function()
|
||||||
|
require("neotest").run.run()
|
||||||
|
end)
|
||||||
|
|
||||||
|
nnoremap("<leader>nf", function()
|
||||||
|
require("neotest").run.run(vim.fn.expand("%"))
|
||||||
|
end)
|
||||||
|
|
||||||
|
nnoremap("<leader>nd", function()
|
||||||
|
require("neotest").run.run({ strategy = "dap" })
|
||||||
|
end)
|
||||||
|
|
||||||
|
nnoremap("<leader>ns", function()
|
||||||
|
require("neotest").summary.toggle()
|
||||||
|
end)
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ if vim.g.vscode then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
underline = true,
|
underline = true,
|
||||||
signs = {
|
signs = {
|
||||||
@@ -81,11 +79,11 @@ end, { noremap = true, silent = true })
|
|||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
vim.keymap.set('n', ']d', function()
|
vim.keymap.set('n', ']d', function()
|
||||||
vim.diagnostic.jump_next()
|
vim.diagnostic.goto_next()
|
||||||
end, { desc = "Go to next diagnostic" })
|
end, { desc = "Go to next diagnostic" })
|
||||||
|
|
||||||
vim.keymap.set('n', '[d', function()
|
vim.keymap.set('n', '[d', function()
|
||||||
vim.diagnostic.jump_prev()
|
vim.diagnostic.goto_prev()
|
||||||
end, { desc = "Go to previous diagnostic" })
|
end, { desc = "Go to previous diagnostic" })
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,7 @@ vim.diagnostic.config({
|
|||||||
},
|
},
|
||||||
}, neotest_ns)
|
}, neotest_ns)
|
||||||
|
|
||||||
neotest.setup({
|
|
||||||
log_level = vim.log.levels.DEBUG,
|
|
||||||
adapters = {
|
|
||||||
require("neotest-elixir")({
|
|
||||||
args = { "--trace" },
|
|
||||||
write_delay = 0,
|
|
||||||
}),
|
|
||||||
require("neotest-rust"),
|
|
||||||
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
|
|
||||||
require("neotest-golang")
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
nnoremap("<leader>nt", function()
|
nnoremap("<leader>nt", function()
|
||||||
neotest.run.run()
|
neotest.run.run()
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
if vim.g.vscode then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require('notify').setup({
|
|
||||||
background_colour = "#000000",
|
|
||||||
max_width = 120,
|
|
||||||
max_height = 10,
|
|
||||||
})
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
if vim.g.vscode then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Sneak
|
|
||||||
vim.g["sneak#label"] = 1
|
|
||||||
vim.g["sneak#prompt"] = "🔎"
|
|
||||||
vim.g["sneak#s_next"] = 1
|
|
||||||
|
|
||||||
-- Vim-Test
|
|
||||||
vim.g["test#strategy"] = "neovim"
|
|
||||||
vim.g["test#neovim#term_position"] = "vert rightbelow 80"
|
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
local vim = vim
|
|
||||||
local api = vim.api
|
|
||||||
|
|
||||||
vim.cmd([[autocmd TermOpen * setlocal nonumber norelativenumber]])
|
vim.cmd([[autocmd TermOpen * setlocal nonumber norelativenumber]])
|
||||||
|
|
||||||
local format_group = api.nvim_create_augroup("FormatGroup", { clear = true })
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
api.nvim_create_autocmd(
|
pattern = { "norg", "neorg" },
|
||||||
{ "BufWinEnter", "BufReadPost" },
|
callback = function()
|
||||||
{ pattern = "*", command = "normal zR", group = format_group }
|
if pcall(vim.treesitter.start) then
|
||||||
)
|
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
local cmp = require'cmp'
|
|
||||||
local lspkind = require('lspkind')
|
|
||||||
|
|
||||||
local source_mapping = {
|
|
||||||
buffer = "[Buffer]",
|
|
||||||
nvim_lsp = "[LSP]",
|
|
||||||
nvim_lua = "[Lua]",
|
|
||||||
path = "[Path]",
|
|
||||||
}
|
|
||||||
|
|
||||||
local has_words_before = function()
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and
|
|
||||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
|
|
||||||
col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
preselect = cmp.PreselectMode.None,
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
vim.snippet.expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
["<C-e>"] = cmp.mapping.close(),
|
|
||||||
["<CR>"] = cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = false, -- only confirm if explicitly selected
|
|
||||||
},
|
|
||||||
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif vim.snippet.active({ direction = 1 }) then
|
|
||||||
vim.snippet.jump(1)
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif vim.snippet.active({ direction = -1 }) then
|
|
||||||
vim.snippet.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
}, {
|
|
||||||
{ name = "buffer" },
|
|
||||||
}),
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
|
||||||
local menu = source_mapping[entry.source.name]
|
|
||||||
vim_item.menu = menu
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
experimental = {
|
|
||||||
ghost_text = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
}),
|
|
||||||
mappings = cmp.mapping.preset.cmdline(),
|
|
||||||
})
|
|
||||||
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
local dap = require("dap")
|
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
local daptext = require("nvim-dap-virtual-text")
|
local daptext = require("nvim-dap-virtual-text")
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
O = {
|
|
||||||
auto_close_tree = 0,
|
|
||||||
auto_complete = true,
|
|
||||||
background = 'dark',
|
|
||||||
ignorecase = 'smartcase',
|
|
||||||
clipboard = 'unnamedplus',
|
|
||||||
incsearch = true,
|
|
||||||
termguicolors = true,
|
|
||||||
colorscheme = 'monokai-pro',
|
|
||||||
hidden_files = true,
|
|
||||||
wrap_lines = false,
|
|
||||||
number = true,
|
|
||||||
relative_number = true,
|
|
||||||
shell = 'zsh',
|
|
||||||
timeoutlen = 500,
|
|
||||||
scrolloff = 8,
|
|
||||||
noshowmode = true,
|
|
||||||
splitright = true,
|
|
||||||
splitbelow = true,
|
|
||||||
|
|
||||||
database = {save_location = '~/.config/nvcode_db', auto_execute = 1},
|
|
||||||
}
|
|
||||||
|
|
||||||
DATA_PATH = vim.fn.stdpath('data')
|
|
||||||
CACHE_PATH = vim.fn.stdpath('cache')
|
|
||||||
@@ -5,15 +5,9 @@ if vim.g.vscode then
|
|||||||
else
|
else
|
||||||
-- ordinary Neovim
|
-- ordinary Neovim
|
||||||
require("halfdan.lazy")
|
require("halfdan.lazy")
|
||||||
vim.notify = require("notify")
|
|
||||||
|
|
||||||
require("halfdan.neogit")
|
|
||||||
-- require('halfdan.globals')
|
|
||||||
require('halfdan.keymap')
|
require('halfdan.keymap')
|
||||||
-- require('halfdan.cmp')
|
|
||||||
require('halfdan.colorscheme')
|
require('halfdan.colorscheme')
|
||||||
require('halfdan.treesitter')
|
|
||||||
require('halfdan.telescope')
|
|
||||||
require('halfdan.lualine')
|
require('halfdan.lualine')
|
||||||
|
|
||||||
require('halfdan.autocmds')
|
require('halfdan.autocmds')
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
if vim.g.vscode then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
@@ -11,366 +15,10 @@ if not vim.loop.fs_stat(lazypath) then
|
|||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
if vim.g.vscode then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
{
|
spec = {
|
||||||
"NeogitOrg/neogit",
|
-- import your plugins
|
||||||
dependencies = {
|
{ import = "halfdan.plugins" },
|
||||||
"nvim-lua/plenary.nvim", -- required
|
|
||||||
"nvim-telescope/telescope.nvim", -- optional
|
|
||||||
"sindrets/diffview.nvim", -- optional
|
|
||||||
"ibhagwan/fzf-lua", -- optional
|
|
||||||
},
|
},
|
||||||
config = true
|
checker = { enabled = true },
|
||||||
},
|
|
||||||
{'airblade/vim-gitgutter'},
|
|
||||||
|
|
||||||
-- Load .editorconfig files
|
|
||||||
{'editorconfig/editorconfig-vim'},
|
|
||||||
|
|
||||||
{
|
|
||||||
"m4xshen/hardtime.nvim",
|
|
||||||
lazy = false,
|
|
||||||
dependencies = { "MunifTanjim/nui.nvim" },
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"karb94/neoscroll.nvim",
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
{'junegunn/vim-easy-align'},
|
|
||||||
|
|
||||||
-- Goodies
|
|
||||||
{'tpope/vim-fugitive'},
|
|
||||||
{'tpope/vim-surround'}, -- ✅
|
|
||||||
{'tpope/vim-dispatch'},
|
|
||||||
|
|
||||||
-- Treesitter
|
|
||||||
{
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
branch = 'main',
|
|
||||||
build = ':TSUpdate',
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Testing
|
|
||||||
{'vim-test/vim-test'},
|
|
||||||
{
|
|
||||||
"nvim-neotest/neotest",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-neotest/nvim-nio",
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
"antoinemadec/FixCursorHold.nvim",
|
|
||||||
-- plugins
|
|
||||||
"fredrikaverpil/neotest-golang",
|
|
||||||
"jfpedroza/neotest-elixir",
|
|
||||||
"rouge8/neotest-rust",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{"nvim-neotest/neotest-vim-test" },
|
|
||||||
{'akinsho/toggleterm.nvim', version = "*", config = function()
|
|
||||||
require('toggleterm').setup({
|
|
||||||
open_mapping = [[<C-\>]],
|
|
||||||
start_in_insert = true,
|
|
||||||
direction = "horizontal",
|
|
||||||
autochdir = false,
|
|
||||||
size = 20,
|
|
||||||
highlights = {
|
|
||||||
FloatBorder = { link = "ToggleTermBorder" },
|
|
||||||
Normal = { link = "ToggleTerm" },
|
|
||||||
NormalFloat = { link = "ToggleTerm" },
|
|
||||||
},
|
|
||||||
winbar = {
|
|
||||||
enabled = true,
|
|
||||||
name_formatter = function(term)
|
|
||||||
return term.name
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end},
|
|
||||||
|
|
||||||
{'f-person/git-blame.nvim'},
|
|
||||||
-- Status Line and Bufferline
|
|
||||||
{
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
dependencies = {'kyazdani42/nvim-web-devicons'},
|
|
||||||
event = { "BufReadPost", "BufNewFile" },
|
|
||||||
opts = function()
|
|
||||||
local monokai_opts = require("halfdan.util").opts("monokai-pro.nvim")
|
|
||||||
return {
|
|
||||||
float = vim.tbl_contains(monokai_opts.background_clear or {}, "neo-tree"),
|
|
||||||
separator = "bubble", -- bubble | triangle
|
|
||||||
---@type any
|
|
||||||
colorful = true,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
config = function(_, opts)
|
|
||||||
local lualine_config = require("halfdan.lualine")
|
|
||||||
lualine_config.setup(opts)
|
|
||||||
lualine_config.load()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{'rcarriga/nvim-notify'},
|
|
||||||
|
|
||||||
{
|
|
||||||
"nvim-neorg/neorg",
|
|
||||||
lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
|
|
||||||
version = "*", -- Pin Neorg to the latest stable release
|
|
||||||
config = function()
|
|
||||||
require('neorg').setup({
|
|
||||||
load = {
|
|
||||||
["core.defaults"] = {},
|
|
||||||
["core.dirman"] = {
|
|
||||||
config = {
|
|
||||||
workspaces = {
|
|
||||||
work = "~/org/work",
|
|
||||||
home = "~/org/home",
|
|
||||||
},
|
|
||||||
index = "index.norg",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
-- ["core.completion"] = {
|
|
||||||
-- config = {
|
|
||||||
-- engine = "nvim-cmp",
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
["core.concealer"] = {},
|
|
||||||
["core.journal"] = {
|
|
||||||
config = {
|
|
||||||
strategy = "flat",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
["core.integrations.telescope"] = {},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{'nvim-neorg/neorg-telescope'},
|
|
||||||
|
|
||||||
{'justinmk/vim-sneak'},
|
|
||||||
|
|
||||||
{'machakann/vim-highlightedyank'},
|
|
||||||
|
|
||||||
{
|
|
||||||
'nvimdev/lspsaga.nvim',
|
|
||||||
config = function()
|
|
||||||
require('lspsaga').setup({
|
|
||||||
symbol_in_winbar = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
lightbulb = {
|
|
||||||
enable = false,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
dependencies = {
|
|
||||||
'nvim-treesitter/nvim-treesitter', -- optional
|
|
||||||
'nvim-tree/nvim-web-devicons' -- optional
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
-- {
|
|
||||||
-- 'hrsh7th/nvim-cmp',
|
|
||||||
-- dependencies = {
|
|
||||||
-- { 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
|
|
||||||
-- 'hrsh7th/cmp-nvim-lsp',
|
|
||||||
-- 'onsails/lspkind.nvim',
|
|
||||||
-- { 'hrsh7th/cmp-path', after = 'nvim-cmp' },
|
|
||||||
-- { 'hrsh7th/cmp-nvim-lua', after = 'nvim-cmp' },
|
|
||||||
-- { 'hrsh7th/cmp-cmdline', after = 'nvim-cmp', event = 'CmdlineEnter' },
|
|
||||||
-- {'petertriho/cmp-git', after = 'nvim-cmp'},
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
{
|
|
||||||
'saghen/blink.cmp',
|
|
||||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
|
||||||
version = '1.*',
|
|
||||||
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
|
||||||
-- build = 'cargo build --release',
|
|
||||||
-- If you use nix, you can build from source using latest nightly rust with:
|
|
||||||
-- build = 'nix run .#build-plugin',
|
|
||||||
|
|
||||||
---@module 'blink.cmp'
|
|
||||||
---@type blink.cmp.Config
|
|
||||||
opts = {
|
|
||||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
|
||||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
|
||||||
-- 'enter' for enter to accept
|
|
||||||
-- 'none' for no mappings
|
|
||||||
--
|
|
||||||
-- All presets have the following mappings:
|
|
||||||
-- C-space: Open menu or open docs if already open
|
|
||||||
-- C-n/C-p or Up/Down: Select next/previous item
|
|
||||||
-- C-e: Hide menu
|
|
||||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
|
||||||
--
|
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
|
||||||
keymap = { preset = 'super-tab' },
|
|
||||||
|
|
||||||
appearance = {
|
|
||||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
|
||||||
-- Adjusts spacing to ensure icons are aligned
|
|
||||||
nerd_font_variant = 'mono'
|
|
||||||
},
|
|
||||||
|
|
||||||
-- (Default) Only show the documentation popup when manually triggered
|
|
||||||
completion = { documentation = { auto_show = false } },
|
|
||||||
|
|
||||||
-- Default list of enabled providers defined so that you can extend it
|
|
||||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
|
||||||
sources = {
|
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
|
||||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
|
||||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
|
||||||
--
|
|
||||||
-- See the fuzzy documentation for more information
|
|
||||||
fuzzy = { implementation = "prefer_rust" }
|
|
||||||
},
|
|
||||||
opts_extend = { "sources.default" }
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Used to display LSP status in Lualine
|
|
||||||
{'nvim-lua/lsp-status.nvim'},
|
|
||||||
|
|
||||||
{
|
|
||||||
"hedyhli/outline.nvim",
|
|
||||||
lazy = true,
|
|
||||||
cmd = { "Outline", "OutlineOpen" },
|
|
||||||
keys = { -- Example mapping to toggle outline
|
|
||||||
{ "<leader>o", "<cmd>Outline<CR>", desc = "Toggle outline" },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
-- Your setup opts here
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'numToStr/Comment.nvim',
|
|
||||||
config = function()
|
|
||||||
require('Comment').setup()
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Telescope fuzzy find files/grep
|
|
||||||
{'nvim-lua/popup.nvim'},
|
|
||||||
{'nvim-lua/plenary.nvim'},
|
|
||||||
{
|
|
||||||
"fdschmidt93/telescope-egrepify.nvim",
|
|
||||||
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
|
||||||
},
|
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
|
||||||
{'nvim-telescope/telescope.nvim'},
|
|
||||||
{'nvim-telescope/telescope-dap.nvim'},
|
|
||||||
{
|
|
||||||
"danielfalk/smart-open.nvim",
|
|
||||||
branch = "0.2.x",
|
|
||||||
dependencies = {"kkharji/sqlite.lua"}
|
|
||||||
},
|
|
||||||
|
|
||||||
{'numToStr/FTerm.nvim'},
|
|
||||||
|
|
||||||
-- Debugging
|
|
||||||
"mfussenegger/nvim-dap",
|
|
||||||
"rcarriga/nvim-dap-ui",
|
|
||||||
"nvim-neotest/nvim-nio",
|
|
||||||
"theHamsta/nvim-dap-virtual-text",
|
|
||||||
"leoluz/nvim-dap-go",
|
|
||||||
|
|
||||||
-- => Language Support
|
|
||||||
{
|
|
||||||
"folke/neodev.nvim",
|
|
||||||
config = function()
|
|
||||||
require("neodev").setup({})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{'neovim/nvim-lspconfig'},
|
|
||||||
{'rust-lang/rust.vim'},
|
|
||||||
{
|
|
||||||
'mrcjkb/rustaceanvim',
|
|
||||||
version = '^6', -- Recommended
|
|
||||||
lazy = false, -- This plugin is already lazy
|
|
||||||
},
|
|
||||||
{'tpope/vim-projectionist'},
|
|
||||||
|
|
||||||
-- themes & colorschemes
|
|
||||||
{ "rose-pine/neovim", name = "rose-pine" },
|
|
||||||
{'luisiacc/gruvbox-baby'},
|
|
||||||
{'akinsho/bufferline.nvim', version = "*", dependencies = 'nvim-tree/nvim-web-devicons',
|
|
||||||
keys = {
|
|
||||||
{ "<C-1>", "<Cmd>BufferLineGoToBuffer 1<CR>", desc = "Go to buffer 1" },
|
|
||||||
{ "<C-2>", "<Cmd>BufferLineGoToBuffer 2<CR>", desc = "Go to buffer 2" },
|
|
||||||
{ "<C-3>", "<Cmd>BufferLineGoToBuffer 3<CR>", desc = "Go to buffer 3" },
|
|
||||||
{ "<C-4>", "<Cmd>BufferLineGoToBuffer 4<CR>", desc = "Go to buffer 4" },
|
|
||||||
{ "<C-5>", "<Cmd>BufferLineGoToBuffer 5<CR>", desc = "Go to buffer 5" },
|
|
||||||
{ "<C-6>", "<Cmd>BufferLineGoToBuffer 6<CR>", desc = "Go to buffer 6" },
|
|
||||||
{ "<C-7>", "<Cmd>BufferLineGoToBuffer 7<CR>", desc = "Go to buffer 7" },
|
|
||||||
{ "<C-8>", "<Cmd>BufferLineGoToBuffer 8<CR>", desc = "Go to buffer 8" },
|
|
||||||
{ "<C-9>", "<Cmd>BufferLineGoToBuffer 9<CR>", desc = "Go to buffer 9" },
|
|
||||||
{ "<S-l>", "<Cmd>BufferLineCycleNext<CR>", desc = "Next buffer" },
|
|
||||||
{ "<S-h>", "<Cmd>BufferLineCyclePrev<CR>", desc = "Previous buffer" },
|
|
||||||
{ "<A-S-l>", "<Cmd>BufferLineMoveNext<CR>", desc = "Move buffer right" },
|
|
||||||
{ "<A-S-h>", "<Cmd>BufferLineMovePrev<CR>", desc = "Move buffer left" },
|
|
||||||
},
|
|
||||||
opts = function()
|
|
||||||
local monokai_opts = require("halfdan.util").opts("monokai-pro.nvim")
|
|
||||||
return {
|
|
||||||
options = {
|
|
||||||
diagnostics = "nvim_lsp", -- | "nvim_lsp" | "coc",
|
|
||||||
-- separator_style = "", -- | "thick" | "thin" | "slope" | { 'any', 'any' },
|
|
||||||
separator_style = { "", "" }, -- | "thick" | "thin" | { 'any', 'any' },
|
|
||||||
-- separator_style = "slant", -- | "thick" | "thin" | { 'any', 'any' },
|
|
||||||
indicator = {
|
|
||||||
-- icon = " ",
|
|
||||||
-- style = 'icon',
|
|
||||||
style = "underline",
|
|
||||||
},
|
|
||||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
|
||||||
diagnostics_indicator = function(count, _, _, _)
|
|
||||||
if count > 9 then
|
|
||||||
return "9+"
|
|
||||||
end
|
|
||||||
return tostring(count)
|
|
||||||
end,
|
|
||||||
numbers = function(opts)
|
|
||||||
return string.format('%s', opts.raise(opts.ordinal))
|
|
||||||
end,
|
|
||||||
offsets = {
|
|
||||||
{
|
|
||||||
filetype = "neo-tree",
|
|
||||||
text = "EXPLORER",
|
|
||||||
text_align = "center",
|
|
||||||
separator = vim.tbl_contains(monokai_opts.background_clear or {}, "neo-tree"), -- set to `true` if clear background of neo-tree
|
|
||||||
},
|
|
||||||
{
|
|
||||||
filetype = "NvimTree",
|
|
||||||
text = "EXPLORER",
|
|
||||||
text_align = "center",
|
|
||||||
separator = vim.tbl_contains(monokai_opts.background_clear or {}, "nvim-tree"), -- set to `true` if clear background of neo-tree
|
|
||||||
},
|
|
||||||
},
|
|
||||||
hover = {
|
|
||||||
enabled = true,
|
|
||||||
delay = 0,
|
|
||||||
reveal = { "close" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
|
||||||
branch = "v3.x",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
local neogit = require('neogit')
|
|
||||||
local nnoremap = require('halfdan.keymap').nnoremap
|
|
||||||
|
|
||||||
neogit.setup {
|
|
||||||
integrations = {
|
|
||||||
diffview = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nnoremap("<leader>gs", function()
|
|
||||||
neogit.open({kind='split'})
|
|
||||||
end)
|
|
||||||
55
.config/nvim/lua/halfdan/plugins/blink.lua
Normal file
55
.config/nvim/lua/halfdan/plugins/blink.lua
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
'saghen/blink.cmp',
|
||||||
|
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||||
|
version = '1.*',
|
||||||
|
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
|
-- build = 'cargo build --release',
|
||||||
|
-- If you use nix, you can build from source using latest nightly rust with:
|
||||||
|
-- build = 'nix run .#build-plugin',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = { preset = 'super-tab' },
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = 'mono'
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = { documentation = { auto_show = false } },
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust" }
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" }
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
8
.config/nvim/lua/halfdan/plugins/debugging.lua
Normal file
8
.config/nvim/lua/halfdan/plugins/debugging.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
-- Debugging
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
}
|
||||||
35
.config/nvim/lua/halfdan/plugins/lsp.lua
Normal file
35
.config/nvim/lua/halfdan/plugins/lsp.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
return {
|
||||||
|
-- => Language Support
|
||||||
|
{
|
||||||
|
'nvimdev/lspsaga.nvim',
|
||||||
|
config = function()
|
||||||
|
require('lspsaga').setup({
|
||||||
|
symbol_in_winbar = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
lightbulb = {
|
||||||
|
enable = false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter', -- optional
|
||||||
|
'nvim-tree/nvim-web-devicons' -- optional
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/neodev.nvim",
|
||||||
|
config = function()
|
||||||
|
require("neodev").setup({})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
{ 'rust-lang/rust.vim' },
|
||||||
|
{
|
||||||
|
'mrcjkb/rustaceanvim',
|
||||||
|
version = '^6', -- Recommended
|
||||||
|
lazy = false, -- This plugin is already lazy
|
||||||
|
},
|
||||||
|
-- Used to display LSP status in Lualine
|
||||||
|
{ 'nvim-lua/lsp-status.nvim' },
|
||||||
|
}
|
||||||
18
.config/nvim/lua/halfdan/plugins/neogit.lua
Normal file
18
.config/nvim/lua/halfdan/plugins/neogit.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"NeogitOrg/neogit",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim", -- required
|
||||||
|
"nvim-telescope/telescope.nvim", -- optional
|
||||||
|
"sindrets/diffview.nvim", -- optional
|
||||||
|
"ibhagwan/fzf-lua", -- optional
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neogit").setup({
|
||||||
|
integrations = {
|
||||||
|
diffview = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
36
.config/nvim/lua/halfdan/plugins/neorg.lua
Normal file
36
.config/nvim/lua/halfdan/plugins/neorg.lua
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-neorg/neorg",
|
||||||
|
lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
|
||||||
|
version = "*", -- Pin Neorg to the latest stable release
|
||||||
|
config = function()
|
||||||
|
require('neorg').setup({
|
||||||
|
load = {
|
||||||
|
["core.defaults"] = {},
|
||||||
|
["core.dirman"] = {
|
||||||
|
config = {
|
||||||
|
workspaces = {
|
||||||
|
work = "~/org/work",
|
||||||
|
home = "~/org/home",
|
||||||
|
},
|
||||||
|
index = "index.norg",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- ["core.completion"] = {
|
||||||
|
-- config = {
|
||||||
|
-- engine = "nvim-cmp",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
["core.concealer"] = {},
|
||||||
|
["core.journal"] = {
|
||||||
|
config = {
|
||||||
|
strategy = "flat",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
["core.integrations.telescope"] = {},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ 'nvim-neorg/neorg-telescope' },
|
||||||
|
}
|
||||||
28
.config/nvim/lua/halfdan/plugins/neotest.lua
Normal file
28
.config/nvim/lua/halfdan/plugins/neotest.lua
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
return {
|
||||||
|
-- Testing
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
-- plugins
|
||||||
|
"fredrikaverpil/neotest-golang",
|
||||||
|
"jfpedroza/neotest-elixir",
|
||||||
|
"rouge8/neotest-rust",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neotest").setup({
|
||||||
|
log_level = vim.log.levels.DEBUG,
|
||||||
|
adapters = {
|
||||||
|
require("neotest-elixir")({
|
||||||
|
args = { "--trace" },
|
||||||
|
write_delay = 0,
|
||||||
|
}),
|
||||||
|
require("neotest-rust"),
|
||||||
|
require("neotest-golang")
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
105
.config/nvim/lua/halfdan/plugins/other.lua
Normal file
105
.config/nvim/lua/halfdan/plugins/other.lua
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
{ 'airblade/vim-gitgutter' },
|
||||||
|
|
||||||
|
-- Load .editorconfig files
|
||||||
|
{ 'editorconfig/editorconfig-vim' },
|
||||||
|
|
||||||
|
{
|
||||||
|
"m4xshen/hardtime.nvim",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = { "MunifTanjim/nui.nvim" },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"karb94/neoscroll.nvim",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
{ 'junegunn/vim-easy-align' },
|
||||||
|
|
||||||
|
-- Goodies
|
||||||
|
{ 'tpope/vim-fugitive' },
|
||||||
|
{ 'tpope/vim-surround' },
|
||||||
|
{ 'tpope/vim-dispatch' },
|
||||||
|
|
||||||
|
{
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
version = "*",
|
||||||
|
config = function()
|
||||||
|
require('toggleterm').setup({
|
||||||
|
open_mapping = [[<C-\>]],
|
||||||
|
start_in_insert = true,
|
||||||
|
direction = "horizontal",
|
||||||
|
autochdir = false,
|
||||||
|
size = 20,
|
||||||
|
highlights = {
|
||||||
|
FloatBorder = { link = "ToggleTermBorder" },
|
||||||
|
Normal = { link = "ToggleTerm" },
|
||||||
|
NormalFloat = { link = "ToggleTerm" },
|
||||||
|
},
|
||||||
|
winbar = {
|
||||||
|
enabled = true,
|
||||||
|
name_formatter = function(term)
|
||||||
|
return term.name
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
{ 'f-person/git-blame.nvim' },
|
||||||
|
{
|
||||||
|
'justinmk/vim-sneak',
|
||||||
|
config = function()
|
||||||
|
vim.g["sneak#label"] = 1
|
||||||
|
vim.g["sneak#prompt"] = "🔎"
|
||||||
|
vim.g["sneak#s_next"] = 1
|
||||||
|
|
||||||
|
-- Vim-Test
|
||||||
|
vim.g["test#strategy"] = "neovim"
|
||||||
|
vim.g["test#neovim#term_position"] = "vert rightbelow 80"
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
{ 'machakann/vim-highlightedyank' },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"hedyhli/outline.nvim",
|
||||||
|
lazy = true,
|
||||||
|
cmd = { "Outline", "OutlineOpen" },
|
||||||
|
keys = { -- Example mapping to toggle outline
|
||||||
|
{ "<leader>o", "<cmd>Outline<CR>", desc = "Toggle outline" },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
-- Your setup opts here
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
config = function()
|
||||||
|
require('Comment').setup()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'tpope/vim-projectionist',
|
||||||
|
config = function()
|
||||||
|
vim.g.projectionist_heuristics = {
|
||||||
|
["*.go"] = {
|
||||||
|
["*.go"] = {
|
||||||
|
alternate = "{}_test.go",
|
||||||
|
type = "source",
|
||||||
|
},
|
||||||
|
["*_test.go"] = {
|
||||||
|
alternate = "{}.go",
|
||||||
|
type = "test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
86
.config/nvim/lua/halfdan/plugins/telescope.lua
Normal file
86
.config/nvim/lua/halfdan/plugins/telescope.lua
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"fdschmidt93/telescope-egrepify.nvim",
|
||||||
|
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||||
|
},
|
||||||
|
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
config = function()
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
|
||||||
|
-- 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", ".git", ".elixir_ls" },
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
entry_prefix = " ",
|
||||||
|
-- borderchars = { "█", " ", "▀", "█", "█", " ", " ", "▀" },
|
||||||
|
file_sorter = require 'telescope'.extensions.fzf.get_fzf_sorter,
|
||||||
|
-- Developer configurations: Not meant for general override
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||||
|
-- To disable a keymap, put [map] = false
|
||||||
|
-- So, to not map "<C-n>", just put
|
||||||
|
-- ["<c-x>"] = false,
|
||||||
|
|
||||||
|
-- Otherwise, just set the mapping to the function that you want it to be.
|
||||||
|
-- ["<C-i>"] = actions.select_horizontal,
|
||||||
|
|
||||||
|
-- Add up multiple actions
|
||||||
|
["<CR>"] = actions.select_default + actions.center
|
||||||
|
|
||||||
|
-- You can perform as many actions in a row as you like
|
||||||
|
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||||
|
["<esc>"] = actions.close,
|
||||||
|
-- ["<C-i>"] = my_cool_custom_action,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
buffers = {
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
['d'] = actions.delete_buffer
|
||||||
|
}, -- n
|
||||||
|
i = {
|
||||||
|
['<c-d>'] = actions.delete_buffer
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
filename_first = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('telescope').load_extension("fzf")
|
||||||
|
require('telescope').load_extension("dap")
|
||||||
|
require('telescope').load_extension("smart_open")
|
||||||
|
require('telescope').load_extension("egrepify")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{ 'nvim-telescope/telescope-dap.nvim' },
|
||||||
|
{
|
||||||
|
"danielfalk/smart-open.nvim",
|
||||||
|
branch = "0.2.x",
|
||||||
|
dependencies = { "kkharji/sqlite.lua" }
|
||||||
|
},
|
||||||
|
}
|
||||||
7
.config/nvim/lua/halfdan/plugins/themes.lua
Normal file
7
.config/nvim/lua/halfdan/plugins/themes.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
-- themes & colorschemes
|
||||||
|
{ "rose-pine/neovim", name = "rose-pine" },
|
||||||
|
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||||
|
{ 'luisiacc/gruvbox-baby' },
|
||||||
|
{ "rebelot/kanagawa.nvim" }
|
||||||
|
}
|
||||||
84
.config/nvim/lua/halfdan/plugins/treesitter.lua
Normal file
84
.config/nvim/lua/halfdan/plugins/treesitter.lua
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
local function register(ensure_installed)
|
||||||
|
for filetype, parser in pairs(ensure_installed) do
|
||||||
|
local filetypes = vim.treesitter.language.get_filetypes(parser)
|
||||||
|
if not vim.tbl_contains(filetypes, filetype) then
|
||||||
|
table.insert(filetypes, filetype)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register and start parsers for filetypes
|
||||||
|
vim.treesitter.language.register(parser, filetypes)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Install and start parsers for nvim-treesitter.
|
||||||
|
local function install_and_start()
|
||||||
|
-- Auto-install and start treesitter parser for any buffer with a registered filetype
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||||
|
callback = function(event)
|
||||||
|
local bufnr = event.buf
|
||||||
|
local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
|
||||||
|
|
||||||
|
-- Skip if no filetype
|
||||||
|
if filetype == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get parser name based on filetype
|
||||||
|
local parser_name = vim.treesitter.language.get_lang(filetype) -- WARNING: might return filetype (not helpful)
|
||||||
|
if not parser_name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.notify(
|
||||||
|
vim.inspect("Successfully got parser " .. parser_name .. " for filetype " .. filetype),
|
||||||
|
vim.log.levels.DEBUG,
|
||||||
|
{ title = "core/treesitter" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Check if parser_name is available in parser configs
|
||||||
|
local parser_configs = require("nvim-treesitter.parsers")
|
||||||
|
local parser_can_be_used = parser_configs[parser_name]
|
||||||
|
if not parser_can_be_used then
|
||||||
|
return -- Parser not ailable, skip silently
|
||||||
|
end
|
||||||
|
|
||||||
|
local parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
|
||||||
|
|
||||||
|
-- If not installed, install parser synchronously
|
||||||
|
if not parser_installed then
|
||||||
|
require("nvim-treesitter").install({ parser_name }):wait(30000) -- main branch syntax
|
||||||
|
vim.notify("Installed parser: " .. parser_name, vim.log.levels.INFO, { title = "core/treesitter" })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check so tree-sitter can see the newly installed parser
|
||||||
|
parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
|
||||||
|
if not parser_installed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Start treesitter for this buffer
|
||||||
|
vim.treesitter.start(bufnr, parser_name)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Treesitter
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
lazy = false,
|
||||||
|
branch = 'main',
|
||||||
|
build = ':TSUpdate',
|
||||||
|
opts = {
|
||||||
|
ensure_installed = { "python", "go", "elixir", "heex", "rust", "gomod", "json", "lua", "yaml", "norg",
|
||||||
|
"query", "markdown", "markdown_inline", "gleam", "zig", "odin", "terraform", "hcl" }
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
-- Register parsers from opts.ensure_installed
|
||||||
|
register(opts.ensure_installed)
|
||||||
|
|
||||||
|
-- Create autocmd which installs and starts parsers.
|
||||||
|
install_and_start()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
108
.config/nvim/lua/halfdan/plugins/ui.lua
Normal file
108
.config/nvim/lua/halfdan/plugins/ui.lua
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||||
|
event = { "BufReadPost", "BufNewFile" },
|
||||||
|
opts = function()
|
||||||
|
local monokai_opts = require("halfdan.util").opts("monokai-pro.nvim")
|
||||||
|
return {
|
||||||
|
float = vim.tbl_contains(monokai_opts.background_clear or {}, "neo-tree"),
|
||||||
|
separator = "bubble", -- bubble | triangle
|
||||||
|
---@type any
|
||||||
|
colorful = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
local lualine_config = require("halfdan.lualine")
|
||||||
|
lualine_config.setup(opts)
|
||||||
|
lualine_config.load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'rcarriga/nvim-notify',
|
||||||
|
config = function()
|
||||||
|
vim.notify = require('notify')
|
||||||
|
|
||||||
|
require('notify').setup({
|
||||||
|
background_colour = "#000000",
|
||||||
|
max_width = 120,
|
||||||
|
max_height = 10,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'akinsho/bufferline.nvim',
|
||||||
|
version = "*",
|
||||||
|
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||||
|
keys = {
|
||||||
|
{ "<C-1>", "<Cmd>BufferLineGoToBuffer 1<CR>", desc = "Go to buffer 1" },
|
||||||
|
{ "<C-2>", "<Cmd>BufferLineGoToBuffer 2<CR>", desc = "Go to buffer 2" },
|
||||||
|
{ "<C-3>", "<Cmd>BufferLineGoToBuffer 3<CR>", desc = "Go to buffer 3" },
|
||||||
|
{ "<C-4>", "<Cmd>BufferLineGoToBuffer 4<CR>", desc = "Go to buffer 4" },
|
||||||
|
{ "<C-5>", "<Cmd>BufferLineGoToBuffer 5<CR>", desc = "Go to buffer 5" },
|
||||||
|
{ "<C-6>", "<Cmd>BufferLineGoToBuffer 6<CR>", desc = "Go to buffer 6" },
|
||||||
|
{ "<C-7>", "<Cmd>BufferLineGoToBuffer 7<CR>", desc = "Go to buffer 7" },
|
||||||
|
{ "<C-8>", "<Cmd>BufferLineGoToBuffer 8<CR>", desc = "Go to buffer 8" },
|
||||||
|
{ "<C-9>", "<Cmd>BufferLineGoToBuffer 9<CR>", desc = "Go to buffer 9" },
|
||||||
|
{ "<S-l>", "<Cmd>BufferLineCycleNext<CR>", desc = "Next buffer" },
|
||||||
|
{ "<S-h>", "<Cmd>BufferLineCyclePrev<CR>", desc = "Previous buffer" },
|
||||||
|
{ "<A-S-l>", "<Cmd>BufferLineMoveNext<CR>", desc = "Move buffer right" },
|
||||||
|
{ "<A-S-h>", "<Cmd>BufferLineMovePrev<CR>", desc = "Move buffer left" },
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local monokai_opts = require("halfdan.util").opts("monokai-pro.nvim")
|
||||||
|
return {
|
||||||
|
options = {
|
||||||
|
diagnostics = "nvim_lsp", -- | "nvim_lsp" | "coc",
|
||||||
|
-- separator_style = "", -- | "thick" | "thin" | "slope" | { 'any', 'any' },
|
||||||
|
separator_style = { "", "" }, -- | "thick" | "thin" | { 'any', 'any' },
|
||||||
|
-- separator_style = "slant", -- | "thick" | "thin" | { 'any', 'any' },
|
||||||
|
indicator = {
|
||||||
|
-- icon = " ",
|
||||||
|
-- style = 'icon',
|
||||||
|
style = "underline",
|
||||||
|
},
|
||||||
|
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||||
|
diagnostics_indicator = function(count, _, _, _)
|
||||||
|
if count > 9 then
|
||||||
|
return "9+"
|
||||||
|
end
|
||||||
|
return tostring(count)
|
||||||
|
end,
|
||||||
|
numbers = function(opts)
|
||||||
|
return string.format('%s', opts.raise(opts.ordinal))
|
||||||
|
end,
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "neo-tree",
|
||||||
|
text = "EXPLORER",
|
||||||
|
text_align = "center",
|
||||||
|
separator = vim.tbl_contains(monokai_opts.background_clear or {}, "neo-tree"), -- set to `true` if clear background of neo-tree
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filetype = "NvimTree",
|
||||||
|
text = "EXPLORER",
|
||||||
|
text_align = "center",
|
||||||
|
separator = vim.tbl_contains(monokai_opts.background_clear or {}, "nvim-tree"), -- set to `true` if clear background of neo-tree
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
delay = 0,
|
||||||
|
reveal = { "close" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
if vim.g.vscode then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Global remapping
|
|
||||||
------------------------------
|
|
||||||
-- '--color=never',
|
|
||||||
require'telescope'.load_extension('project')
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
local actions = require('telescope.actions')
|
|
||||||
|
|
||||||
-- 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", ".git", ".elixir_ls" },
|
|
||||||
prompt_prefix = " ",
|
|
||||||
selection_caret = " ",
|
|
||||||
entry_prefix = " ",
|
|
||||||
-- borderchars = { "█", " ", "▀", "█", "█", " ", " ", "▀" },
|
|
||||||
file_sorter = require 'telescope'.extensions.fzf.get_fzf_sorter,
|
|
||||||
-- Developer configurations: Not meant for general override
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
|
||||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
|
||||||
-- To disable a keymap, put [map] = false
|
|
||||||
-- So, to not map "<C-n>", just put
|
|
||||||
-- ["<c-x>"] = false,
|
|
||||||
|
|
||||||
-- Otherwise, just set the mapping to the function that you want it to be.
|
|
||||||
-- ["<C-i>"] = actions.select_horizontal,
|
|
||||||
|
|
||||||
-- Add up multiple actions
|
|
||||||
["<CR>"] = actions.select_default + actions.center
|
|
||||||
|
|
||||||
-- You can perform as many actions in a row as you like
|
|
||||||
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
|
||||||
},
|
|
||||||
n = {
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
|
||||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
|
||||||
["<esc>"] = actions.close,
|
|
||||||
-- ["<C-i>"] = my_cool_custom_action,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pickers = {
|
|
||||||
buffers = {
|
|
||||||
mappings = {
|
|
||||||
n = {
|
|
||||||
['d'] = actions.delete_buffer
|
|
||||||
}, -- n
|
|
||||||
i = {
|
|
||||||
['<c-d>'] = actions.delete_buffer
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true, -- false will only do exact matching
|
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
|
||||||
override_file_sorter = true, -- override the file sorter
|
|
||||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
|
||||||
-- the default case_mode is "smart_case"
|
|
||||||
filename_first = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('telescope').load_extension("fzf")
|
|
||||||
require('telescope').load_extension("dap")
|
|
||||||
require('telescope').load_extension("smart_open")
|
|
||||||
require('telescope').load_extension("egrepify")
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
if vim.g.vscode then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require('nvim-treesitter').setup({
|
|
||||||
ensure_installed = { "python", "go", "elixir", "heex", "rust", "gomod", "json", "lua", "yaml", "norg", "query", "markdown", "markdown_inline", "gleam", "zig", "odin"},
|
|
||||||
ignore_install = { "haskell" },
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = "gnn",
|
|
||||||
node_incremental = "grn",
|
|
||||||
scope_incremental = "grc",
|
|
||||||
node_decremental = "grm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user