mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-04-25 20:05:40 +00:00
Many changes
This commit is contained in:
parent
5782602a20
commit
49caa17eef
@ -3,6 +3,7 @@ local Remap = require("halfdan.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local vnoremap = Remap.vnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
local tnoremap = Remap.tnoremap
|
||||
local xnoremap = Remap.xnoremap
|
||||
local nmap = Remap.nmap
|
||||
|
||||
@ -38,6 +39,9 @@ nnoremap('<A-l>', '<C-w>l')
|
||||
nnoremap('<leader>th', '<C-w>t<C-w>H')
|
||||
nnoremap('<leader>tk', '<C-w>t<C-w>K')
|
||||
|
||||
nnoremap("<leader>\\", ":vsplit<CR>")
|
||||
nnoremap("<leader>/", ":split<CR>")
|
||||
|
||||
-- Keybindings below this are neovim cli only
|
||||
if vim.g.vscode then
|
||||
-- Toggle Comment
|
||||
@ -49,6 +53,9 @@ if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
tnoremap('<ESC>', '<C-\\><C-n>')
|
||||
|
||||
nnoremap('<C-B>', ':Neotree right toggle<CR>')
|
||||
-- resize with arrows
|
||||
nnoremap('<C-Up>', ':resize -2<CR>')
|
||||
nnoremap('<C-Down>', ':resize +2<CR>')
|
||||
|
@ -218,7 +218,7 @@ require('rust-tools').setup({
|
||||
|
||||
local lexical_config = {
|
||||
filetypes = { "elixir", "eelixir", "heex" },
|
||||
cmd = { "/Users/halfdan/code/lexical/_build/dev/package/lexical/bin/start_lexical.sh" },
|
||||
cmd = { "/Users/fbecker/code/lexical/_build/dev/package/lexical/bin/start_lexical.sh" },
|
||||
settings = {},
|
||||
}
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
local function get_file_name(include_path)
|
||||
local file_name = require('lspsaga.symbolwinbar').get_file_name()
|
||||
if vim.fn.bufname '%' == '' then return '' end
|
||||
if include_path == false then return file_name end
|
||||
-- Else if include path: ./lsp/saga.lua -> lsp > saga.lua
|
||||
local sep = vim.loop.os_uname().sysname == 'Windows' and '\\' or '/'
|
||||
local path_list = vim.split(string.gsub(vim.fn.expand '%:~:.:h', '%%', ''), sep)
|
||||
local file_path = ''
|
||||
for _, cur in ipairs(path_list) do
|
||||
file_path = (cur == '.' or cur == '~') and '' or
|
||||
file_path .. cur .. ' ' .. '%#LspSagaWinbarSep#>%*' .. ' %*'
|
||||
end
|
||||
return file_path .. file_name
|
||||
end
|
||||
|
||||
local function config_winbar()
|
||||
local exclude = {
|
||||
['teminal'] = true,
|
||||
['toggleterm'] = true,
|
||||
['prompt'] = true,
|
||||
['NvimTree'] = true,
|
||||
['help'] = true,
|
||||
} -- Ignore float windows and exclude filetype
|
||||
if vim.api.nvim_win_get_config(0).zindex or exclude[vim.bo.filetype] then
|
||||
vim.wo.winbar = ''
|
||||
else
|
||||
local ok, lspsaga = pcall(require, 'lspsaga.symbolwinbar')
|
||||
local sym
|
||||
if ok then sym = lspsaga.get_symbol_node() end
|
||||
local win_val = ''
|
||||
win_val = get_file_name(true) -- set to true to include path
|
||||
if sym ~= nil then win_val = win_val .. sym end
|
||||
vim.wo.winbar = win_val
|
||||
end
|
||||
end
|
||||
|
||||
-- local events = { 'BufEnter', 'BufWinEnter', 'CursorMoved' }
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd(events, {
|
||||
-- pattern = '*',
|
||||
-- callback = function() config_winbar() end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd('User', {
|
||||
-- pattern = 'LspsagaUpdateSymbol',
|
||||
-- callback = function() config_winbar() end,
|
||||
-- })
|
@ -2,62 +2,64 @@
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" },
|
||||
"cmp-git": { "branch": "main", "commit": "8d8993680d627c8f13bd85094eba84604107dbdd" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "95cb75e21d11206dad4bd3895c99459bdaa13dd1" },
|
||||
"elixir-tools.nvim": { "branch": "main", "commit": "6f1138f754ffded9979ffb4520fede8dea233ccc" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "0956bc257ca4eaa3e087e0ba2253a3e980805820" },
|
||||
"elixir-tools.nvim": { "branch": "main", "commit": "163522196c962fa87cac0df2a0d1ad332e1e0755" },
|
||||
"fzf-lua": { "branch": "main", "commit": "f021b287bf095f20cb5062fc9486dd3243ae220c" },
|
||||
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
|
||||
"gruvbox": { "branch": "master", "commit": "78112ab9ec270e4cd886ec6d5c58d887ece282de" },
|
||||
"gruvbox-baby": { "branch": "main", "commit": "be47338877e0536360290d66d26854e90dbc0004" },
|
||||
"harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" },
|
||||
"gruvbox-baby": { "branch": "main", "commit": "436f73d6a45777eadedbd2f842f766d093266eb3" },
|
||||
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "68d42e24295b4254fdf82a8a686fcf951f8a8d9a" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
||||
"monokai-pro.nvim": { "branch": "main", "commit": "8ba1fea7774e7c522b006091a9adb32b5cef95b9" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" },
|
||||
"neogit": { "branch": "master", "commit": "37d5d9f94ef4ecee62202876bc5f1bc0738062a6" },
|
||||
"neotest": { "branch": "master", "commit": "8782d83869c64700fa419bd5278f4f62c80a2c1a" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "3112b7aba57653199ad20198f477d94781bb2310" },
|
||||
"monokai-pro.nvim": { "branch": "master", "commit": "add6e9107eec368acde6caed0766256c5dae5005" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
||||
"neogit": { "branch": "master", "commit": "38dd297a905ec6869f4c20ea9184a3e514316e3b" },
|
||||
"neotest": { "branch": "master", "commit": "dcdb40ea48f9c7b67a5576f6bb2e5f63ec15f2c0" },
|
||||
"neotest-elixir": { "branch": "master", "commit": "3117ca5442c02998847131c39551b76a6ceac9d7" },
|
||||
"neotest-rust": { "branch": "main", "commit": "48c1e146ed0eb775fef6aca75903baf3cedadc01" },
|
||||
"neotest-rust": { "branch": "main", "commit": "3c06f239ad260f02c8678141e08b57d20fbe2c55" },
|
||||
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
|
||||
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "41d7633e4146dce1072de32cea31ee31b056a131" },
|
||||
"nvim-dap": { "branch": "master", "commit": "bbe2c6f3438542a37cc2141a8e385f7dfe07d87d" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "a6beb3a855b42faa1d0fee1081602257719c2c5e" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" },
|
||||
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "bd405e45c5fb122c16af8f87fa2dd7ab1981b243" },
|
||||
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "b6b9ca448b7f236e2e60f8393a729902511f9db9" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8b2e5ef9eb8a717221bd96cb8422686d65a09ed5" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" },
|
||||
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "090880c0f1fec219f7de838cb51b8dc07ce74a6d" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
|
||||
"smart-open.nvim": { "branch": "0.2.x", "commit": "026091fe7f9b283aa1f5f4bb8c56aa5bcad43dbd" },
|
||||
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
||||
"tagbar": { "branch": "master", "commit": "5d6990e4fc5b3e3b88a3af90146f2561c4f6d828" },
|
||||
"telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
|
||||
"tagbar": { "branch": "master", "commit": "fcd31ec145bbc628b90371be381717a1498b7c12" },
|
||||
"telescope-dap.nvim": { "branch": "master", "commit": "8c88d9716c91eaef1cdea13cb9390d8ef447dbfe" },
|
||||
"telescope-egrepify.nvim": { "branch": "master", "commit": "acd69d06a774f930edac5bd75ebe8d4e2854f336" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "9cf58f438f95f04cf1709b734bbcb9243c262d70" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" },
|
||||
"vim-dispatch": { "branch": "master", "commit": "6cc2691576f97d43f8751664d1a1a908b99927e5" },
|
||||
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
|
||||
"vim-gitgutter": { "branch": "main", "commit": "4b49965897b8264cd6f90fa47ddb917f4296c469" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" },
|
||||
"vim-gitgutter": { "branch": "main", "commit": "67ef116100b40f9ca128196504a2e0bc0a2753b0" },
|
||||
"vim-highlightedyank": { "branch": "master", "commit": "fa3f57b097e9521ce41a66b6c7cf5d9adea70ea3" },
|
||||
"vim-projectionist": { "branch": "master", "commit": "e292c4e33b2c44074c47c06e8ce8b309fd8099bc" },
|
||||
"vim-projectionist": { "branch": "master", "commit": "a57b9bf11ecfef16f767034550472830b48ad3e2" },
|
||||
"vim-sneak": { "branch": "master", "commit": "29ec9167d4a609f74c130b46265aa17eb2736e6a" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-test": { "branch": "master", "commit": "84373ffca386edd667e09f2bf1024b1de7bdfdf1" }
|
||||
"vim-test": { "branch": "master", "commit": "c83d5dffa054ac4663aea1eb7374f638b0462510" }
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
vim.cmd('let g:nvcode_termcolors=256')
|
||||
|
||||
vim.cmd('colorscheme ' .. O.colorscheme)
|
||||
vim.cmd('colorscheme monokai-pro-classic')
|
||||
|
||||
-- vim.cmd('highlight Normal guibg=NONE ctermbg=NONE')
|
||||
|
@ -6,7 +6,7 @@ O = {
|
||||
clipboard = 'unnamedplus',
|
||||
incsearch = true,
|
||||
termguicolors = true,
|
||||
colorscheme = 'monokaipro',
|
||||
colorscheme = 'monokai-pro',
|
||||
hidden_files = true,
|
||||
wrap_lines = false,
|
||||
number = true,
|
||||
|
125
.config/nvim/lua/halfdan/icons.lua
Normal file
125
.config/nvim/lua/halfdan/icons.lua
Normal file
@ -0,0 +1,125 @@
|
||||
return {
|
||||
diagnostics = {
|
||||
error = "",
|
||||
warn = "",
|
||||
hint = "",
|
||||
info = "",
|
||||
},
|
||||
git = {
|
||||
added = "",
|
||||
modified = "",
|
||||
removed = "",
|
||||
renamed = "➜",
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "U",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
deleted = "",
|
||||
},
|
||||
gitsigns = {
|
||||
add = "┃",
|
||||
change = "┋",
|
||||
delete = "",
|
||||
topdelhfe = "",
|
||||
changedelete = "┃",
|
||||
untracked = "┃",
|
||||
},
|
||||
kinds = {
|
||||
Array = "",
|
||||
Boolean = "",
|
||||
Class = "",
|
||||
Color = "",
|
||||
Constant = "",
|
||||
Constructor = "",
|
||||
Copilot = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
Event = "",
|
||||
Field = "",
|
||||
File = "",
|
||||
Folder = "",
|
||||
Function = "",
|
||||
Interface = "",
|
||||
Key = "",
|
||||
Keyword = "",
|
||||
Method = "",
|
||||
Module = "",
|
||||
Namespace = "",
|
||||
Null = "",
|
||||
Number = "",
|
||||
Object = "",
|
||||
Operator = "",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Snippet = "",
|
||||
String = "",
|
||||
Struct = "",
|
||||
Text = "",
|
||||
TypeParameter = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Variable = "",
|
||||
Macro = "", -- Macro
|
||||
},
|
||||
borders = {
|
||||
--- @class BorderIcons
|
||||
single = {
|
||||
top = "─",
|
||||
right = "│",
|
||||
bottom = "─",
|
||||
left = "│",
|
||||
top_left = "╭",
|
||||
top_right = "╮",
|
||||
bottom_right = "╯",
|
||||
bottom_left = "╰",
|
||||
},
|
||||
double = {
|
||||
top = '═',
|
||||
right = "║",
|
||||
bottom = '═',
|
||||
left = "║",
|
||||
top_left = "╔",
|
||||
top_right = "╗",
|
||||
bottom_right = "╝",
|
||||
bottom_left = "╚",
|
||||
},
|
||||
--- @class BorderIcons
|
||||
thin = {
|
||||
top = "▔",
|
||||
right = "▕",
|
||||
bottom = "▁",
|
||||
left = "▏",
|
||||
top_left = "🭽",
|
||||
top_right = "🭾",
|
||||
bottom_right = "🭿",
|
||||
bottom_left = "🭼",
|
||||
},
|
||||
---@type BorderIcons
|
||||
empty = {
|
||||
top = " ",
|
||||
right = " ",
|
||||
bottom = " ",
|
||||
left = " ",
|
||||
top_left = " ",
|
||||
top_right = " ",
|
||||
bottom_right = " ",
|
||||
bottom_left = " ",
|
||||
},
|
||||
---@type BorderIcons
|
||||
thick = {
|
||||
top = "▄",
|
||||
right = "█",
|
||||
bottom = "▀",
|
||||
left = "█",
|
||||
top_left = "▄",
|
||||
top_right = "▄",
|
||||
bottom_right = "▀",
|
||||
bottom_left = "▀",
|
||||
},
|
||||
},
|
||||
misc = {
|
||||
codeium = " ",
|
||||
},
|
||||
}
|
@ -9,14 +9,14 @@ else
|
||||
|
||||
require("halfdan.neogit")
|
||||
-- require("halfdan.neorg")
|
||||
require('halfdan.globals')
|
||||
-- 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.lualine')
|
||||
|
||||
require('halfdan.autocmds')
|
||||
|
||||
|
@ -16,5 +16,6 @@ M.nnoremap = bind("n")
|
||||
M.vnoremap = bind("v")
|
||||
M.xnoremap = bind("x")
|
||||
M.inoremap = bind("i")
|
||||
M.tnoremap = bind("t")
|
||||
|
||||
return M
|
||||
|
@ -60,15 +60,34 @@ require("lazy").setup({
|
||||
}
|
||||
},
|
||||
{"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},
|
||||
|
||||
{'preservim/tagbar'},
|
||||
|
||||
-- Status Line and Bufferline
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {'kyazdani42/nvim-web-devicons'}
|
||||
},
|
||||
-- {
|
||||
-- 'nvim-lualine/lualine.nvim',
|
||||
-- dependencies = {'kyazdani42/nvim-web-devicons'}
|
||||
-- },
|
||||
|
||||
{'rcarriga/nvim-notify'},
|
||||
|
||||
@ -88,7 +107,12 @@ require("lazy").setup({
|
||||
{
|
||||
'nvimdev/lspsaga.nvim',
|
||||
config = function()
|
||||
require('lspsaga').setup({})
|
||||
require('lspsaga').setup({
|
||||
|
||||
symbol_in_winbar = {
|
||||
enable = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter', -- optional
|
||||
@ -188,13 +212,123 @@ require("lazy").setup({
|
||||
},
|
||||
{'tpope/vim-projectionist'},
|
||||
-- themes & colorschemes
|
||||
{'gruvbox-community/gruvbox'},
|
||||
-- {'gruvbox-community/gruvbox'},
|
||||
{'luisiacc/gruvbox-baby'},
|
||||
{
|
||||
'https://gitlab.com/__tpb/monokai-pro.nvim',
|
||||
as = 'monokai-pro.nvim'
|
||||
'https://github.com/loctvl842/monokai-pro.nvim',
|
||||
as = 'monokai-pro.nvim',
|
||||
config = function ()
|
||||
local monokai = require("monokai-pro")
|
||||
monokai.setup({
|
||||
transparent_background = false,
|
||||
terminal_colors = true,
|
||||
devicons = true, -- highlight the icons of `nvim-web-devicons`
|
||||
styles = {
|
||||
comment = { italic = true },
|
||||
keyword = { italic = true }, -- any other keyword
|
||||
type = { italic = true }, -- (preferred) int, long, char, etc
|
||||
storageclass = { italic = true }, -- static, register, volatile, etc
|
||||
structure = { italic = true }, -- struct, union, enum, etc
|
||||
parameter = { italic = true }, -- parameter pass in function
|
||||
annotation = { italic = true },
|
||||
tag_attribute = { italic = true }, -- attribute of tag in reactjs
|
||||
},
|
||||
filter = "classic", -- classic | octagon | pro | machine | ristretto | spectrum
|
||||
-- Enable this will disable filter option
|
||||
day_night = {
|
||||
enable = false, -- turn off by default
|
||||
day_filter = "classic", -- classic | octagon | pro | machine | ristretto | spectrum
|
||||
night_filter = "spectrum", -- classic | octagon | pro | machine | ristretto | spectrum
|
||||
},
|
||||
inc_search = "background", -- underline | background
|
||||
background_clear = {
|
||||
"nvim-tree",
|
||||
"neo-tree",
|
||||
"bufferline",
|
||||
"telescope",
|
||||
"toggleterm",
|
||||
},
|
||||
plugins = {
|
||||
bufferline = {
|
||||
underline_selected = false,
|
||||
underline_visible = false,
|
||||
},
|
||||
indent_blankline = {
|
||||
context_highlight = "default", -- default | pro
|
||||
context_start_underline = false,
|
||||
},
|
||||
},
|
||||
override = function(c)
|
||||
return {
|
||||
ColorColumn = { bg = c.base.dimmed3 },
|
||||
}
|
||||
end,
|
||||
})
|
||||
monokai.load()
|
||||
end
|
||||
},
|
||||
{'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",
|
||||
|
@ -9,7 +9,7 @@ end
|
||||
require 'lualine'.setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'monokaipro',
|
||||
theme = 'monokai-pro',
|
||||
--component_separators = {'', ''},
|
||||
--section_separators = {'', ''},
|
||||
disabled_filetypes = {}
|
||||
|
@ -54,8 +54,8 @@ vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else
|
||||
vim.o.laststatus = 3 -- Set global status bar
|
||||
vim.b.did_ftplugin = 1
|
||||
-- Enable telescope theme
|
||||
vim.g.gruvbox_baby_telescope_theme = 1
|
||||
vim.g.gruvbox_baby_background_color = "dark"
|
||||
-- vim.g.gruvbox_baby_telescope_theme = 1
|
||||
-- vim.g.gruvbox_baby_background_color = "dark"
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
|
@ -8,6 +8,7 @@ require('telescope').setup {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
-- borderchars = { "█", " ", "▀", "█", "█", " ", " ", "▀" },
|
||||
file_sorter = require 'telescope'.extensions.fzf.get_fzf_sorter,
|
||||
-- Developer configurations: Not meant for general override
|
||||
mappings = {
|
||||
|
245
.config/nvim/lua/halfdan/util.lua
Normal file
245
.config/nvim/lua/halfdan/util.lua
Normal file
@ -0,0 +1,245 @@
|
||||
local M = {}
|
||||
|
||||
M.root_patterns = { ".git", "lua", "package.json", "mvnw", "gradlew", "pom.xml", "build.gradle", "release", ".project" }
|
||||
|
||||
M.augroup = function(name)
|
||||
return vim.api.nvim_create_augroup("halfdan_" .. name, { clear = true })
|
||||
end
|
||||
|
||||
M.has = function(plugin)
|
||||
return require("lazy.core.config").plugins[plugin] ~= nil
|
||||
end
|
||||
|
||||
function M.get_clients(...)
|
||||
local fn = vim.lsp.get_clients or vim.lsp.get_active_clients
|
||||
return fn(...)
|
||||
end
|
||||
|
||||
--- @param on_attach fun(client, buffer)
|
||||
M.on_attach = function(on_attach)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local buffer = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
on_attach(client, buffer)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.get_highlight_value = function(group)
|
||||
local found, hl = pcall(vim.api.nvim_get_hl_by_name, group, true)
|
||||
if not found then
|
||||
return {}
|
||||
end
|
||||
local hl_config = {}
|
||||
for key, value in pairs(hl) do
|
||||
_, hl_config[key] = pcall(string.format, "#%06x", value)
|
||||
end
|
||||
return hl_config
|
||||
end
|
||||
|
||||
---@param name string
|
||||
function M.opts(name)
|
||||
local plugin = require("lazy.core.config").plugins[name]
|
||||
if not plugin then
|
||||
return {}
|
||||
end
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
return Plugin.values(plugin, "opts", false)
|
||||
end
|
||||
|
||||
-- returns the root directory based on:
|
||||
-- * lsp workspace folders
|
||||
-- * lsp root_dir
|
||||
-- * root pattern of filename of the current buffer
|
||||
-- * root pattern of cwd
|
||||
---@return string
|
||||
M.get_root = function()
|
||||
---@type string?
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
path = path ~= "" and vim.loop.fs_realpath(path) or nil
|
||||
---@type string[]
|
||||
local roots = {}
|
||||
if path then
|
||||
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
||||
local workspace = client.config.workspace_folders
|
||||
local paths = workspace
|
||||
and vim.tbl_map(function(ws)
|
||||
return vim.uri_to_fname(ws.uri)
|
||||
end, workspace)
|
||||
or client.config.root_dir and { client.config.root_dir }
|
||||
or {}
|
||||
for _, p in ipairs(paths) do
|
||||
local r = vim.loop.fs_realpath(p)
|
||||
if path:find(r, 1, true) then
|
||||
roots[#roots + 1] = r
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(roots, function(a, b)
|
||||
return #a > #b
|
||||
end)
|
||||
---@type string?
|
||||
local root = roots[1]
|
||||
if not root then
|
||||
path = path and vim.fs.dirname(path) or vim.loop.cwd()
|
||||
---@type string?
|
||||
root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1]
|
||||
root = root and vim.fs.dirname(root) or vim.loop.cwd()
|
||||
end
|
||||
---@cast root string
|
||||
return root
|
||||
end
|
||||
|
||||
M.set_root = function(dir)
|
||||
vim.api.nvim_set_current_dir(dir)
|
||||
end
|
||||
|
||||
---@param type "ivy" | "dropdown" | "cursor" | nil
|
||||
--- @param borderType "thin" | "thick" | "double" | "single" | "empty" | nil
|
||||
M.telescope_theme = function(type, borderType)
|
||||
if type == nil then
|
||||
return {
|
||||
borderchars = M.generate_borderchars(borderType),
|
||||
layout_config = {
|
||||
width = 80,
|
||||
height = 0.5,
|
||||
},
|
||||
}
|
||||
end
|
||||
return require("telescope.themes")["get_" .. type]({
|
||||
cwd = M.get_root(),
|
||||
borderchars = M.generate_borderchars(borderType, nil, { top = "█", top_left = "█", top_right = "█" }),
|
||||
})
|
||||
end
|
||||
|
||||
---@param builtin "find_files" | "live_grep" | "buffers"
|
||||
---@param type "ivy" | "dropdown" | "cursor" | nil
|
||||
M.telescope = function(builtin, type, opts)
|
||||
local params = { builtin = builtin, type = type, opts = opts }
|
||||
return function()
|
||||
builtin = params.builtin
|
||||
type = params.type
|
||||
opts = params.opts
|
||||
opts = vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {})
|
||||
local theme
|
||||
if vim.tbl_contains({ "ivy", "dropdown", "cursor" }, type) then
|
||||
theme = M.telescope_theme(type)
|
||||
else
|
||||
theme = opts
|
||||
end
|
||||
require("telescope.builtin")[builtin](theme)
|
||||
end
|
||||
end
|
||||
|
||||
---@param name "autocmds" | "options" | "keymaps"
|
||||
M.load = function(name)
|
||||
local Util = require("lazy.core.util")
|
||||
-- always load lazyvim, then user file
|
||||
local mod = "halfdan.core." .. name
|
||||
Util.try(function()
|
||||
require(mod)
|
||||
end, {
|
||||
msg = "Failed loading " .. mod,
|
||||
on_error = function(msg)
|
||||
local modpath = require("lazy.core.cache").find(mod)
|
||||
if modpath then
|
||||
Util.error(msg)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.on_very_lazy = function(fn)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
fn()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.capabilities = function(ext)
|
||||
return vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
ext or {},
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
{ textDocument = { foldingRange = { dynamicRegistration = false, lineFoldingOnly = true } } }
|
||||
)
|
||||
end
|
||||
|
||||
M.notify = function(msg, level, opts)
|
||||
opts = opts or {}
|
||||
level = vim.log.levels[level:upper()]
|
||||
if type(msg) == "table" then
|
||||
msg = table.concat(msg, "\n")
|
||||
end
|
||||
local nopts = { title = "Nvim" }
|
||||
if opts.once then
|
||||
return vim.schedule(function()
|
||||
vim.notify_once(msg, level, nopts)
|
||||
end)
|
||||
end
|
||||
vim.schedule(function()
|
||||
vim.notify(msg, level, nopts)
|
||||
end)
|
||||
end
|
||||
|
||||
--- @param type "thin" | "thick" | "double" | "single" | "empty" | nil
|
||||
--- @param order "t-r-b-l-tl-tr-br-bl" | "tl-t-tr-r-br-b-bl-l" | nil
|
||||
--- @param opts BorderIcons | nil
|
||||
M.generate_borderchars = function(type, order, opts)
|
||||
if order == nil then
|
||||
order = "t-r-b-l-tl-tr-br-bl"
|
||||
end
|
||||
local border_icons = require("halfdan.icons").borders
|
||||
--- @type BorderIcons
|
||||
local border = vim.tbl_deep_extend("force", border_icons[type or "empty"], opts or {})
|
||||
|
||||
local borderchars = {}
|
||||
|
||||
local extractDirections = (function()
|
||||
local index = 1
|
||||
return function()
|
||||
if index == nil then
|
||||
return nil
|
||||
end
|
||||
-- Find the next occurence of `char`
|
||||
local nextIndex = string.find(order, "-", index)
|
||||
-- Extract the first direction
|
||||
local direction = string.sub(order, index, nextIndex and nextIndex - 1)
|
||||
-- Update the index to nextIndex
|
||||
index = nextIndex and nextIndex + 1 or nil
|
||||
return direction
|
||||
end
|
||||
end)()
|
||||
|
||||
local mappings = {
|
||||
t = "top",
|
||||
r = "right",
|
||||
b = "bottom",
|
||||
l = "left",
|
||||
tl = "top_left",
|
||||
tr = "top_right",
|
||||
br = "bottom_right",
|
||||
bl = "bottom_left",
|
||||
}
|
||||
local direction = extractDirections()
|
||||
while direction do
|
||||
if mappings[direction] == nil then
|
||||
M.notify(string.format("Invalid direction '%s'", direction), "error")
|
||||
end
|
||||
borderchars[#borderchars + 1] = border[mappings[direction]]
|
||||
direction = extractDirections()
|
||||
end
|
||||
|
||||
if #borderchars ~= 8 then
|
||||
M.notify(string.format("Invalid order '%s'", order), "error")
|
||||
end
|
||||
|
||||
return borderchars
|
||||
end
|
||||
|
||||
return M
|
Loading…
x
Reference in New Issue
Block a user