Compare commits

..

3 Commits

Author SHA1 Message Date
andrzej 808c59f8d7 setup project manager 2024-05-06 23:02:00 +02:00
andrzej 4ac106cdb0 add float styling 2024-05-06 23:01:11 +02:00
andrzej fbf754ea9f fix treesitter folding 2024-05-06 23:00:58 +02:00
7 changed files with 110 additions and 13 deletions

View File

@ -1,6 +1,7 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.have_nerd_font = true
require("project_dotfiles_autocommands")
require("options.default")
require("lazy_bootstrap")
require("lazy").setup({ { import = "plugins" } })

View File

@ -41,7 +41,7 @@ vim.opt.cursorline = true
vim.opt.scrolloff = 10
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldtext = ""
vim.o.fillchars = "fold: "
vim.o.foldenable = false

View File

@ -94,6 +94,13 @@ return { -- LSP Configuration & Plugins
end
end,
})
--bring up a popup when the cursor hovers over an error
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
group = vim.api.nvim_create_augroup("float_diagnostic", { clear = true }),
callback = function()
vim.diagnostic.open_float(nil, { focus = false })
end,
})
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP Specification.
@ -112,8 +119,31 @@ return { -- LSP Configuration & Plugins
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
--
local arch = require("jit").arch
--get architecture as string (to blocklist installs that don't work on Android)
--Pop-up border styling
local border = {
{ "🭽", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭾", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭿", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭼", "FloatBorder" },
{ "", "FloatBorder" },
}
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
--global diagnostic popup options
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = true,
severity_sort = false,
})
local servers = {
-- clangd = {},

View File

@ -0,0 +1,21 @@
return {
"coffebar/neovim-project",
opts = {
projects = { -- define project roots
"~/projects/*",
"~/.config/*",
"~/dev/*",
},
},
init = function()
-- enable saving the state of plugins in the session
vim.opt.sessionoptions:append("globals") -- save global variables that start with an uppercase letter and contain at least one lowercase letter.
end,
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim", tag = "0.1.4" },
{ "Shatur/neovim-session-manager" },
},
lazy = false,
priority = 100,
}

View File

@ -1,9 +0,0 @@
return {
"rmagatti/auto-session",
config = function()
require("auto-session").setup({
log_level = "error",
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
})
end,
}

View File

@ -151,7 +151,7 @@ return { -- Fuzzy Finder (files, lsp, etc)
vim.keymap.set(
"n",
"<leader>sp",
"<cmd>lua require'telescope'.extensions.project.project{}<CR>",
"<cmd>:Telescope neovim-project discover<CR>",
{ desc = "[S]earch [P]rojects", noremap = true, silent = true }
)
-- Slightly advanced example of overriding default behavior and theme

View File

@ -0,0 +1,54 @@
local augroup = vim.api.nvim_create_augroup("user_cmds", { clear = true })
local function update_git_env_for_dotfiles()
-- Auto change ENV variables to enable
-- bare git repository for dotfiles after
-- loading saved session
local home = vim.fn.expand("~")
local git_dir = home .. "/dotfiles"
if vim.env.GIT_DIR ~= nil and vim.env.GIT_DIR ~= git_dir then
return
end
-- check dotfiles dir exists on current machine
if vim.fn.isdirectory(git_dir) ~= 1 then
vim.env.GIT_DIR = nil
vim.env.GIT_WORK_TREE = nil
return
end
-- check if the current working directory should belong to dotfiles
local cwd = vim.loop.cwd()
if vim.startswith(cwd, home .. "/.config/") or cwd == home or cwd == home .. "/.local/bin" then
if vim.env.GIT_DIR == nil then
-- export git location into ENV
vim.env.GIT_DIR = git_dir
vim.env.GIT_WORK_TREE = home
end
else
if vim.env.GIT_DIR == git_dir then
-- unset variables
vim.env.GIT_DIR = nil
vim.env.GIT_WORK_TREE = nil
end
end
end
vim.api.nvim_create_autocmd("DirChanged", {
pattern = { "*" },
group = augroup,
desc = "Update git env for dotfiles after changing directory",
callback = function()
update_git_env_for_dotfiles()
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = { "SessionLoadPost" },
group = augroup,
desc = "Update git env for dotfiles after loading session",
callback = function()
update_git_env_for_dotfiles()
end,
})