mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-04-26 12:25:39 +00:00
Compare commits
3 Commits
5782602a20
...
d36811ef6f
Author | SHA1 | Date | |
---|---|---|---|
|
d36811ef6f | ||
|
6c380f3a94 | ||
|
49caa17eef |
49
.config/kitty/keymap.conf
Normal file
49
.config/kitty/keymap.conf
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Window
|
||||||
|
map ctrl+\ new_window_with_cwd
|
||||||
|
|
||||||
|
# Tab
|
||||||
|
map ctrl+1 goto_tab 1
|
||||||
|
map ctrl+2 goto_tab 2
|
||||||
|
map ctrl+3 goto_tab 3
|
||||||
|
map ctrl+4 goto_tab 4
|
||||||
|
map ctrl+t new_tab
|
||||||
|
map ctrl+w close_tab
|
||||||
|
|
||||||
|
# Supper power keys
|
||||||
|
map ctrl+; kitten toggle_term.py
|
||||||
|
|
||||||
|
# kitty-scrollback.nvim Kitten alias
|
||||||
|
# action_alias kitty_scrollback_nvim kitten /home/tieu/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py
|
||||||
|
|
||||||
|
# Browse scrollback buffer in nvim
|
||||||
|
map kitty_mod+h kitty_scrollback_nvim
|
||||||
|
# Browse output of the last shell command in nvim
|
||||||
|
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
|
||||||
|
# Show clicked command output in nvim
|
||||||
|
# mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
# smart-split
|
||||||
|
map ctrl+j neighboring_window down
|
||||||
|
map ctrl+k neighboring_window up
|
||||||
|
map ctrl+h neighboring_window left
|
||||||
|
map ctrl+l neighboring_window right
|
||||||
|
|
||||||
|
# Unset the mapping to pass the keys to neovim
|
||||||
|
map --when-focus-on var:IS_NVIM ctrl+j
|
||||||
|
map --when-focus-on var:IS_NVIM ctrl+k
|
||||||
|
map --when-focus-on var:IS_NVIM ctrl+h
|
||||||
|
map --when-focus-on var:IS_NVIM ctrl+l
|
||||||
|
|
||||||
|
# the 3 here is the resize amount, adjust as needed
|
||||||
|
map alt+j kitten relative_resize.py down 3
|
||||||
|
map alt+k kitten relative_resize.py up 3
|
||||||
|
map alt+h kitten relative_resize.py left 3
|
||||||
|
map alt+l kitten relative_resize.py right 3
|
||||||
|
|
||||||
|
map --when-focus-on var:IS_NVIM alt+j
|
||||||
|
map --when-focus-on var:IS_NVIM alt+k
|
||||||
|
map --when-focus-on var:IS_NVIM alt+h
|
||||||
|
map --when-focus-on var:IS_NVIM alt+l
|
||||||
|
|
||||||
|
map f1 launch_tab nvim
|
20
.config/kitty/kitty.conf
Normal file
20
.config/kitty/kitty.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
font_size 15
|
||||||
|
window_padding_width 1
|
||||||
|
background_opacity 1
|
||||||
|
|
||||||
|
font_family JetBrainsMono Nerd Font Mono
|
||||||
|
|
||||||
|
tab_bar_edge top
|
||||||
|
tab_bar_style separator
|
||||||
|
tab_separator " "
|
||||||
|
tab_title_template " {index} {title[-20:]} {bell_symbol}"
|
||||||
|
|
||||||
|
remember_window_size yes
|
||||||
|
|
||||||
|
allow_remote_control yes
|
||||||
|
listen_on unix:@mykitty
|
||||||
|
|
||||||
|
include theme.conf
|
||||||
|
include keymap.conf
|
||||||
|
|
||||||
|
shell_integration enabled
|
49
.config/kitty/theme.conf
Normal file
49
.config/kitty/theme.conf
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# gruvbox dark by morhetz, https://github.com/morhetz/gruvbox
|
||||||
|
# This work is licensed under the terms of the MIT license.
|
||||||
|
# For a copy, see https://opensource.org/licenses/MIT.
|
||||||
|
|
||||||
|
background #282828
|
||||||
|
foreground #ebdbb2
|
||||||
|
|
||||||
|
cursor #928374
|
||||||
|
|
||||||
|
selection_foreground #928374
|
||||||
|
selection_background #3c3836
|
||||||
|
|
||||||
|
color0 #282828
|
||||||
|
color8 #928374
|
||||||
|
|
||||||
|
# red
|
||||||
|
color1 #cc241d
|
||||||
|
# light red
|
||||||
|
color9 #fb4934
|
||||||
|
|
||||||
|
# green
|
||||||
|
color2 #98971a
|
||||||
|
# light green
|
||||||
|
color10 #b8bb26
|
||||||
|
|
||||||
|
# yellow
|
||||||
|
color3 #d79921
|
||||||
|
# light yellow
|
||||||
|
color11 #fabd2d
|
||||||
|
|
||||||
|
# blue
|
||||||
|
color4 #458588
|
||||||
|
# light blue
|
||||||
|
color12 #83a598
|
||||||
|
|
||||||
|
# magenta
|
||||||
|
color5 #b16286
|
||||||
|
# light magenta
|
||||||
|
color13 #d3869b
|
||||||
|
|
||||||
|
# cyan
|
||||||
|
color6 #689d6a
|
||||||
|
# lighy cyan
|
||||||
|
color14 #8ec07c
|
||||||
|
|
||||||
|
# light gray
|
||||||
|
color7 #a89984
|
||||||
|
# dark gray
|
||||||
|
color15 #928374
|
33
.config/kitty/toggle_term.py
Normal file
33
.config/kitty/toggle_term.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from kittens.tui.handler import result_handler
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def toggle_term(boss):
|
||||||
|
tab = boss.active_tab
|
||||||
|
|
||||||
|
all_another_wins = tab.all_window_ids_except_active_window
|
||||||
|
have_only_one = len(all_another_wins) == 0
|
||||||
|
|
||||||
|
if have_only_one:
|
||||||
|
boss.launch('--cwd=current', '--location=hsplit')
|
||||||
|
tab.neighboring_window("bottom")
|
||||||
|
else:
|
||||||
|
if tab.current_layout.name == 'stack':
|
||||||
|
tab.last_used_layout()
|
||||||
|
tab.neighboring_window("bottom")
|
||||||
|
else:
|
||||||
|
tab.neighboring_window("top")
|
||||||
|
tab.goto_layout('stack')
|
||||||
|
|
||||||
|
|
||||||
|
@result_handler(no_ui=True)
|
||||||
|
def handle_result(args, result, target_window_id, boss):
|
||||||
|
window = boss.window_id_map.get(target_window_id)
|
||||||
|
|
||||||
|
if window is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
toggle_term(boss)
|
@ -3,6 +3,7 @@ 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 xnoremap = Remap.xnoremap
|
local xnoremap = Remap.xnoremap
|
||||||
local nmap = Remap.nmap
|
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>th', '<C-w>t<C-w>H')
|
||||||
nnoremap('<leader>tk', '<C-w>t<C-w>K')
|
nnoremap('<leader>tk', '<C-w>t<C-w>K')
|
||||||
|
|
||||||
|
nnoremap("<leader>\\", ":vsplit<CR>")
|
||||||
|
nnoremap("<leader>/", ":split<CR>")
|
||||||
|
|
||||||
-- Keybindings below this are neovim cli only
|
-- Keybindings below this are neovim cli only
|
||||||
if vim.g.vscode then
|
if vim.g.vscode then
|
||||||
-- Toggle Comment
|
-- Toggle Comment
|
||||||
@ -49,6 +53,9 @@ if vim.g.vscode then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tnoremap('<ESC>', '<C-\\><C-n>')
|
||||||
|
|
||||||
|
nnoremap('<C-B>', ':Neotree right toggle<CR>')
|
||||||
-- resize with arrows
|
-- resize with arrows
|
||||||
nnoremap('<C-Up>', ':resize -2<CR>')
|
nnoremap('<C-Up>', ':resize -2<CR>')
|
||||||
nnoremap('<C-Down>', ':resize +2<CR>')
|
nnoremap('<C-Down>', ':resize +2<CR>')
|
||||||
|
@ -218,7 +218,7 @@ require('rust-tools').setup({
|
|||||||
|
|
||||||
local lexical_config = {
|
local lexical_config = {
|
||||||
filetypes = { "elixir", "eelixir", "heex" },
|
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 = {},
|
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,
|
|
||||||
-- })
|
|
@ -1,63 +1,68 @@
|
|||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
|
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
|
||||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||||
|
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||||
"cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" },
|
"cmp-git": { "branch": "main", "commit": "3d83031c4b63f9b10703e32e070cda0700a81992" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||||
"editorconfig-vim": { "branch": "master", "commit": "95cb75e21d11206dad4bd3895c99459bdaa13dd1" },
|
"editorconfig-vim": { "branch": "master", "commit": "8b7da79e9daee7a3f3a8d4fe29886b9756305aff" },
|
||||||
"elixir-tools.nvim": { "branch": "main", "commit": "6f1138f754ffded9979ffb4520fede8dea233ccc" },
|
"elixir-tools.nvim": { "branch": "main", "commit": "5e7596be469be0800e9cbe3415de971f7286c3d0" },
|
||||||
|
"fzf-lua": { "branch": "main", "commit": "8f9c3a2e308755c25630087f3c5d35786803cfd0" },
|
||||||
|
"git-blame.nvim": { "branch": "master", "commit": "50543e3993f4b996eea01ff5ccc8fe2a354c5388" },
|
||||||
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
|
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
|
||||||
"gruvbox": { "branch": "master", "commit": "78112ab9ec270e4cd886ec6d5c58d887ece282de" },
|
"gruvbox-baby": { "branch": "main", "commit": "bd52e62d8134647090108189e69c8b3cd18bdbbf" },
|
||||||
"gruvbox-baby": { "branch": "main", "commit": "be47338877e0536360290d66d26854e90dbc0004" },
|
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
||||||
"harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" },
|
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
|
||||||
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
|
||||||
"lspsaga.nvim": { "branch": "main", "commit": "68d42e24295b4254fdf82a8a686fcf951f8a8d9a" },
|
"lspsaga.nvim": { "branch": "main", "commit": "a751b92b5d765a99fe3a42b9e51c046f81385e15" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||||
"monokai-pro.nvim": { "branch": "main", "commit": "8ba1fea7774e7c522b006091a9adb32b5cef95b9" },
|
"monokai-pro.nvim": { "branch": "master", "commit": "2bad2a92fe0ff6c8581d33a853a1b17592b83239" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" },
|
||||||
"neogit": { "branch": "master", "commit": "37d5d9f94ef4ecee62202876bc5f1bc0738062a6" },
|
"neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" },
|
||||||
"neotest": { "branch": "master", "commit": "8782d83869c64700fa419bd5278f4f62c80a2c1a" },
|
"neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" },
|
||||||
"neotest-elixir": { "branch": "master", "commit": "3117ca5442c02998847131c39551b76a6ceac9d7" },
|
"neotest-elixir": { "branch": "master", "commit": "c5067bcc3ec6a0bba7b5694fa15aeb17f16aeb3c" },
|
||||||
"neotest-rust": { "branch": "main", "commit": "48c1e146ed0eb775fef6aca75903baf3cedadc01" },
|
"neotest-rust": { "branch": "main", "commit": "0418811e1e3499b2501593f2e131d02f5e6823d4" },
|
||||||
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
|
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
|
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "41d7633e4146dce1072de32cea31ee31b056a131" },
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "bbe2c6f3438542a37cc2141a8e385f7dfe07d87d" },
|
"nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
|
||||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
|
||||||
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
|
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "bd405e45c5fb122c16af8f87fa2dd7ab1981b243" },
|
"nvim-lspconfig": { "branch": "master", "commit": "a67bc39aaa4f1e13212c5022a561120846eaef27" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "b6b9ca448b7f236e2e60f8393a729902511f9db9" },
|
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
|
"nvim-treesitter": { "branch": "master", "commit": "047ce49ccf9a2dce22e1cf3843bef3b5682a8144" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "8b2e5ef9eb8a717221bd96cb8422686d65a09ed5" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ced6375723b20616282f9f6a1018a63ae19b106a" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
"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" },
|
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
|
||||||
"smart-open.nvim": { "branch": "0.2.x", "commit": "026091fe7f9b283aa1f5f4bb8c56aa5bcad43dbd" },
|
"smart-open.nvim": { "branch": "0.2.x", "commit": "87626ee8748b9bba22093adec7bb58c63e7214f0" },
|
||||||
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
|
"sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" },
|
||||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
|
||||||
"tagbar": { "branch": "master", "commit": "5d6990e4fc5b3e3b88a3af90146f2561c4f6d828" },
|
"tagbar": { "branch": "master", "commit": "d55d454bd3d5b027ebf0e8c75b8f88e4eddad8d8" },
|
||||||
"telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" },
|
"telescope-dap.nvim": { "branch": "master", "commit": "8c88d9716c91eaef1cdea13cb9390d8ef447dbfe" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-egrepify.nvim": { "branch": "master", "commit": "a30396791c3f67b8f34d42dfc26db2f868ae9154" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
"vim-dispatch": { "branch": "master", "commit": "6cc2691576f97d43f8751664d1a1a908b99927e5" },
|
"telescope.nvim": { "branch": "master", "commit": "43c47ebc49ba601c7f0d06d65ce61d6aa8e670ab" },
|
||||||
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
|
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
|
"vim-dispatch": { "branch": "master", "commit": "4c695bc052cad2ae6b980aebbe48d046466e27ae" },
|
||||||
"vim-gitgutter": { "branch": "main", "commit": "4b49965897b8264cd6f90fa47ddb917f4296c469" },
|
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
|
||||||
"vim-highlightedyank": { "branch": "master", "commit": "fa3f57b097e9521ce41a66b6c7cf5d9adea70ea3" },
|
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
|
||||||
"vim-projectionist": { "branch": "master", "commit": "e292c4e33b2c44074c47c06e8ce8b309fd8099bc" },
|
"vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" },
|
||||||
"vim-sneak": { "branch": "master", "commit": "29ec9167d4a609f74c130b46265aa17eb2736e6a" },
|
"vim-highlightedyank": { "branch": "master", "commit": "afb0f262b490706c23e94012c2ab9fa67c0481ce" },
|
||||||
|
"vim-projectionist": { "branch": "master", "commit": "3736bd4a5f23b30821cbb892385bb1f1b0088cfc" },
|
||||||
|
"vim-sneak": { "branch": "master", "commit": "c13d0497139b8796ff9c44ddb9bc0dc9770ad2dd" },
|
||||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||||
"vim-test": { "branch": "master", "commit": "84373ffca386edd667e09f2bf1024b1de7bdfdf1" }
|
"vim-test": { "branch": "master", "commit": "75b64f23c923d34b56e47846a026210feb57146a" }
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
vim.cmd('let g:nvcode_termcolors=256')
|
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')
|
-- vim.cmd('highlight Normal guibg=NONE ctermbg=NONE')
|
||||||
|
@ -6,7 +6,7 @@ O = {
|
|||||||
clipboard = 'unnamedplus',
|
clipboard = 'unnamedplus',
|
||||||
incsearch = true,
|
incsearch = true,
|
||||||
termguicolors = true,
|
termguicolors = true,
|
||||||
colorscheme = 'monokaipro',
|
colorscheme = 'monokai-pro',
|
||||||
hidden_files = true,
|
hidden_files = true,
|
||||||
wrap_lines = false,
|
wrap_lines = false,
|
||||||
number = true,
|
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,7 +9,7 @@ else
|
|||||||
|
|
||||||
require("halfdan.neogit")
|
require("halfdan.neogit")
|
||||||
-- require("halfdan.neorg")
|
-- require("halfdan.neorg")
|
||||||
require('halfdan.globals')
|
-- require('halfdan.globals')
|
||||||
require('halfdan.keymap')
|
require('halfdan.keymap')
|
||||||
require('halfdan.cmp')
|
require('halfdan.cmp')
|
||||||
-- require('halfdan.luasnip')
|
-- require('halfdan.luasnip')
|
||||||
|
@ -16,5 +16,6 @@ M.nnoremap = bind("n")
|
|||||||
M.vnoremap = bind("v")
|
M.vnoremap = bind("v")
|
||||||
M.xnoremap = bind("x")
|
M.xnoremap = bind("x")
|
||||||
M.inoremap = bind("i")
|
M.inoremap = bind("i")
|
||||||
|
M.tnoremap = bind("t")
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -60,14 +60,49 @@ require("lazy").setup({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"nvim-neotest/neotest-vim-test" },
|
{"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'},
|
{'preservim/tagbar'},
|
||||||
|
|
||||||
|
{'f-person/git-blame.nvim'},
|
||||||
-- Status Line and Bufferline
|
-- Status Line and Bufferline
|
||||||
{
|
{
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
dependencies = {'kyazdani42/nvim-web-devicons'}
|
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'},
|
{'rcarriga/nvim-notify'},
|
||||||
@ -88,7 +123,12 @@ require("lazy").setup({
|
|||||||
{
|
{
|
||||||
'nvimdev/lspsaga.nvim',
|
'nvimdev/lspsaga.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
require('lspsaga').setup({})
|
require('lspsaga').setup({
|
||||||
|
|
||||||
|
symbol_in_winbar = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter', -- optional
|
'nvim-treesitter/nvim-treesitter', -- optional
|
||||||
@ -152,6 +192,7 @@ require("lazy").setup({
|
|||||||
-- Debugging
|
-- Debugging
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
"theHamsta/nvim-dap-virtual-text",
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
|
||||||
-- => Language Support
|
-- => Language Support
|
||||||
@ -166,10 +207,10 @@ require("lazy").setup({
|
|||||||
local elixirls = require("elixir.elixirls")
|
local elixirls = require("elixir.elixirls")
|
||||||
--
|
--
|
||||||
elixir.setup {
|
elixir.setup {
|
||||||
nextls = {enable = false},
|
nextls = {enable = true},
|
||||||
credo = {},
|
credo = {},
|
||||||
elixirls = {
|
elixirls = {
|
||||||
enable = true,
|
enable = false,
|
||||||
settings = elixirls.settings {
|
settings = elixirls.settings {
|
||||||
dialyzerEnabled = false,
|
dialyzerEnabled = false,
|
||||||
enableTestLenses = false,
|
enableTestLenses = false,
|
||||||
@ -188,13 +229,123 @@ require("lazy").setup({
|
|||||||
},
|
},
|
||||||
{'tpope/vim-projectionist'},
|
{'tpope/vim-projectionist'},
|
||||||
-- themes & colorschemes
|
-- themes & colorschemes
|
||||||
{'gruvbox-community/gruvbox'},
|
-- {'gruvbox-community/gruvbox'},
|
||||||
{'luisiacc/gruvbox-baby'},
|
{'luisiacc/gruvbox-baby'},
|
||||||
{
|
{
|
||||||
'https://gitlab.com/__tpb/monokai-pro.nvim',
|
'https://github.com/loctvl842/monokai-pro.nvim',
|
||||||
as = '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",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
branch = "v3.x",
|
branch = "v3.x",
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
|
|
||||||
local function formatted_status()
|
|
||||||
local status = require'lsp-status'.status()
|
|
||||||
status = string.gsub(status, "%%", "%%%%")
|
|
||||||
return status
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
require 'lualine'.setup {
|
|
||||||
options = {
|
|
||||||
icons_enabled = true,
|
|
||||||
theme = 'monokaipro',
|
|
||||||
--component_separators = {'', ''},
|
|
||||||
--section_separators = {'', ''},
|
|
||||||
disabled_filetypes = {}
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = { 'mode' },
|
|
||||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = {
|
|
||||||
{"require'lsp-status'.status()", fmt = function (str)
|
|
||||||
return string.gsub(str, "%%", "%%%%")
|
|
||||||
end},
|
|
||||||
'filetype'
|
|
||||||
},
|
|
||||||
lualine_y = { 'progress' },
|
|
||||||
lualine_z = { 'location' }
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = { 'location' },
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
extensions = {},
|
|
||||||
winbar = {
|
|
||||||
lualine_a = {
|
|
||||||
},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = {},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
inactive_winbar = {
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
}
|
|
||||||
}
|
|
160
.config/nvim/lua/halfdan/lualine/components.lua
Normal file
160
.config/nvim/lua/halfdan/lualine/components.lua
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
local config = require("halfdan.lualine.config").options
|
||||||
|
local icons = require("halfdan.icons")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local hl_str = function(str, hl_cur, hl_after)
|
||||||
|
if hl_after == nil then
|
||||||
|
return "%#" .. hl_cur .. "#" .. str .. "%*"
|
||||||
|
end
|
||||||
|
return "%#" .. hl_cur .. "#" .. str .. "%*" .. "%#" .. hl_after .. "#"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function hide_in_width()
|
||||||
|
return vim.fn.winwidth(0) > 85
|
||||||
|
end
|
||||||
|
|
||||||
|
local prev_branch = ""
|
||||||
|
M.branch = {
|
||||||
|
"branch",
|
||||||
|
icons_enabled = false,
|
||||||
|
icon = hl_str("", "SLGitIcon", "SLBranchName"),
|
||||||
|
colored = false,
|
||||||
|
fmt = function(str)
|
||||||
|
if vim.bo.filetype == "toggleterm" then
|
||||||
|
str = prev_branch
|
||||||
|
elseif str == "" or str == nil then
|
||||||
|
str = "!=vcs"
|
||||||
|
end
|
||||||
|
prev_branch = str
|
||||||
|
local icon = hl_str(" ", "SLGitIcon", "SLBranchName")
|
||||||
|
return hl_str(config.separator_icon.left, "SLSeparator")
|
||||||
|
.. hl_str(icon, "SLGitIcon")
|
||||||
|
.. hl_str(str, "SLBranchName")
|
||||||
|
.. hl_str(config.separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
M.position = function()
|
||||||
|
-- print(vim.inspect(config.separator_icon))
|
||||||
|
local current_line = vim.fn.line(".")
|
||||||
|
local current_column = vim.fn.col(".")
|
||||||
|
local left_sep = hl_str(config.separator_icon.left, "SLSeparator")
|
||||||
|
local right_sep = hl_str(config.separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
local str = "Ln " .. current_line .. ", Col " .. current_column
|
||||||
|
return left_sep .. hl_str(str, "SLPosition", "SLPosition") .. right_sep
|
||||||
|
end
|
||||||
|
|
||||||
|
M.spaces = function()
|
||||||
|
local left_sep = hl_str(config.separator_icon.left, "SLSeparator")
|
||||||
|
local right_sep = hl_str(config.separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
local str = "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||||
|
return left_sep .. hl_str(str, "SLShiftWidth", "SLShiftWidth") .. right_sep
|
||||||
|
end
|
||||||
|
|
||||||
|
M.diagnostics = function()
|
||||||
|
local function nvim_diagnostic()
|
||||||
|
local diagnostics = vim.diagnostic.get(0)
|
||||||
|
local count = { 0, 0, 0, 0 }
|
||||||
|
for _, diagnostic in ipairs(diagnostics) do
|
||||||
|
count[diagnostic.severity] = count[diagnostic.severity] + 1
|
||||||
|
end
|
||||||
|
return count[vim.diagnostic.severity.ERROR],
|
||||||
|
count[vim.diagnostic.severity.WARN],
|
||||||
|
count[vim.diagnostic.severity.INFO],
|
||||||
|
count[vim.diagnostic.severity.HINT]
|
||||||
|
end
|
||||||
|
|
||||||
|
local error_count, warn_count, info_count, hint_count = nvim_diagnostic()
|
||||||
|
local error_hl = hl_str(icons.diagnostics.Error .. " " .. error_count, "SLError", "SLError")
|
||||||
|
local warn_hl = hl_str(icons.diagnostics.Warn .. " " .. warn_count, "SLWarning", "SLWarning")
|
||||||
|
local info_hl = hl_str(icons.diagnostics.Info .. " " .. info_count, "SLInfo", "SLInfo")
|
||||||
|
local hint_hl = hl_str(icons.diagnostics.Hint .. " " .. hint_count, "SLInfo", "SLInfo")
|
||||||
|
local left_sep = hl_str(config.thin_separator_icon.left, "SLSeparator")
|
||||||
|
local right_sep = hl_str(config.thin_separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
return left_sep .. error_hl .. " " .. warn_hl .. " " .. hint_hl .. right_sep
|
||||||
|
end
|
||||||
|
|
||||||
|
M.diff = {
|
||||||
|
"diff",
|
||||||
|
colored = true,
|
||||||
|
diff_color = {
|
||||||
|
added = "SLDiffAdd",
|
||||||
|
modified = "SLDiffChange",
|
||||||
|
removed = "SLDiffDelete",
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
added = icons.git.added .. " ",
|
||||||
|
modified = icons.git.modified .. " ",
|
||||||
|
removed = icons.git.removed .. " ",
|
||||||
|
}, -- changes diff symbols
|
||||||
|
fmt = function(str)
|
||||||
|
if str == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local left_sep = hl_str(config.thin_separator_icon.left, "SLSeparator")
|
||||||
|
local right_sep = hl_str(config.thin_separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
return left_sep .. str .. right_sep
|
||||||
|
end,
|
||||||
|
cond = hide_in_width,
|
||||||
|
}
|
||||||
|
|
||||||
|
M.mode = {
|
||||||
|
"mode",
|
||||||
|
fmt = function(str)
|
||||||
|
local left_sep = hl_str(config.separator_icon.left, "SLSeparator", "SLPadding")
|
||||||
|
local right_sep = hl_str(config.separator_icon.right, "SLSeparator", "SLPadding")
|
||||||
|
return left_sep .. hl_str(str, "SLMode") .. right_sep
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local prev_filetype = ""
|
||||||
|
M.filetype = {
|
||||||
|
"filetype",
|
||||||
|
icons_enabled = false,
|
||||||
|
icons_only = false,
|
||||||
|
fmt = function(str)
|
||||||
|
local ui_filetypes = {
|
||||||
|
"help",
|
||||||
|
"packer",
|
||||||
|
"neogitstatus",
|
||||||
|
"NvimTree",
|
||||||
|
"Trouble",
|
||||||
|
"lir",
|
||||||
|
"Outline",
|
||||||
|
"spectre_panel",
|
||||||
|
"toggleterm",
|
||||||
|
"DressingSelect",
|
||||||
|
"neo-tree",
|
||||||
|
"",
|
||||||
|
}
|
||||||
|
local filetype_str = ""
|
||||||
|
|
||||||
|
if str == "toggleterm" then
|
||||||
|
--
|
||||||
|
filetype_str = "ToggleTerm " .. vim.api.nvim_buf_get_var(0, "toggle_number")
|
||||||
|
elseif str == "TelescopePrompt" then
|
||||||
|
filetype_str = ""
|
||||||
|
elseif str == "neo-tree" or str == "neo-tree-popup" then
|
||||||
|
if prev_filetype == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
filetype_str = prev_filetype
|
||||||
|
elseif str == "help" then
|
||||||
|
filetype_str = ""
|
||||||
|
elseif vim.tbl_contains(ui_filetypes, str) then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
prev_filetype = str
|
||||||
|
filetype_str = str
|
||||||
|
end
|
||||||
|
local left_sep = hl_str(config.separator_icon.left, "SLSeparator")
|
||||||
|
local right_sep = hl_str(config.separator_icon.right, "SLSeparator", "SLSeparator")
|
||||||
|
-- Upper case first character
|
||||||
|
filetype_str = filetype_str:gsub("%a", string.upper, 1)
|
||||||
|
local filetype_hl = hl_str(filetype_str, "SLFiletype", "SLFiletype")
|
||||||
|
return left_sep .. filetype_hl .. right_sep
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
40
.config/nvim/lua/halfdan/lualine/config.lua
Normal file
40
.config/nvim/lua/halfdan/lualine/config.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@class LualineConfig
|
||||||
|
local default = {
|
||||||
|
float = true,
|
||||||
|
separator = "bubble", -- bubble | triangle
|
||||||
|
---@type any
|
||||||
|
colorful = true,
|
||||||
|
separator_icon = { left = "", right = " " },
|
||||||
|
thin_separator_icon = { left = "", right = " " },
|
||||||
|
-- separator_icon = { left = "█", right = "█" },
|
||||||
|
-- thin_separator_icon = { left = " ", right = " " },
|
||||||
|
}
|
||||||
|
|
||||||
|
---@type LualineConfig
|
||||||
|
M.options = {}
|
||||||
|
|
||||||
|
---@param type "bubble" | "triangle"
|
||||||
|
local function make_separator(type)
|
||||||
|
if type == "bubble" then
|
||||||
|
M.options.separator_icon = { left = "█", right = "█" }
|
||||||
|
M.options.thin_separator_icon = { left = " ", right = " " }
|
||||||
|
elseif type == "triangle" then
|
||||||
|
M.options.separator_icon = { left = "█", right = "█" }
|
||||||
|
M.options.thin_separator_icon = { left = " ", right = " " }
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = function(opts)
|
||||||
|
M.options = vim.tbl_deep_extend("force", {}, default, opts or {})
|
||||||
|
if M.options.float then
|
||||||
|
make_separator(M.options.separator)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup()
|
||||||
|
|
||||||
|
return M
|
111
.config/nvim/lua/halfdan/lualine/highlights.lua
Normal file
111
.config/nvim/lua/halfdan/lualine/highlights.lua
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
local M = {}
|
||||||
|
local util = require("halfdan.util")
|
||||||
|
|
||||||
|
local function draw(groups)
|
||||||
|
if groups == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for group, value in pairs(groups) do
|
||||||
|
vim.api.nvim_set_hl(0, group, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function generate(config, palette)
|
||||||
|
local float = config.float
|
||||||
|
local colorful = config.colorful
|
||||||
|
if colorful then
|
||||||
|
palette.yellow = util.get_highlight_value("String").foreground or "#ffff00"
|
||||||
|
palette.white = util.get_highlight_value("Normal").foreground or "#ffffff"
|
||||||
|
palette.red = util.get_highlight_value("DiagnosticError").foreground or "#ff0000"
|
||||||
|
palette.orange = util.get_highlight_value("DiagnosticWarn").foreground or "#ff7700"
|
||||||
|
palette.blue = util.get_highlight_value("DiagnosticHint").foreground or "#00ffff"
|
||||||
|
palette.magenta = util.get_highlight_value("Statement").foreground or "#ff00ff"
|
||||||
|
palette.green = util.get_highlight_value("healthSuccess").foreground or "#00ff00"
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
SLGitIcon = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.white or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLBranchName = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.yellow or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLError = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.red or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLWarning = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.orange or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLInfo = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.blue or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLDiffAdd = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.green or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLDiffChange = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.yellow or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLDiffDelete = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.red or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLPosition = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.magenta or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLFiletype = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.blue or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLShiftWidth = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.yellow or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLEncoding = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.green or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLMode = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.green or palette.statusbar_fg,
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
SLSeparatorUnused = {
|
||||||
|
bg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
fg = colorful and palette.editor_bg or palette.statusbar_fg,
|
||||||
|
},
|
||||||
|
SLSeparator = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = float and palette.float_background or palette.statusbar_bg,
|
||||||
|
},
|
||||||
|
SLPadding = {
|
||||||
|
bg = float and palette.editor_bg or palette.statusbar_bg,
|
||||||
|
fg = palette.editor_bg,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param config LualineConfig
|
||||||
|
M.custom = function(config)
|
||||||
|
local statusline_hl = util.get_highlight_value("StatusLine")
|
||||||
|
local palette = {
|
||||||
|
float_background = util.get_highlight_value("CursorLine").background,
|
||||||
|
editor_bg = util.get_highlight_value("Normal").background or "NONE",
|
||||||
|
statusbar_bg = statusline_hl.background or "#000000",
|
||||||
|
statusbar_fg = statusline_hl.foreground or "#505050",
|
||||||
|
}
|
||||||
|
local groups = generate(config, palette)
|
||||||
|
|
||||||
|
draw(groups)
|
||||||
|
-- clear theme if float ortherwhise, make it auto
|
||||||
|
local theme = config.float and { normal = { c = { bg = palette.editor_bg } } } or "auto"
|
||||||
|
return theme
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
60
.config/nvim/lua/halfdan/lualine/init.lua
Normal file
60
.config/nvim/lua/halfdan/lualine/init.lua
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
local config = require("halfdan.lualine.config")
|
||||||
|
|
||||||
|
local git_blame = require('gitblame')
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function setup()
|
||||||
|
local cpn = require("halfdan.lualine.components")
|
||||||
|
local theme = require("halfdan.lualine.highlights").custom(config.options)
|
||||||
|
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
theme = theme,
|
||||||
|
icons_enabled = true,
|
||||||
|
component_separators = { left = "", right = "" },
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = { "dashboard", "lazy", "alpha" },
|
||||||
|
},
|
||||||
|
ignore_focus = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
globalstatus = true,
|
||||||
|
refresh = {
|
||||||
|
statusline = 1000,
|
||||||
|
tabline = 1000,
|
||||||
|
-- winbar = 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { cpn.branch },
|
||||||
|
lualine_b = { cpn.diagnostics },
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = { { git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }, cpn.diff },
|
||||||
|
lualine_y = { cpn.position, cpn.filetype },
|
||||||
|
lualine_z = { cpn.spaces, cpn.mode },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = config.setup
|
||||||
|
|
||||||
|
M.load = function()
|
||||||
|
setup()
|
||||||
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
callback = function()
|
||||||
|
setup()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
@ -54,8 +54,8 @@ vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else
|
|||||||
vim.o.laststatus = 3 -- Set global status bar
|
vim.o.laststatus = 3 -- Set global status bar
|
||||||
vim.b.did_ftplugin = 1
|
vim.b.did_ftplugin = 1
|
||||||
-- Enable telescope theme
|
-- Enable telescope theme
|
||||||
vim.g.gruvbox_baby_telescope_theme = 1
|
-- vim.g.gruvbox_baby_telescope_theme = 1
|
||||||
vim.g.gruvbox_baby_background_color = "dark"
|
-- vim.g.gruvbox_baby_background_color = "dark"
|
||||||
|
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
@ -63,3 +63,7 @@ vim.g.netrw_preview = 1 -- Split preview vertically
|
|||||||
vim.g.netrw_alo = 1 -- Show preview window to the right
|
vim.g.netrw_alo = 1 -- Show preview window to the right
|
||||||
vim.g.netrw_winsize = 30 -- Have the preview window take up 70%
|
vim.g.netrw_winsize = 30 -- Have the preview window take up 70%
|
||||||
-- vim.g.netrw_liststyle = 3 -- Use tree style
|
-- vim.g.netrw_liststyle = 3 -- Use tree style
|
||||||
|
--
|
||||||
|
vim.g.gitblame_display_virtual_text = 0
|
||||||
|
vim.g.gitblame_date_format = '%r'
|
||||||
|
vim.g.gitblame_message_template = '<author> • <date>'
|
||||||
|
@ -8,6 +8,7 @@ require('telescope').setup {
|
|||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
selection_caret = " ",
|
selection_caret = " ",
|
||||||
entry_prefix = " ",
|
entry_prefix = " ",
|
||||||
|
-- borderchars = { "█", " ", "▀", "█", "█", " ", " ", "▀" },
|
||||||
file_sorter = require 'telescope'.extensions.fzf.get_fzf_sorter,
|
file_sorter = require 'telescope'.extensions.fzf.get_fzf_sorter,
|
||||||
-- Developer configurations: Not meant for general override
|
-- Developer configurations: Not meant for general override
|
||||||
mappings = {
|
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