Add flux and go workflows

main
Nils Gerstner 1 year ago
parent b9891bcd62
commit 3d6ff90e58

@ -0,0 +1 @@
vim.cmd("compiler go")

@ -1,50 +1,70 @@
local dap = require('dap')
dap.adapters.bashdb = {
type = 'executable',
command = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/bash-debug-adapter',
name = 'bashdb'
}
dap.set_log_level('INFO') -- Helps when configuring DAP, see logs with :DapShowLog
dap.configurations.sh = {
{
type = 'bashdb',
request = 'launch',
name = "Launch file",
showDebugOutput = true,
pathBashdb = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb',
pathBashdbLib = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/extension/bashdb_dir',
trace = true,
file = "${file}",
program = "${file}",
cwd = '${workspaceFolder}',
pathCat = "cat",
pathBash = "/opt/homebrew/bin/bash",
pathMkfifo = "mkfifo",
pathPkill = "pkill",
args = {},
env = {},
terminalKind = "integrated",
autoReload = { enable = true }
dap.adapters = {
bashdb = {
type = 'executable',
command = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/bash-debug-adapter',
name = 'bashdb'
},
java = function(callback)
-- FIXME:
-- Here a function needs to trigger the `vscode.java.startDebugSession` LSP command
-- The response to the command must be the `port` used below
callback({ type = 'server', host = '127.0.0.1', port = 5005 })
end,
go = {
type = "server",
port = "${port}",
executable = {
command = vim.fn.stdpath("data") .. '/mason/bin/dlv',
args = { "dap", "-l", "127.0.0.1:${port}" },
}
}
}
dap.adapters.java = function(callback)
-- FIXME:
-- Here a function needs to trigger the `vscode.java.startDebugSession` LSP command
-- The response to the command must be the `port` used below
callback({ type = 'server', host = '127.0.0.1', port = 5005 })
end
dap.configurations.java = {
{
type = 'java',
request = 'attach',
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005
dap.configurations = {
go = {
{
type = "go", -- Which adapter to use
name = "Debug", -- Human readable name
request = "launch", -- Whether to "launch" or "attach" to program
program = "${file}", -- The buffer you are focused on when running nvim-dap
},
},
sh = {
{
type = 'bashdb',
request = 'launch',
name = "Launch file",
showDebugOutput = true,
pathBashdb = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb',
pathBashdbLib = vim.fn.stdpath("data") ..
'/mason/packages/bash-debug-adapter/extension/bashdb_dir',
trace = true,
file = "${file}",
program = "${file}",
cwd = '${workspaceFolder}',
pathCat = "cat",
pathBash = "/opt/homebrew/bin/bash",
pathMkfifo = "mkfifo",
pathPkill = "pkill",
args = {},
env = {},
terminalKind = "integrated",
autoReload = { enable = true }
}
},
java = {
{
type = 'java',
request = 'attach',
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005
}
}
}

@ -0,0 +1,32 @@
-- local lspconfig = require 'lspconfig'
-- local configs = require 'lspconfig.configs'
-- local util = require 'lspconfig.util'
-- local function getPath(str)
-- return str:match("(.*[/\\])")
-- end
--
-- if not configs.flux then
-- configs.flux = {
-- default_config = {
-- cmd = { "/home/nige/.cargo/bin/flux-lsp" },
-- filetypes = { 'flux' },
-- root_dir = function(fname)
-- local root = getPath(fname)
-- if root then
-- return root
-- end
-- end,
-- single_file_support = true,
-- settings = {},
-- },
-- docs = {
-- description = "Language server for Influxdb flux query language"
-- }
-- }
-- end
--
-- lspconfig.flux.setup {
-- }
require 'lspconfig'.flux_lsp.setup {
cmd = { "/home/nige/.cargo/bin/flux-lsp", "-l", "/tmp/fluxlsp" },
}

@ -2,6 +2,7 @@ require("setup/plugins")
require("setup/set")
require("setup/remap")
require("setup/camel")
-- require("setup/flux")
require("setup/lsp")
require("setup/cmp")
require("setup/dap")

@ -50,21 +50,38 @@ mason_null_ls.setup({
automatic_setup = true, -- Recommended, but optional
})
mason_null_ls.setup_handlers()
-- mason_null_ls.setup_handlers()
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- require 'lspconfig'.flux_lsp.setup {
-- cmd = { "/home/nige/.cargo/bin/flux-lsp", "-l", "/tmp/fluxlsp" },
-- capabilities = capabilities,
-- }
-- Version 0.8.30
require 'lspconfig'.flux_lsp.setup {
cmd = { "/home/nige/dotfiles/.config/nvim/bin/flux-lsp", "-l", "/tmp/fluxlsp" },
capabilities = capabilities,
}
require("mason-lspconfig").setup_handlers({
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({ capabilities = capabilities })
end,
["lua_ls"] = function()
["lua_ls"] = function()
require("lspconfig").lua_ls.setup({
settings = { Lua = { diagnostics = { globals = { "vim" } } } },
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,
}
end
})
vim.diagnostic.config({
@ -72,6 +89,3 @@ vim.diagnostic.config({
float = { show_header = true, souce = "always", border = "rounded" },
severity_sort = true, -- default to false
})
lspconfig.flux_lsp.setup{}

@ -1,404 +1,438 @@
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,
})
vim.fn.system({
"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" },
{ "jghauser/follow-md-links.nvim" },
{
"toppair/peek.nvim",
build = "deno task --quiet build:fast",
config = function()
require("peek").setup({
app={"cmd.exe", "/c", "start" ,"msedge"},})
local peek = require("peek")
{
"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("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,
},
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,
},
{
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
dependencies = "nvim-lua/plenary.nvim",
},
{
'gianarb/vim-flux'
},
{
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
-- optional configuration
})
end,
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
},
{
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
dependencies = "nvim-lua/plenary.nvim",
},
{
"rose-pine/neovim",
name = "rose-pine",
lazy = false,
priority = 1000,
config = function()
require("rose-pine").setup()
vim.cmd("colorscheme rose-pine")
end,
},
{
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
-- optional configuration
})
end,
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
},
{ "TimUntersberger/neogit", dependencies = "nvim-lua/plenary.nvim" },
{
"rose-pine/neovim",
name = "rose-pine",
lazy = false,
priority = 1000,
config = function()
require("rose-pine").setup()
vim.cmd("colorscheme rose-pine")
end,
},
-- { "tpope/vim-fugitive" },
{
"TimUntersberger/neogit",
dependencies = "nvim-lua/plenary.nvim"
},
{
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = { theme = "auto" },
tabline = {
lualine_a = {},
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.
},
},
-- lualine_c = { sections = { 'lsp_progress' } },
lualine_x = {
"encoding",
{
"fileformat",
symbols = {
unix = "unix", -- e712
dos = "dos", -- e70f
mac = "mac", -- e711
},
},
"filetype",
"lsp_progress",
-- "tabnine",
},
},
})
end,
},
-- { "tpope/vim-fugitive" },
{
"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")!
{
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = { theme = "auto" },
tabline = {
lualine_a = {},
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.
},
},
-- lualine_c = { sections = { 'lsp_progress' } },
lualine_x = {
"encoding",
{
"fileformat",
symbols = {
unix = "unix", -- e712
dos = "dos", -- e70f
mac = "mac", -- e711
},
},
"filetype",
"lsp_progress",
-- "tabnine",
},
},
})
end,
},
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" },
{
"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")!
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
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-lspconfig.nvim",
dependencies = { "neovim/nvim-lspconfig" },
},
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"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" },
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = { "neovim/nvim-lspconfig" },
},
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
{
"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" },
},
-- Autocompletion
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-cmdline" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip" },
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
-- -- Debugging
{ "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("nvim-treesitter.configs").setup({
context_commentstring = { enable = true, enable_autocmd = false },
})
end,
},
-- Autocompletion
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-cmdline" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip" },
{
"numToStr/Comment.nvim",
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
-- -- Debugging
{
"jay-babu/mason-nvim-dap.nvim",
config = function()
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" },
},
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,
},
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
},
{
"numToStr/Comment.nvim",
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
-- {
-- "tzachar/cmp-tabnine",
-- build = "./install.sh",
-- dependencies = "hrsh7th/nvim-cmp",
-- config = function()
-- require("cmp_tabnine").setup({
-- max_lines = 1000,
-- max_num_results = 20,
-- sort = true,
-- run_on_every_keystroke = true,
-- snippet_placeholder = "..",
-- ignored_file_types = {
-- -- default is not to ignore
-- -- uncomment to ignore in lua:
-- -- lua = true
-- norg = true,
-- },
-- show_prediction_strength = true,
-- })
-- end,
-- },
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
},
{ "weilbith/nvim-code-action-menu", cmd = "CodeActionMenu" },
{
"kosayoda/nvim-lightbulb",
dependencies = "antoinemadec/FixCursorHold.nvim",
},
-- {
-- "tzachar/cmp-tabnine",
-- build = "./install.sh",
-- dependencies = "hrsh7th/nvim-cmp",
-- config = function()
-- require("cmp_tabnine").setup({
-- max_lines = 1000,
-- max_num_results = 20,
-- sort = true,
-- run_on_every_keystroke = true,
-- snippet_placeholder = "..",
-- ignored_file_types = {
-- -- default is not to ignore
-- -- uncomment to ignore in lua:
-- -- lua = true
-- norg = true,
-- },
-- show_prediction_strength = true,
-- })
-- end,
-- },
{
"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,
},
{
"weilbith/nvim-code-action-menu",
cmd = "CodeActionMenu"
},
{
"kosayoda/nvim-lightbulb",
dependencies = "antoinemadec/FixCursorHold.nvim",
},
{ "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
},
{
"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 = {
ui = {
-- a number <1 is a percentage., >1 is a fixed size
size = { width = 0.8, height = 0.8 },
wrap = true, -- wrap the lines in the ui
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
border = "none",
icons = {
cmd = "cmd",
config = "config",
event = "event",
ft = "ft",
init = "init",
import = "import",
keys = "",
lazy = "lazy",
loaded = "",
not_loaded = "",
plugin = "+",
runtime = "runtime",
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
},
ui = {
-- a number <1 is a percentage., >1 is a fixed size
size = { width = 0.8, height = 0.8 },
wrap = true, -- wrap the lines in the ui
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
border = "none",
icons = {
cmd = "cmd",
config = "config",
event = "event",
ft = "ft",
init = "init",
import = "import",
keys = "",
lazy = "lazy",
loaded = "",
not_loaded = "",
plugin = "+",
runtime = "runtime",
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
},
}
require("lazy").setup(plugins, opts)

@ -21,7 +21,7 @@ vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]], { desc = "Delete without savi
vim.keymap.set("n", "Q", "<nop>", { desc = "" })
-- vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>", { desc = "" })
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, { desc = "Format current buffer" })
vim.keymap.set("n", "<leader>F", vim.lsp.buf.format, { desc = "Format current buffer" })
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz", { desc = "Center on next quickfix item" })
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz", { desc = "Center on previous quickfix item" })
@ -33,3 +33,13 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc =
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", { desc = "Exit terminal input mode" })
vim.keymap.set("t", "<M-[>", "<Esc>", { desc = "Exit mode" })
vim.keymap.set("t", "<C-v><Esc>", "<Esc>", { desc = "Exit mode" })
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc ="Telescope - find files" })
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" })
local terminal = require('toggleterm.terminal').Terminal
vim.keymap.set('n', '<leader>t', "<cmd>ToggleTerm<CR>", { desc ="Toggle Terminal" })

@ -1,25 +1,62 @@
#!/bin/bash
###############################################################################
# Author: Nils Gersnter #
# Date: 2023-04-14 #
# #
# DESCRIPTION #
# #
# This script creates an interface to select a project folder. #
# It sorts the folders in the order, last selected. #
# #
# SETUP #
# #
# Put the script in your ${HOME}/bin folder and add the following alias to #
# your .bashrc (with the allias of your choice) #
# alias fp='cd "$(findProject.sh)"' #
# #
# DEPENDENCIES #
# #
# This script depends on fzf and sponge being installed on the system. #
# On debian like systems, sponge can be obtained by installing the moreutils #
# package. #
# fzf can be installed in the ways described here: #
# https://github.com/junegunn/fzf#installation #
###############################################################################
_find_root() {
fzf << EOF
${HOME}/Documents/Code/BOLIDEN
${HOME}/Documents/Code/VOLVOCARS
# The number of selections that is to be kept
LINES_TO_SAVE=200
SELECTED_FOLDERS_LOG=${HOME}/.local/share/findProject_selection.log
# Root folder per customer that contains project folders
CUSTOMER_ROOT_FOLDERS="${HOME}/Documents/Code/BOLIDEN
${HOME}/Documents/Code/GERSTNER
${HOME}/Documents/Code/REPLYTO
${HOME}/Documents/Code/RISE
EOF
${HOME}/Documents/Code/VOLVOCARS"
_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\+"
fi
echo -e "${CUSTOMER_ROOT_FOLDERS}"
}
_find_subfolder() {
local root_dir="${1}"
while read i; do
basename "$i";
done <<< "$(find "${root_dir}" -mindepth 1 -maxdepth 1 -type d -printf "%Ts\t%f\n" | sort -rn| cut -f 2)" | fzf
# find . -type f -printf "%Ts\t%f\n" | sort -n| cut -f 2
# fzf <<< "$(find "${root_dir}" -type d -mindepth 1 -maxdepth 1 -exec basename {} + 2> /dev/null)"
_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\+$"
fi
find "$root_dir" -mindepth 1 -maxdepth 1 -type d -printf "%Ts\t%f\n" | sort -rn| cut -f 2
}
_select_uniq() {
local root="$1"
cat < /dev/stdin | awk '!x[$0]++' - | fzf --preview "tree -L 1 ${root}{}"
}
root_dir="$(_find_root)"
base_name="$(_find_subfolder "${root_dir}")"
root_dir="$(_get_root | _select_uniq)"
base_name="$(_get_subfolder | _select_uniq "${root_dir}/")"
echo -e "${root_dir}/${base_name}"
echo "${root_dir}/${base_name}"
echo "${root_dir} ${base_name}" >> "$SELECTED_FOLDERS_LOG"
tail -n $LINES_TO_SAVE "$SELECTED_FOLDERS_LOG"| sponge "$SELECTED_FOLDERS_LOG"

Loading…
Cancel
Save