1
0
Fork 0

lots of configuration work

This commit is contained in:
Luca Bilke 2024-04-12 18:49:52 +02:00
parent abea5cdae6
commit 1a228b6827
10 changed files with 100 additions and 87 deletions

View File

@ -1,3 +1,4 @@
map gh cd /home/luca map gh cd /home/luca
map gch cd /home/luca/.cache map gch cd /home/luca/.cache
map gcf cd /home/luca/.config map gcf cd /home/luca/.config

View File

@ -14,7 +14,10 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" }, {
"LazyVim/LazyVim",
import = "lazyvim.plugins"
},
{ import = "lazyvim.plugins.extras.coding.yanky" }, { import = "lazyvim.plugins.extras.coding.yanky" },
{ import = "lazyvim.plugins.extras.coding.copilot" }, { import = "lazyvim.plugins.extras.coding.copilot" },
{ import = "lazyvim.plugins.extras.dap.core" }, { import = "lazyvim.plugins.extras.dap.core" },
@ -25,7 +28,7 @@ require("lazy").setup({
{ import = "plugins" }, { import = "plugins" },
}, },
defaults = { defaults = {
lazy = false, lazy = true,
version = false, version = false,
}, },
install = { colorscheme = { "tokyonight" } }, install = { colorscheme = { "tokyonight" } },

View File

@ -3,7 +3,13 @@
-- Add any additional options here -- Add any additional options here
local o = vim.opt local o = vim.opt
local g = vim.g
o.shiftwidth = 4 o.shiftwidth = 4
o.tabstop = 4 o.tabstop = 4
o.scrolloff = 8 o.scrolloff = 8
g.loaded_node_provider = 0
g.loaded_perl_provider = 0
g.loaded_python3_provider = 0
g.loaded_ruby_provider = 0

View File

@ -28,6 +28,7 @@ M.mason_install = {
"ansible-lint", "ansible-lint",
"ansible-language-server", "ansible-language-server",
"basedpyright", "basedpyright",
"bash-language-server",
"codelldb", "codelldb",
"dockerfile-language-server", "dockerfile-language-server",
"docker-compose-language-service", "docker-compose-language-service",
@ -37,6 +38,7 @@ M.mason_install = {
"marksman", "marksman",
"markdownlint", "markdownlint",
"ruff-lsp", "ruff-lsp",
"rust-analyzer"
} }
---@type Array<string> ---@type Array<string>

View File

@ -37,49 +37,60 @@ return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
opts = function(_, opts) opts = function(_, opts)
local cmp = require("cmp") local cmp = require("cmp")
local function has_words_before() local luasnip = require("luasnip")
local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
-- stylua: ignore
table.insert(opts.auto_brackets, "python") table.insert(opts.auto_brackets, "python")
table.insert(opts.sources, { name = "crates" }) table.insert(opts.sources, { name = "crates" })
opts.mapping = vim.tbl_deep_extend("force", opts.mapping, { opts.preselect = cmp.PreselectMode.None
["<up>"] = require("cmp").mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), opts.snippet = {
["<Down>"] = require("cmp").mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), expand = function(args)
["<C-p>"] = require("cmp").mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), require("luasnip").lsp_expand(args.body)
["<C-n>"] = require("cmp").mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), end,
["<C-k>"] = require("cmp").mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), }
["<C-j>"] = require("cmp").mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), opts.mapping = {
["<C-u>"] = require("cmp").mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), ['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<C-d>"] = require("cmp").mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), ['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-Space>"] = cmp.mapping.confirm({ select = false }), -- TODO: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#confirm-candidate-on-tab-immediately-when-theres-only-one-completion-entry
["<C-y>"] = cmp.config.disable, ['<C-Space>'] = cmp.mapping(function(fallback)
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), if cmp.visible() then
["<CR>"] = vim.NIL, if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({
select = true,
})
end
else
fallback()
end
end),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif require("luasnip").expand_or_locally_jumpable() then elseif luasnip.locally_jumpable(1) then
require("luasnip").expand_or_jump() luasnip.jump(1)
elseif has_words_before() then
cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then elseif luasnip.locally_jumpable(-1) then
require("luasnip").jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
}) }
opts.experimental = {
ghost_text = false,
}
end, end,
}, },
{ {
@ -135,7 +146,7 @@ return {
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>dPt", function() require("dap-python").test_method() end, desc = "Debug Method", ft = "python" }, { "<leader>dPt", function() require("dap-python").test_method() end, desc = "Debug Method", ft = "python" },
{ "<leader>dPc", function() require("dap-python").test_class() end, desc = "Debug Class", ft = "python" }, { "<leader>dPc", function() require("dap-python").test_class() end, desc = "Debug Class", ft = "python" },
}, },
config = function() config = function()
local path = require("mason-registry").get_package("debugpy"):get_install_path() local path = require("mason-registry").get_package("debugpy"):get_install_path()

View File

@ -3,9 +3,9 @@ return {
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
lazy = true, lazy = true,
opts = { style = "night" }, opts = { style = "night" },
-- on_highlights = function(hl, _) on_highlights = function(hl, _)
-- hl.CurSearch = nil hl.CurSearch = nil
-- end end
}, },
{ {
"folke/noice.nvim", "folke/noice.nvim",
@ -46,4 +46,31 @@ return {
}, },
}, },
}, },
{
"nvim-lualine/lualine.nvim",
opts = {
sections = {
lualine_y = {
{
function()
local chars = { "", "", "", "", "", "", "", "", "", "", "", "", "" }
return chars[math.ceil(vim.fn.line "." / vim.fn.line "$" * #chars)]
end,
separator = " ",
padding = { left = 1, right = 0 },
},
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {
{
"o:encoding",
fmt = string.upper,
separator = " ",
padding = { left = 1, right = 0 },
},
{ "fileformat", padding = { left = 0, right = 1 } },
},
}
}
}
} }

View File

@ -9,8 +9,8 @@ map D navigate next
map P toggle_page_mode map P toggle_page_mode
map r reload map r reload
map R rotate map R rotate
map K zoom in map K page-up
map J zoom out map J page-down
map i recolor map i recolor
map p print map p print
map g goto top map g goto top

View File

@ -125,9 +125,11 @@ localpath="$(find -L ~/.local/bin -type d -printf %p: | sed 's/.$//')"
fpath=($XDG_CONFIG_HOME/zsh/completions $fpath) fpath=($XDG_CONFIG_HOME/zsh/completions $fpath)
export PATH="$PATH:$localpath" export PATH="$PATH:$localpath"
# export NVM_DIR="$HOME/.config/nvm" export PNPM_HOME="/home/luca/.local/share/pnpm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm case ":$PATH:" in
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion *":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
unset SSH_AGENT_PID unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then

View File

@ -1,3 +1,4 @@
hash -d h=/home/luca hash -d h=/home/luca
hash -d ch=/home/luca/.cache hash -d ch=/home/luca/.cache
hash -d cf=/home/luca/.config hash -d cf=/home/luca/.config

View File

@ -1,66 +1,26 @@
#!/bin/sh #!/bin/sh
# Inputs
bmdirs="$XDG_CONFIG_HOME/directories"
# Outputs
zsh_named_dirs="$ZDOTDIR/configs/hashes"
# lf_dirs="$XDG_DATA_HOME/lf/shortcuts"
lf_maps="$XDG_CONFIG_HOME/lf/shortcuts"
# TODO: Finish this function LOL
# find_marker() {
# file=$1
# for marker in \
# "# @SHORTCUTS@" \
# "-- @SHORTCUTS@" \
# "// @SHORTCUTS@" \
# "/* @SHORTCUTS@ */"; do
# file=$(grep -xn "$marker" "$file")
# if [ -n "$file" ]; then
# echo "$file"
# return
# fi
# done
# }
zsh() {
xargs printf "hash -d %s=%s\n"
}
clean() { clean() {
rm -rf "/tmp/shortcuts" echo >"$ZDOTDIR/configs/hashes"
echo >"$XDG_CONFIG_HOME/lf/shortcuts"
} }
write_dirs_tmp() { write() {
while IFS= read -r line; do while IFS= read -r line; do
shortcut=$(echo "$line" | cut -d' ' -f1) shortcut=$(echo "$line" | cut -d' ' -f1)
path=$(echo "$line" | cut -d' ' -f2) path=$(echo "$line" | cut -d' ' -f2)
path=$(eval "echo $path") path=$(eval "echo $path")
printf "hash -d %s=%s\n" "$shortcut" "$path" >>"/tmp/shortcuts/zsh_named_dirs" printf "hash -d %s=%s\n" "$shortcut" "$path" >>"$ZDOTDIR/configs/hashes"
# printf "%s:%s\n" "$shortcut" "$path" >>"/tmp/shortcuts/lf_dirs" printf "map g%s cd %s\n" "$shortcut" "$path" >>"$XDG_CONFIG_HOME/lf/shortcuts"
printf "map g%s cd %s\n" "$shortcut" "$path" >>"/tmp/shortcuts/lf_maps"
done done
} }
apply_tmp() { filter() {
cat /tmp/shortcuts/zsh_named_dirs >"$zsh_named_dirs" input=$1
# cat /tmp/shortcuts/lf_dirs >"$lf_dirs" sed 's/#.*//;/^$/d;s/ \+/ /g' "$input"
cat /tmp/shortcuts/lf_maps >"$lf_maps"
} }
read_file() {
in_file=$1
sed 's/#.*//;/^$/d' "$in_file" | tr -s ' '
}
trap clean EXIT
mkdir -p /tmp/shortcuts
read_file "$bmdirs" | write_dirs_tmp
apply_tmp
clean clean
filter "$XDG_CONFIG_HOME/directories" | write