Update neovim config, add several utility scripts

main
Nils Gerstner 1 year ago
parent 3d6ff90e58
commit 86d3c58d2a

@ -1,2 +1,10 @@
require("setup")
require("note-workflow")
-- require("telescope-meilisearch")
local telescope_meilisearch = require("telescope_meilisearch")
vim.cmd("command! TelescopeMeilisearch lua telescope_meilisearch.meilisearch()")

@ -1,23 +1,24 @@
local neorgAutoCmd = vim.api.nvim_create_augroup("NeorgConcealLevel", { clear = true })
local fluxAutoCmd = vim.api.nvim_create_augroup("FluxTask", {})
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
group = neorgAutoCmd,
callback = function()
if vim.bo.filetype == "norg" or vim.bo.filetype == "markdown" then
io.popen("updateNotes.sh 2>&1>/dev/null")
end
end,
desc = "Trigger meilisearch update via bash script",
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
group = fluxAutoCmd,
callback = function()
if vim.fn.expand("%:e") == "flux" then
vim.opt.filetype = "flux"
end
end,
desc = "Trigger meilisearch update via bash script",
})
local fluxAutoCmd = vim.api.nvim_create_augroup("FluxTask", {})
local neorgAutoCmd = vim.api.nvim_create_augroup("NeorgConcealLevel", { clear = true })
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
group = fluxAutoCmd,
callback = function()
if vim.fn.expand("%:e") == "flux" then
vim.opt.filetype = "flux"
end
end,
desc = "Trigger meilisearch update via bash script",
vim.api.nvim_create_autocmd("BufWritePost", {
group = neorgAutoCmd,
-- 'FileType', {
pattern = { 'markdown', 'norg' }, -- or { 'lua', 'help' },
callback = function()
print("AUTOCMD MARKDOWN/NORG")
io.popen("updateNotes.sh 2>&1>/dev/null")
end,
desc = "Trigger meilisearch update via bash script",
})

@ -35,7 +35,7 @@ local root_files = {
if not configs.camel then
configs.camel = {
default_config = {
cmd = { "java", "-jar", "/Users/nige/.local/share/lsp/camel-lsp-server/camel-lsp-server-1.5.0.jar" },
cmd = { "java", "-jar", "/opt/camel-lsp-server.jar" },
filetypes = { 'java' },
root_dir = function(fname)
for _, patterns in ipairs(root_files) do

@ -25,22 +25,22 @@ cmp.setup {
{ name = "neorg" },
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
['<C-n>'] = cmp.mapping.select_next_item(select_opts),
['<Tab>'] = cmp.mapping.select_next_item(select_opts),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<Enter>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping(function(fallback)
['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
['<C-n>'] = cmp.mapping.select_next_item(select_opts),
['<Tab>'] = cmp.mapping.select_next_item(select_opts),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<Enter>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { 'i', 's' }),
['<C-b>'] = cmp.mapping(function(fallback)
['<C-b>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else

@ -1,4 +1,10 @@
require("mason-lspconfig").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"ansiblels", "bashls", "docker_compose_language_service", "dockerls",
"eslint", "gopls", "lua_ls", "marksman", "sqlls", "taplo", "vimls",
"yamlls"
}
})
local addDesc = function(t, v)
t["desc"] = v
@ -9,48 +15,59 @@ local default_on_attach = function(client, bufnr)
client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false
local opts = { buffer = bufnr, remap = false }
if client.name == "eslint" then
vim.cmd.LspStop("eslint")
return
end
vim.keymap.set("n", "gd", vim.lsp.buf.definition, addDesc(opts, "Go to definition"))
vim.keymap.set("n", "gd", vim.lsp.buf.definition,
addDesc(opts, "Go to definition"))
vim.keymap.set("n", "L", vim.lsp.buf.definition,
addDesc(opts, "Go to definition"))
vim.keymap.set("n", "K", vim.lsp.buf.hover, addDesc(opts, "Show Hint"))
vim.keymap.set("n", "gD", vim.diagnostic.setqflist, addDesc(opts, "Show diagnostics"))
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, addDesc(opts, "Query workspace"))
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, addDesc(opts, "Open diagnostics"))
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, addDesc(opts, "Go to next diagnostics item"))
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, addDesc(opts, "Go to previous diagnostics item"))
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, addDesc(opts, "Code action"))
vim.keymap.set("n", "gD", vim.diagnostic.setqflist,
addDesc(opts, "Show diagnostics"))
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol,
addDesc(opts, "Query workspace"))
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float,
addDesc(opts, "Open diagnostics"))
vim.keymap.set("n", "[d", vim.diagnostic.goto_next,
addDesc(opts, "Go to next diagnostics item"))
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev,
addDesc(opts, "Go to previous diagnostics item"))
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action,
addDesc(opts, "Code action"))
-- vim.keymap.set("n", "<F3>", vim.lsp.buf.code_action,
vim.keymap.set("n", "<F3>", ":CodeActionMenu<CR>", addDesc(opts, "Code action"))
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, addDesc(opts, "Go to reference"))
vim.keymap.set("n", "gr", vim.lsp.buf.references, addDesc(opts, "Go to reference"))
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, addDesc(opts, "Rename"))
vim.keymap.set("n", "<F3>", ":CodeActionMenu<CR>",
addDesc(opts, "Code action"))
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references,
addDesc(opts, "Go to reference"))
vim.keymap.set("n", "gr", vim.lsp.buf.references,
addDesc(opts, "Go to reference"))
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename,
addDesc(opts, "Rename"))
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, addDesc(opts, "Rename"))
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, addDesc(opts, "Get signature help"))
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help,
addDesc(opts, "Get signature help"))
end
local default_capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local default_capabilities = require("cmp_nvim_lsp").default_capabilities(
vim.lsp.protocol.make_client_capabilities())
local lspconfig = require("lspconfig")
lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, {
on_attach = default_on_attach,
capabilities = default_capabilities,
})
lspconfig.util.default_config = vim.tbl_extend("force",
lspconfig.util.default_config, {
on_attach = default_on_attach,
capabilities = default_capabilities
})
require("null-ls")
local mason_null_ls = require("mason-null-ls")
mason_null_ls.setup({
ensure_installed = {
-- Opt to list sources here, when available in mason.
},
require("mason-null-ls").setup({
ensure_installed = { 'shellcheck', 'goimports', 'luaformatter' },
automatic_installation = false,
automatic_setup = true, -- Recommended, but optional
handlers = {}
})
-- mason_null_ls.setup_handlers()
require("null-ls").setup({ sources = {} })
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
@ -62,8 +79,10 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Version 0.8.30
require 'lspconfig'.flux_lsp.setup {
cmd = { "/home/nige/dotfiles/.config/nvim/bin/flux-lsp", "-l", "/tmp/fluxlsp" },
capabilities = capabilities,
cmd = {
"/home/nige/dotfiles/.config/nvim/bin/flux-lsp", "-l", "/tmp/fluxlsp"
},
capabilities = capabilities
}
require("mason-lspconfig").setup_handlers({
@ -73,19 +92,27 @@ require("mason-lspconfig").setup_handlers({
["lua_ls"] = function()
require("lspconfig").lua_ls.setup({
settings = { Lua = { diagnostics = { globals = { "vim" } } } },
capabilities = capabilities,
capabilities = capabilities
})
end,
["flux_lsp"] = function()
require 'lspconfig'.flux_lsp.setup {
cmd = { "/home/nige/dotfiles/.config/nvim/bin/flux-lsp", "-l", "/tmp/fluxlsp" },
capabilities = capabilities,
cmd = {
"/home/nige/dotfiles/.config/nvim/bin/flux-lsp", "-l",
"/tmp/fluxlsp"
},
capabilities = capabilities
}
end
})
vim.diagnostic.config({
virtual_text = false,
-- float = { show_header = true, souce = "always", border = "rounded", wrap = true, },
float = { show_header = true, souce = "always", border = "rounded" },
severity_sort = true, -- default to false
float = {
show_header = true,
source = true,
border = "solid",
},
severity_sort = true -- default to false
})

@ -1,92 +1,84 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
local plugins = {
{
"preservim/vim-markdown",
dependencies = "godlygeek/tabular"
},
{ "nathanielc/vim-tickscript" },
{ "neomake/neomake" },
{ "preservim/vim-markdown", dependencies = "godlygeek/tabular" },
{ "nathanielc/vim-tickscript" }, -- { "neomake/neomake" },
{ "jghauser/follow-md-links.nvim" },
{
'akinsho/toggleterm.nvim',
version = "*",
config = true
},
{
"toppair/peek.nvim",
build = "deno task --quiet build:fast",
config = function()
require("peek").setup({
app = { "cmd.exe", "/c", "start", "msedge" }, })
local peek = require("peek")
vim.api.nvim_create_user_command("PeekOpen", function()
if not peek.is_open() and vim.bo[vim.api.nvim_get_current_buf()].filetype == "markdown" then
-- vim.fn.system("i3-msg split horizontal")
peek.open()
end
end, {})
vim.api.nvim_create_user_command("PeekClose", function()
if peek.is_open() then
peek.close()
-- vim.fn.system("i3-msg move left")
end
end, {})
end,
},
{
'gianarb/vim-flux'
},
{ 'akinsho/toggleterm.nvim', version = "*", config = true }, {
'JellyApple102/flote.nvim',
config = function()
require('flote').setup {
q_to_quit = true,
window_style = 'minimal',
-- window_style = '',
window_border = 'solid',
window_title = true
}
end
}, { 'jghauser/follow-md-links.nvim' }, {
'rebelot/kanagawa.nvim',
config = function()
require('kanagawa').setup()
-- Moved to set.lua
-- vim.cmd("colorscheme kanagawa")
end
}, {
"toppair/peek.nvim",
build = "deno task --quiet build:fast",
config = function()
require("peek").setup({ app = { "cmd.exe", "/c", "start", "msedge" } })
local peek = require("peek")
{
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
dependencies = "nvim-lua/plenary.nvim",
},
{
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
-- optional configuration
})
end,
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
},
{
"rose-pine/neovim",
name = "rose-pine",
lazy = false,
priority = 1000,
config = function()
require("rose-pine").setup()
vim.cmd("colorscheme rose-pine")
end,
},
vim.api.nvim_create_user_command("PeekOpen", function()
if not peek.is_open() and
vim.bo[vim.api.nvim_get_current_buf()].filetype ==
"markdown" then
-- vim.fn.system("i3-msg split horizontal")
peek.open()
end
end, {})
{
"TimUntersberger/neogit",
dependencies = "nvim-lua/plenary.nvim"
},
vim.api.nvim_create_user_command("PeekClose", function()
if peek.is_open() then
peek.close()
-- vim.fn.system("i3-msg move left")
end
end, {})
end
}, { 'gianarb/vim-flux' }, {
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
dependencies = "nvim-lua/plenary.nvim"
}, {
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
-- optional configuration
})
end,
dependencies = {
"MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
}, {
"rose-pine/neovim",
name = "rose-pine",
lazy = false,
priority = 1000,
config = function()
require("rose-pine").setup()
-- Moved to set.lua
-- vim.cmd("colorscheme rose-pine")
end
}, { "TimUntersberger/neogit", dependencies = "nvim-lua/plenary.nvim" },
-- { "tpope/vim-fugitive" },
@ -95,199 +87,196 @@ local plugins = {
config = function()
require("lualine").setup({
options = { theme = "auto" },
tabline = {
lualine_a = {},
lualine_b = { "branch" },
-- lualine_c = { 'filename' },
lualine_c = {},
winbar = {
lualine_a = { 'filename' },
lualine_b = { 'branch' },
lualine_c = { 'diff' },
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
inactive_winbar = {
lualine_a = { 'filename' },
lualine_b = { 'branch' },
lualine_c = { 'diff' },
lualine_x = {},
lualine_y = {},
lualine_z = {},
lualine_z = {}
},
-- tabline = {
-- lualine_a = {},
-- lualine_b = {},
-- -- lualine_b = { "branch" },
-- -- lualine_c = { 'filename' },
-- lualine_c = {},
-- lualine_x = {},
-- lualine_y = {},
-- lualine_z = {},
-- },
sections = {
lualine_b = {
"branch",
"diff",
{
"diagnostics",
sections = { "error", "warn", "info", "hint" },
diagnostics_color = {
-- Same values as the general color option can be used here.
error = "DiagnosticError", -- Changes diagnostics' error color.
warn = "DiagnosticWarn", -- Changes diagnostics' warn color.
info = "DiagnosticInfo", -- Changes diagnostics' info color.
hint = "DiagnosticHint", -- Changes diagnostics' hint color.
},
symbols = { error = "E", warn = "W", info = "I", hint = "H" },
colored = true, -- Displays diagnostics status in color if set to true.
update_in_insert = false, -- Update diagnostics in insert mode.
always_visible = false, -- Show diagnostics even if there are none.
"branch", "diff", {
"diagnostics",
sections = { "error", "warn", "info", "hint" },
diagnostics_color = {
-- Same values as the general color option can be used here.
error = "DiagnosticError", -- Changes diagnostics' error color.
warn = "DiagnosticWarn", -- Changes diagnostics' warn color.
info = "DiagnosticInfo", -- Changes diagnostics' info color.
hint = "DiagnosticHint" -- Changes diagnostics' hint color.
},
symbols = {
error = "E",
warn = "W",
info = "I",
hint = "H"
},
colored = true, -- Displays diagnostics status in color if set to true.
update_in_insert = false, -- Update diagnostics in insert mode.
always_visible = false -- Show diagnostics even if there are none.
}
},
-- lualine_c = { sections = { 'lsp_progress' } },
lualine_x = {
"encoding",
{
"fileformat",
symbols = {
unix = "unix", -- e712
dos = "dos", -- e70f
mac = "mac", -- e711
},
},
"filetype",
"lsp_progress",
"encoding", {
"fileformat",
symbols = {
unix = "unix", -- e712
dos = "dos", -- e70f
mac = "mac" -- e711
}
}, "filetype", "lsp_progress"
-- "tabnine",
},
},
}
}
})
end,
},
end
}, {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "help", "query" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
"awk", "bash", "bibtex", "c", "c_sharp", "clojure", "cmake",
"comment", "css", "diff", "dockerfile", "dot", "elm",
"git_config", "git_rebase", "gitattributes", "gitcommit",
"gitignore", "go", "godot_resource", "gomod", "gosum",
"gowork", "graphql", "help", "html", "http", "ini", "java",
"javascript", "jq", "jsdoc", "json", "json5", "kotlin",
"latex", "lua", "luadoc", "luap", "luau", "make",
"markdown", "markdown_inline", "norg", "norg_meta", "org",
"perl", "php", "python", "query", "regex", "rust", "sql",
"terraform", "toml", "typescript", "vim", "vimdoc", "yaml"
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
})
end,
},
{ "nvim-treesitter/playground" },
{ "theprimeagen/harpoon" },
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats =
pcall(vim.loop.fs_stat,
vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false
}
})
end
}, { "nvim-treesitter/playground" }, { "theprimeagen/harpoon" },
{ "mbbill/undotree" },
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
config = function() require("mason").setup() end
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = { "neovim/nvim-lspconfig" },
},
{
"jay-babu/mason-null-ls.nvim",
-- config = function()
-- local mason_null_ls = require("mason-null-ls")
--
-- mason_null_ls.setup({
-- ensure_installed = {
-- -- Opt to list sources here, when available in mason.
-- },
-- automatic_installation = false,
-- automatic_setup = true, -- Recommended, but optional
-- })
--
-- local null_ls = require("null-ls")
-- null_ls.setup(
-- -- {
-- -- sources = {
-- -- null_ls.builtins.formatting.beautysh,
-- -- },
-- -- }
-- )
-- mason_null_ls.setup_handlers()
-- end,
dependencies = { "jose-elias-alvarez/null-ls.nvim" },
},
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
-- Autocompletion
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-cmdline" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip" },
-- -- Debugging
dependencies = { "neovim/nvim-lspconfig" }
}, {
"jay-babu/mason-null-ls.nvim",
-- config = function()
-- local mason_null_ls = require("mason-null-ls")
--
-- mason_null_ls.setup({
-- ensure_installed = {
-- -- Opt to list sources here, when available in mason.
-- },
-- automatic_installation = false,
-- automatic_setup = true, -- Recommended, but optional
-- })
--
-- local null_ls = require("null-ls")
-- null_ls.setup(
-- -- {
-- -- sources = {
-- -- null_ls.builtins.formatting.beautysh,
-- -- },
-- -- }
-- )
-- mason_null_ls.setup_handlers()
-- end,
dependencies = { "jose-elias-alvarez/null-ls.nvim" }
}, -- Snippets
{ "L3MON4D3/LuaSnip" }, { "rafamadriz/friendly-snippets" }, -- Autocompletion
{ "hrsh7th/cmp-buffer" }, { "hrsh7th/cmp-cmdline" }, { "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" }, { "hrsh7th/cmp-path" }, { "hrsh7th/nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip" }, -- -- Debugging
{
"jay-babu/mason-nvim-dap.nvim",
config = function()
require("mason-nvim-dap").setup({
ensure_installed = { "delve" }
})
require("mason-nvim-dap").setup({ ensure_installed = { "delve" } })
end
}, { "mfussenegger/nvim-jdtls" }, { "mfussenegger/nvim-dap" },
{ "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap" } }, {
"JoosepAlviste/nvim-ts-context-commentstring",
dependencies = {
{ "numToStr/Comment.nvim" }, { "nvim-treesitter/nvim-treesitter" }
},
{ "mfussenegger/nvim-jdtls" },
{ "mfussenegger/nvim-dap" },
{
"rcarriga/nvim-dap-ui",
dependencies = { "mfussenegger/nvim-dap" }
},
{
"JoosepAlviste/nvim-ts-context-commentstring",
dependencies = {
{ "numToStr/Comment.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require('Comment').setup()
local ft = require('Comment.ft')
ft.set('flux', '// %s')
require("nvim-treesitter.configs").setup({
context_commentstring = { enable = true, enable_autocmd = false },
})
end,
},
{
"numToStr/Comment.nvim",
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
},
-- {
config = function()
require('Comment').setup()
local ft = require('Comment.ft')
ft.set('flux', '// %s')
require("nvim-treesitter.configs").setup({
context_commentstring = { enable = true, enable_autocmd = false }
})
end
}, {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup({
pre_hook = require(
"ts_context_commentstring.integrations.comment_nvim").create_pre_hook()
})
end
}, {
"folke/which-key.nvim",
config = function() require("which-key").setup({}) end
}, -- {
-- "tzachar/cmp-tabnine",
-- build = "./install.sh",
-- dependencies = "hrsh7th/nvim-cmp",
@ -308,98 +297,86 @@ local plugins = {
-- })
-- end,
-- },
{
"weilbith/nvim-code-action-menu",
cmd = "CodeActionMenu"
},
{ "weilbith/nvim-code-action-menu", cmd = "CodeActionMenu" },
{
"kosayoda/nvim-lightbulb",
dependencies = "antoinemadec/FixCursorHold.nvim",
},
{
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-vim-test",
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-vim-test")({ ignore_filetypes = {} }),
},
})
end,
},
{ "nvim-neorg/tree-sitter-norg" },
{ "nvim-neorg/neorg-telescope" },
{
"nvim-neorg/neorg",
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {}, -- Load all the default modules
["core.norg.concealer"] = {
-- config = {
-- folds = false,
-- },
},
["core.norg.dirman"] = { -- Manage your directories with Neorg
config = {
workspaces = {
work = "/Users/nige/notes/work",
home = "/Users/nige/notes/home",
gtd =
"/Users/nige/Documents/PARA/PROJECTS/example_workspaces/gtd",
-- gtd = "/Users/nige/gtd"
},
},
},
-- ["core.gtd.base"] = {
-- config = {
-- workspace = "gtd",
-- -- workspace = "notes",
-- },
-- },
["core.norg.completion"] = {
config = {
engine = "nvim-cmp", -- We current support nvim-compe and nvim-cmp only
},
},
["core.norg.qol.todo_items"] = {},
-- ["core.norg.qol.toc"] = {
-- config = { -- Note that this table is optional and doesn't need to be provided
-- -- Configuration here
-- default_toc_mode = "toqflist"
-- }
-- },
-- ["core.norg.journal"] = {
-- config = { -- Note that this table is optional and doesn't need to be provided
-- -- workspace = "notes",
-- }
-- },
-- ["core.presenter"] = {
-- config = { -- Note that this table is optional and doesn't need to be provided
-- -- Configuration here
-- -- zen_mode = "truezen",
-- zen_mode = "zen-mode"
-- }
-- },
["core.export"] = {
config = { -- Note that this table is optional and doesn't need to be provided
-- Configuration here
},
},
["core.integrations.telescope"] = {}, -- Enable the telescope module
},
})
end,
dependencies = "nvim-neorg/neorg-telescope", -- Be sure to pull in the repo
dependencies = "antoinemadec/FixCursorHold.nvim"
}, {
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim", "nvim-neotest/neotest-vim-test"
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-vim-test")({ ignore_filetypes = {} })
}
})
end
}, { "nvim-neorg/tree-sitter-norg" }, { "nvim-neorg/neorg-telescope" }, {
"nvim-neorg/neorg",
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {} -- Load all the default modules
-- ["core.norg.concealer"] = {
-- -- config = {
-- -- folds = false,
-- -- },
-- },
-- ["core.norg.dirman"] = { -- Manage your directories with Neorg
-- config = {
-- workspaces = {
-- work = "/Users/nige/notes/work",
-- home = "/Users/nige/notes/home",
-- gtd =
-- "/Users/nige/Documents/PARA/PROJECTS/example_workspaces/gtd",
-- -- gtd = "/Users/nige/gtd"
-- },
-- },
-- },
-- -- ["core.gtd.base"] = {
-- -- config = {
-- -- workspace = "gtd",
-- -- -- workspace = "notes",
-- -- },
-- -- },
-- ["core.norg.completion"] = {
-- config = {
-- engine = "nvim-cmp", -- We current support nvim-compe and nvim-cmp only
-- },
-- },
-- ["core.norg.qol.todo_items"] = {},
-- -- ["core.norg.qol.toc"] = {
-- -- config = { -- Note that this table is optional and doesn't need to be provided
-- -- -- Configuration here
-- -- default_toc_mode = "toqflist"
-- -- }
-- -- },
-- -- ["core.norg.journal"] = {
-- -- config = { -- Note that this table is optional and doesn't need to be provided
-- -- -- workspace = "notes",
-- -- }
-- -- },
-- -- ["core.presenter"] = {
-- -- config = { -- Note that this table is optional and doesn't need to be provided
-- -- -- Configuration here
-- -- -- zen_mode = "truezen",
-- -- zen_mode = "zen-mode"
-- -- }
-- -- },
-- ["core.export"] = {
-- config = { -- Note that this table is optional and doesn't need to be provided
-- -- Configuration here
-- },
-- },
-- ["core.integrations.telescope"] = {}, -- Enable the telescope module
}
})
end
-- dependencies = "nvim-neorg/neorg-telescope", -- Be sure to pull in the repo
}
}
local opts = {
@ -425,14 +402,9 @@ local opts = {
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
},
list = { "", "", "", "" }
}
}
}
require("lazy").setup(plugins, opts)

@ -39,7 +39,14 @@ vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc ="Telescope - find
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc ="Telescope - live grep" })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc ="Telescope - buffers" })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc ="Telescope - hellp tags" })
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc ="Telescope - diagnostics" })
vim.keymap.set('n', '<leader>fd', function() builtin.diagnostics({bufnr=0}) end , { desc ="Telescope - diagnostics" })
vim.keymap.set('n', '<leader>fD', builtin.diagnostics, { desc ="Telescope - workspace diagnostics" })
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, { desc ="Telescope - lsp reference" })
vim.keymap.set('n', '<leader>fri', builtin.lsp_incoming_calls, { desc ="Telescope - lsp incomming calls" })
vim.keymap.set('n', '<leader>fro', builtin.lsp_outgoing_calls, { desc ="Telescope - lsp outgoing calls" })
local terminal = require('toggleterm.terminal').Terminal
vim.keymap.set('n', '<leader>t', "<cmd>ToggleTerm<CR>", { desc ="Toggle Terminal" })
vim.keymap.set('n', '<leader>nn', "<cmd>Flote<CR>", { desc ="open project notes" })
vim.keymap.set('n', '<leader>mm', "<cmd>Flote global<CR>", { desc ="open global notes" })

@ -1,5 +1,9 @@
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.signcolumn = "yes"
-- vim.opt.number = true
-- vim.opt.relativenumber = true
-- vim.opt.signcolumn = "number"
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
@ -20,7 +24,6 @@ vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
@ -32,3 +35,6 @@ vim.opt.foldlevelstart = 99
vim.g.vim_markdown_folding_disabled = 1
vim.g.tick_fmt_autosave = 0
vim.cmd("colorscheme kanagawa")
-- vim.cmd("colorscheme rose-pine")

@ -0,0 +1,56 @@
local uv = vim.loop
local function parse_headers(lines)
local headers = {}
for _, line in ipairs(lines) do
local key, value = line:match("^(.-):%s*(.*)$")
if key then
headers[key:lower()] = value
end
end
return headers
end
local function make_request(url, method, headers, payload)
local parts = vim.split(url, "/")
local host = parts[3]
local path = "/" .. table.concat(parts, "/", 4)
local tcp = uv.new_tcp()
local results = {}
tcp:connect(host, 7700, function(err)
assert(not err, err)
tcp:write(method .. " " .. path .. " HTTP/1.1\r\n" ..
"Host: " .. host .. "\r\n" ..
table.concat(headers, "\r\n") ..
"\r\n\r\n" .. payload,
function(write_err)
assert(not write_err, write_err)
tcp:read_start(function(read_err, chunk)
assert(not read_err, read_err)
if chunk then
table.insert(results, chunk)
else
tcp:read_stop()
tcp:close()
end
end)
end)
end)
uv.run()
local raw_response = table.concat(results)
local _, header_end = raw_response:find("\r\n\r\n")
local raw_headers = raw_response:sub(1, header_end)
local body = raw_response:sub(header_end + 1)
local headers = parse_headers(vim.split(raw_headers, "\r\n"))
return headers, body
end
return {
make_request = make_request
}

@ -0,0 +1,71 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local sorters = require("telescope.sorters")
local config = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local http_client = require("telescope_meilisearch.http_client")
local function search_meilisearch(query)
local url = "http://127.0.0.1:7700/indexes/notes/search"
local payload = '{"q": "' .. query .. '"}'
local headers = {
"Content-Type: application/json",
"Content-Length: " .. #payload
}
local _, body = http_client.make_request(url, "POST", headers, payload)
local results = vim.fn.json_decode(body).hits
return results
end
local function meilisearch(opts)
local query = vim.fn.input("Meilisearch> ")
if query == "" then
return
end
local results = search_meilisearch(query)
if #results == 0 then
print("No results found")
return
end
pickers.new(opts, {
prompt_title = "Meilisearch",
finder = finders.new_table {
results = results,
entry_maker = function(entry)
return {
value = entry.title,
display = entry.title .. " - " .. entry.path,
ordinal = entry.title,
path = entry.path,
line_number = entry.line_number,
column_number = entry.column_number,
}
end,
},
sorter = config.generic_sorter(opts),
attach_mappings = function(_, map)
map("i", "<CR>", function(prompt_bufnr)
local selection = action_state.get_selected_entry()
actions.close(prompt_bufnr)
if selection then
vim.cmd("e " .. selection.path)
vim.cmd(selection.line_number .. "G")
vim.cmd("normal! " .. selection.column_number .. "|")
end
end)
return true
end,
}):find()
end
return {
meilisearch = meilisearch
}

@ -32,18 +32,21 @@ CUSTOMER_ROOT_FOLDERS="${HOME}/Documents/Code/BOLIDEN
${HOME}/Documents/Code/GERSTNER
${HOME}/Documents/Code/REPLYTO
${HOME}/Documents/Code/RISE
${HOME}/Documents/Code/VOLVOCARS"
${HOME}/Documents/Code/VOLVOCARS
${HOME}/Documents/Code/POLIS"
_get_root() {
if [ -f ${SELECTED_FOLDERS_LOG} ] && [ $( wc -l ${SELECTED_FOLDERS_LOG} | grep -oe "^[0-9]\+") -gt 0 ]; then
tac $SELECTED_FOLDERS_LOG | grep -oe "^\S\+"
if [ -f "${SELECTED_FOLDERS_LOG}" ] && \
[ $( wc -l "${SELECTED_FOLDERS_LOG}" | grep -oe "^[0-9]\+") -gt 0 ]; then
tac "$SELECTED_FOLDERS_LOG" | grep -oe "^\S\+"
fi
echo -e "${CUSTOMER_ROOT_FOLDERS}"
}
_get_subfolder() {
if [ -f ${SELECTED_FOLDERS_LOG} ] && [ $( wc -l ${SELECTED_FOLDERS_LOG} | grep -oe "^[0-9]\+") -gt 0 ]; then
tac $SELECTED_FOLDERS_LOG | grep -e "^${root_dir} \S\+" | grep -oe "\S\+$"
if [ -f "${SELECTED_FOLDERS_LOG}" ] && \
[ $( wc -l "${SELECTED_FOLDERS_LOG}" | grep -oe "^[0-9]\+") -gt 0 ]; then
tac "$SELECTED_FOLDERS_LOG" | grep -e "^${root_dir} \S\+" | grep -oe "\S\+$"
fi
find "$root_dir" -mindepth 1 -maxdepth 1 -type d -printf "%Ts\t%f\n" | sort -rn| cut -f 2
}

@ -5,11 +5,11 @@ getDocumentMetadataHeader() {
sed -e '/^[@]document[.]meta/,/^[@]end$/!d' "$file" | \
grep -ve "^[@]\(document[.]meta\|end\)" | \
grep -oe "\S.*$"
}
}
getDocumentMetadataValue() {
local file="$1"
local key="$2"
getDocumentMetadataValue() {
local file="$1"
local key="$2"
#Example header:
#
@ -82,12 +82,12 @@ NorgGetDocumentBody() {
tail -n +$lines "$file"
}
#title: 202112291700-sshconnect_script.md
#description:
#authors: nige
#categories: bash, ssh, script
#created: 2021-12-29
#version: 0.0.9
#title: 202112291700-sshconnect_script.md
#description:
#authors: nige
#categories: bash, ssh, script
#created: 2021-12-29
#version: 0.0.9
#echo "TEST:"
#echo
@ -109,10 +109,10 @@ filename="$(basename "$1")"
type="${filename##*.}"
case ${type^^} in
"SH" ) filetype="bash";;
"MD" | "MARKDOWN" ) filetype="markdown";;
"norg" ) filetype="neorg";;
* ) filetype="${type,,}";;
"SH" ) filetype="bash" ;;
"MD" | "MARKDOWN" ) filetype="markdown" ;;
"norg" ) filetype="neorg" ;;
* ) filetype="${type,,}" ;;
esac
jq -n \
@ -140,17 +140,17 @@ jq -n \
"tags": [],
"headerlines": $headerlines,
"refcount": $refcount,
"body": $body }' > /tmp/tmpFile
while read -re value; do
jq --arg value "${value}" '.authors += [ $value ]' /tmp/tmpFile > /tmp/tmpFile2
mv /tmp/tmpFile2 /tmp/tmpFile
done <<< $(NorgGetAuthors $1)
while read -e value; do
jq --arg value "${value}" '.tags += [ $value ]' /tmp/tmpFile > /tmp/tmpFile2
mv /tmp/tmpFile2 /tmp/tmpFile
done <<< $(NorgGetTags $1)
jq --argjson var "$(< /tmp/tmpFile)" '. |= . + [$var]' <<< "[]"
"body": $body }' > /tmp/tmpFile
while read -re value; do
jq --arg value "${value}" '.authors += [ $value ]' /tmp/tmpFile > /tmp/tmpFile2
mv /tmp/tmpFile2 /tmp/tmpFile
done <<< $(NorgGetAuthors $1)
while read -e value; do
jq --arg value "${value}" '.tags += [ $value ]' /tmp/tmpFile > /tmp/tmpFile2
mv /tmp/tmpFile2 /tmp/tmpFile
done <<< $(NorgGetTags $1)
jq --argjson var "$(< /tmp/tmpFile)" '. |= . + [$var]' <<< "[]"
#jq < /tmp/tmpFile

@ -0,0 +1,8 @@
#!/bin/bash
tag="$1"
if [ -n "$tag" ]; then
tag="-t $tag "
fi
sudo su -c "ansible-playbook ${tag}/home/nige/Documents/Code/GERSTNER/ansible_setup/local.yml"
sudo apt upgrade
Loading…
Cancel
Save