Initial commit

main
Nils Gerstner 1 year ago
commit 004cf44189

@ -0,0 +1,175 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
export EDITOR=vim
# export LC_ALL=en_US.UTF-8
# export LANG=en_US.UTF-8
##===== HISTORY =====##
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) and add timestamp (HISTTIMEFORMAT)
HISTSIZE=10000
HISTFILESIZE=20000
HISTTIMEFORMAT="%d/%m/%y %T "
##===== Looks =====##
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
color_prompt=yes
# Change this to the apropriate environment (dev|test|prod)
ENVIRONMENT=TEST
# I normaly have a green prompt on my local, yellow on Test and QA and red on Production systems
#if [ "$color_prompt" = yes ]; then
case "${ENVIRONMENT}" in
"DEV")
# Green prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
"TEST")
# Yellow prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
"PROD")
# Red prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
;;
esac
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Add color to MAN pages,
## from https://www.tecmint.com/view-colored-man-pages-in-linux/
## by Aaron Kili, Published: December 12, 2017
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
##===== Completion =====##
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
if [ -f ${HOME}/.lib/q_completion.sh ]; then
source ${HOME}/.lib/q_completion.sh
fi
fi
###===== HOMEBREW =====##
test -d /opt/homebrew && export PATH=/opt/homebrew/bin:~/bin:$PATH
###===== MQ and IIB =====##
#
## Add mq bin folder to PATH
test -d /opt/mqm/bin && export PATH=$PATH:/opt/mqm/bin
#
## Load MQSI profile
if [ -f /opt/IBM/iib-10.0.0.10/server/bin/mqsiprofile ]; then
[ -z "${PROSPECTIVE_MQSI_BASE_FILEPATH+MQSI_PROFILE_NOT_SET}" ] && source /opt/IBM/iib-10.0.0.10/server/bin/mqsiprofile
fi
##===== Alias definitions =====##
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
#fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ws='cd ~/Documents/Code'
alias vcc='cd ~/Documents/Code/VOLVOCARS/'
alias doc='cd ~/Documents'
alias dw='cd ~/Downloads'
alias wn='cd ~/.config/nvim/'
alias cv='cd ~/.config/nvim/ ; vim init.norg lua/plugins.lua'
alias :q='exit'
alias vim='nvim'
alias nn='cd ~/notes/; nvim $(ls -tr $(ls -tr |grep -v "inbox.norg" | grep -e "[.]norg$" |tail -n1) $(ls -tr | grep -e "[.]md$" |tail -n1)); updateNotes.sh; cd -'
#
##===== Custom functions =====##
sleepUntil() { # args [-q] <HH[:MM[:SS]]> [more days]
if [ "$1" = "" ]; then
echo "args [-q] <HH[:MM[:SS]]> [more days]"
return 1
fi
local slp tzoff now quiet=false
[ "$1" = "-q" ] && shift && quiet=true
local -a hms=(${1//:/ })
printf -v now '%(%s)T' -1
printf -v tzoff '%(%z)T\n' $now
tzoff=$((0${tzoff:0:1}(3600*${tzoff:1:2}+60*${tzoff:3:2})))
slp=$((
( 86400+(now-now%86400) + 10#$hms*3600 + 10#${hms[1]}*60 +
${hms[2]}-tzoff-now ) %86400 + ${2:-0}*86400
))
$quiet || printf 'sleep %ss, -> %(%c)T\n' $slp $((now+slp))
sleep $slp
}
# Add JBang to environment
#alias j!=jbang
export JAVA_HOME=$(/usr/libexec/java_home -v 19.0.2 -V 2>&1 |grep -oe "\S\+zulu\S\+$")
test -d /opt/homebrew/opt/openjdk/bin && export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
test -d /opt/homebrew/opt/curl/bin && export PATH="/opt/homebrew/opt/curl/bin:$PATH"
export PATH="/Users/nige/.cargo/bin:$PATH"
export GOPATH=$HOME/go
which brew && export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"

@ -0,0 +1,11 @@
# Custom configuration
# This file needs to be referenced from the global .gitconfig file and copied as
# .gitconfig into the root folder containing all repositories that it should be
# used on.
# EXAMPLE reference in global .gitconfig:
# [includeIf "gitdir:~/siv-dev/client-work/"]
# path = ~/siv-dev/client-work/.gitconfig
[user]
name = Nils Gerstner
email = nils@gerstner.se

@ -0,0 +1,11 @@
# Custom configuration
# This file needs to be referenced from the global .gitconfig file and copied as
# .gitconfig into the root folder containing all repositories that it should be
# used on.
# EXAMPLE reference in global .gitconfig:
# [includeIf "gitdir:~/siv-dev/client-work/"]
# path = ~/siv-dev/client-work/.gitconfig
[user]
name = Nils Gerstner
email = nils.gerstner@replyto.se

@ -0,0 +1,11 @@
# Custom configuration
# This file needs to be referenced from the global .gitconfig file and copied as
# .gitconfig into the root folder containing all repositories that it should be
# used on.
# EXAMPLE reference in global .gitconfig:
# [includeIf "gitdir:~/siv-dev/client-work/"]
# path = ~/siv-dev/client-work/.gitconfig
[user]
name = Nils Gerstner
email = nils.gerstner@volvocars.com

@ -0,0 +1 @@
{"contents":[{"text":"nvim"}],"icon":"๏€ญ ","uid":"20230115195355","type":1}

@ -0,0 +1,118 @@
-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
local config = {
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
autostart = true,
-- autostart = false,
cmd = {
--[[
usage: jdtls [-h] [--validate-java-version | --no-validate-java-version] [--jvm-arg JVM_ARG] [-data DATA]
options:
-h, --help show this help message and exit
--validate-java-version, --no-validate-java-version
--jvm-arg JVM_ARG An additional JVM option (can be used multiple times. Note, use with equal sign. For example: --jvm-arg=-Dlog.level=ALL
-data DATA
]]
'jdtls',
'-configuration',
'/Users/nige/.cache/jdtls/config',
-- '-data', '/Users/nige/.cache/jdtls/workspace'
-- 'jdtls',
-- '--jvm-arg=-Declipse.application=org.eclipse.jdt.ls.core.id1',
-- '--jvm-arg=-Dosgi.bundles.defaultStartLevel=4',
-- '--jvm-arg=-Declipse.product=org.eclipse.jdt.ls.core.product',
-- '--jvm-arg=-Dlog.protocol=true',
-- '--jvm-arg=-Dlog.level=ALL',
-- '--jvm-arg=-Xms1g',
-- '--jvm-arg=--add-modules=ALL-SYSTEM',
-- '--jvm-arg=--add-opens java.base/java.util=ALL-UNNAMED',
-- '--jvm-arg=--add-opens java.base/java.lang=ALL-UNNAMED', -- ๐Ÿ’€
'-data', '/Users/nige/.config/jdtls_workspaces/' ..
vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
-- -- ๐Ÿ’€
-- 'java', -- or '/path/to/java17_or_newer/bin/java'
-- -- depends on if `java` is in your $PATH env variable and if it points to the right version.
-- '-Declipse.application=org.eclipse.jdt.ls.core.id1',
-- '-Dosgi.bundles.defaultStartLevel=4',
-- '-Declipse.product=org.eclipse.jdt.ls.core.product',
-- '-Dlog.protocol=true', '-Dlog.level=ALL', '-Xms1g',
-- '--add-modules=ALL-SYSTEM', '--add-opens',
-- 'java.base/java.util=ALL-UNNAMED', '--add-opens',
-- 'java.base/java.lang=ALL-UNNAMED', -- ๐Ÿ’€
-- '-jar',
-- '/Users/nige/.local/share/lsp/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar',
-- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
-- -- Must point to the Change this to
-- -- eclipse.jdt.ls installation the actual version
--
-- -- ๐Ÿ’€
-- '-configuration', '/Users/nige/.local/share/lsp/jdtls/config_mac',
-- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
-- -- Must point to the Change to one of `linux`, `win` or `mac`
-- -- eclipse.jdt.ls installation Depending on your system.
--
-- -- ๐Ÿ’€
-- '-data', '/Users/nige/.config/jdtls_workspaces/' ..
-- vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
},
-- ๐Ÿ’€
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = require('jdtls.setup').find_root({ '.git', 'mvnw', 'gradlew' }),
-- ๐Ÿ’€
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
eclipse = { downloadSources = true },
implementationsCodeLens = { enabled = true },
import = { enabled = true },
maven = { downloadSources = true },
references = { includeDecompiledSources = true },
referencesCodeLens = { enabled = true },
rename = { enabled = true },
signatureHelp = { enabled = true }
}
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
extendedClientCapabilities = { classFileContentsSupport = true },
-- bundles = {
-- vim.fn.glob(
-- "/Users/nige/.local/share/nvim/dap-servers/com.microsoft.java.debug.plugin_0.43.0.jar",
-- 1)
-- }
},
on_attach = function(client, bufnr)
-- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes
-- you make during a debug session immediately.
-- Remove the option if you do not want that.
-- You can use the `JdtHotcodeReplace` command to trigger it manually
-- require('jdtls').setup_dap({ hotcodereplace = 'auto' })
local jdtls = require('jdtls')
jdtls.setup_dap({ hotcodereplace = 'auto' })
jdtls.setup.add_commands()
end
}
-- This starts a new client & server,
-- or attaches to an existing client & server depending on the `root_dir`.
require('jdtls').start_or_attach(config)

@ -0,0 +1,2 @@
require("setup")
require("note-workflow")

@ -0,0 +1,48 @@
{
"ChatGPT.nvim": { "branch": "main", "commit": "8797871b5d11d256834b1c474ca9016dd0137dcb" },
"Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "025886915e7a1442019f467e0ae2847a7cf6bf1a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8fcc934a52af96120fe26358985c10c035984b53" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-tabnine": { "branch": "main", "commit": "4c8a0db92e75c848fb066edd280072389db80d24" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"follow-md-links.nvim": { "branch": "main", "commit": "ccc50e7ba191e62b4243ddd3db9b7dbddf2ee179" },
"friendly-snippets": { "branch": "main", "commit": "25ddcd96540a2ce41d714bd7fea2e7f75fea8ead" },
"harpoon": { "branch": "master", "commit": "f7040fd0c44e7a4010369136547de5604b9c22a1" },
"lazy.nvim": { "branch": "main", "commit": "a80422f21750fcbf0e90b26da877d4024d76f116" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2b811031febe5f743e07305738181ff367e1e452" },
"mason-null-ls.nvim": { "branch": "main", "commit": "4070ec7c543b67df16143ee206e436d24bb9c01b" },
"mason.nvim": { "branch": "main", "commit": "9f4e06029b1d8cd3bb4438f6b3de6d5c42d2d8d1" },
"neogit": { "branch": "master", "commit": "039ff3212ec43cc4d3332956dfb54e263c8d5033" },
"neorg": { "branch": "main", "commit": "532548b9f444bd1ae6f2efd3edd842282cc79659" },
"neorg-telescope": { "branch": "main", "commit": "197c59a572e4423642b5c5fb727ecefadffe9000" },
"neotest": { "branch": "master", "commit": "bbbfa55d850f1aaa6707ea85fb5230ac866459c6" },
"neotest-vim-test": { "branch": "master", "commit": "07f25ab7ba4e7646b38c84e10002b195a53b0096" },
"nui.nvim": { "branch": "main", "commit": "0dc148c6ec06577fcf06cbab3b7dac96d48ba6be" },
"null-ls.nvim": { "branch": "main", "commit": "0180603b6f3cee40f83c6fc226b9ac5f85e691c4" },
"nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" },
"nvim-code-action-menu": { "branch": "main", "commit": "e4399dbaf6eabff998d3d5f1cbcd8d9933710027" },
"nvim-dap": { "branch": "master", "commit": "7e81998e31277c7a33b6c34423640900c5c2c776" },
"nvim-dap-ui": { "branch": "master", "commit": "bdb94e3853d11b5ce98ec182e5a3719d5c0ef6fd" },
"nvim-jdtls": { "branch": "master", "commit": "f8fb45e05e638e5c67e884f3039abcda7abc2d2d" },
"nvim-lightbulb": { "branch": "master", "commit": "56b9ce31ec9d09d560fe8787c0920f76bc208297" },
"nvim-lspconfig": { "branch": "master", "commit": "c6105c449683b944b5d2138fcf82f18c657249e9" },
"nvim-treesitter": { "branch": "master", "commit": "1f087c91f5ca76a2257b855d72d371a2b5302986" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "729d83ecb990dc2b30272833c213cc6d49ed5214" },
"peek.nvim": { "branch": "master", "commit": "571f14c795e8edd5a21e435f42f37c9bec4a8e16" },
"playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"rose-pine": { "branch": "main", "commit": "17723f76ea78cdd71fd0007b7b760683b60a5e43" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"telescope.nvim": { "branch": "master", "commit": "b79cd6c88b3d96b0f49cb7d240807cd59b610cd8" },
"tree-sitter-norg": { "branch": "main", "commit": "1a305093569632de50f9a316ff843dcda25b4ef5" },
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
"vim-markdown": { "branch": "master", "commit": "5d3d1b6cbdc4be0b4c6105c1ab1f769d76d3c68f" },
"vim-tickscript": { "branch": "master", "commit": "399e332b709f034421c83af9ea14380d71e0d743" },
"which-key.nvim": { "branch": "main", "commit": "87b1459b3e0be0340da2183fc4ec8a00b2960678" }
}

@ -0,0 +1,7 @@
{
"diagnostics.disable": [
"undefined-global",
"unused-local",
"unused-function"
]
}

@ -0,0 +1,194 @@
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
* They are not recursive. Such a structure cannot be specified in json.
A Lua table is considered to be an array if and only if its set of keys is a
consecutive sequence of positive integers starting at 1. Arrays are encoded like
so: `[2, 3, false, "hi"]`. Any other type of Lua table is encoded as a json
object, encoded like so: `{"key1": 2, "key2": false}`.
Because the Lua nil value cannot be a key, and as a table value is considerd
equivalent to a missing key, there is no way to express the json "null" value in
a Lua table. The only way this will output "null" is if your entire input obj is
nil itself.
An empty Lua table, {}, could be considered either a json object or array -
it's an ambiguous edge case. We choose to treat this as an object as it is the
more general type.
To be clear, none of the above considerations is a limitation of this code.
Rather, it is what we get when we completely observe the json specification for
as arbitrary a Lua object as json is capable of expressing.
## json.parse:
This function parses json, with the exception that it does not pay attention to
\u-escaped unicode code points in strings.
It is difficult for Lua to return null as a value. In order to prevent the loss
of keys with a null value in a json string, this function uses the one-off
table value json.null (which is just an empty table) to indicate null values.
This way you can check if a value is null with the conditional
`val == json.null`.
If you have control over the data and are using Lua, I would recommend just
avoiding null values in your data to begin with.
--]]
local json = {}
-- Internal functions.
local function kind_of(obj)
if type(obj) ~= 'table' then return type(obj) end
local i = 1
for _ in pairs(obj) do
if obj[i] ~= nil then i = i + 1 else return 'table' end
end
if i == 1 then return 'table' else return 'array' end
end
local function escape_str(s)
local in_char = {'\\', '"', '/', '\b', '\f', '\n', '\r', '\t'}
local out_char = {'\\', '"', '/', 'b', 'f', 'n', 'r', 't'}
for i, c in ipairs(in_char) do
s = s:gsub(c, '\\' .. out_char[i])
end
return s
end
-- Returns pos, did_find; there are two cases:
-- 1. Delimiter found: pos = pos after leading space + delim; did_find = true.
-- 2. Delimiter not found: pos = pos after leading space; did_find = false.
-- This throws an error if err_if_missing is true and the delim is not found.
local function skip_delim(str, pos, delim, err_if_missing)
pos = pos + #str:match('^%s*', pos)
if str:sub(pos, pos) ~= delim then
if err_if_missing then
error('Expected ' .. delim .. ' near position ' .. pos)
end
return pos, false
end
return pos + 1, true
end
-- Expects the given pos to be the first character after the opening quote.
-- Returns val, pos; the returned pos is after the closing quote character.
local function parse_str_val(str, pos, val)
val = val or ''
local early_end_error = 'End of input found while parsing string.'
if pos > #str then error(early_end_error) end
local c = str:sub(pos, pos)
if c == '"' then return val, pos + 1 end
if c ~= '\\' then return parse_str_val(str, pos + 1, val .. c) end
-- We must have a \ character.
local esc_map = {b = '\b', f = '\f', n = '\n', r = '\r', t = '\t'}
local nextc = str:sub(pos + 1, pos + 1)
if not nextc then error(early_end_error) end
return parse_str_val(str, pos + 2, val .. (esc_map[nextc] or nextc))
end
-- Returns val, pos; the returned pos is after the number's final character.
local function parse_num_val(str, pos)
local num_str = str:match('^-?%d+%.?%d*[eE]?[+-]?%d*', pos)
local val = tonumber(num_str)
if not val then error('Error parsing number at position ' .. pos .. '.') end
return val, pos + #num_str
end
-- Public values and functions.
function json.stringify(obj, as_key)
local s = {} -- We'll build the string as an array of strings to be concatenated.
local kind = kind_of(obj) -- This is 'array' if it's an array or type(obj) otherwise.
if kind == 'array' then
if as_key then error('Can\'t encode array as key.') end
s[#s + 1] = '['
for i, val in ipairs(obj) do
if i > 1 then s[#s + 1] = ', ' end
s[#s + 1] = json.stringify(val)
end
s[#s + 1] = ']'
elseif kind == 'table' then
if as_key then error('Can\'t encode table as key.') end
s[#s + 1] = '{'
for k, v in pairs(obj) do
if #s > 1 then s[#s + 1] = ', ' end
s[#s + 1] = json.stringify(k, true)
s[#s + 1] = ':'
s[#s + 1] = json.stringify(v)
end
s[#s + 1] = '}'
elseif kind == 'string' then
return '"' .. escape_str(obj) .. '"'
elseif kind == 'number' then
if as_key then return '"' .. tostring(obj) .. '"' end
return tostring(obj)
elseif kind == 'boolean' then
return tostring(obj)
elseif kind == 'nil' then
return 'null'
else
error('Unjsonifiable type: ' .. kind .. '.')
end
return table.concat(s)
end
json.null = {} -- This is a one-off table to represent the null value.
function json.parse(str, pos, end_delim)
pos = pos or 1
if pos > #str then error('Reached unexpected end of input.') end
local pos = pos + #str:match('^%s*', pos) -- Skip whitespace.
local first = str:sub(pos, pos)
if first == '{' then -- Parse an object.
local obj, key, delim_found = {}, true, true
pos = pos + 1
while true do
key, pos = json.parse(str, pos, '}')
if key == nil then return obj, pos end
if not delim_found then error('Comma missing between object items.') end
pos = skip_delim(str, pos, ':', true) -- true -> error if missing.
obj[key], pos = json.parse(str, pos)
pos, delim_found = skip_delim(str, pos, ',')
end
elseif first == '[' then -- Parse an array.
local arr, val, delim_found = {}, true, true
pos = pos + 1
while true do
val, pos = json.parse(str, pos, ']')
if val == nil then return arr, pos end
if not delim_found then error('Comma missing between array items.') end
arr[#arr + 1] = val
pos, delim_found = skip_delim(str, pos, ',')
end
elseif first == '"' then -- Parse a string.
return parse_str_val(str, pos + 1)
elseif first == '-' or first:match('%d') then -- Parse a number.
return parse_num_val(str, pos)
elseif first == end_delim then -- End of an object or array.
return nil, pos + 1
else -- Parse true, false, or null.
local literals = {['true'] = true, ['false'] = false, ['null'] = json.null}
for lit_str, lit_val in pairs(literals) do
local lit_end = pos + #lit_str - 1
if str:sub(pos, lit_end) == lit_str then return lit_val, lit_end + 1 end
end
local pos_info_str = 'position ' .. pos .. ': ' .. str:sub(pos, pos + 10)
error('Invalid json syntax starting at ' .. pos_info_str)
end
end
return json

@ -0,0 +1,9 @@
local notesAutoCmd = vim.api.nvim_create_augroup("Notes-Workflow", { clear = true })
local delete = require('note-workflow.delete')
vim.api.nvim_create_autocmd(
{ "VimEnter" }, {
group = notesAutoCmd,
callback = delete.prune_search_db,
desc = "Prune Meilisearch from deleted documents",
}
)

@ -0,0 +1,39 @@
M = {}
local config = require('note-workflow.notes').config_values
local prefix = config.prefix
local server = config.server
local function file_exists(name)
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
function M.prune_search_db()
local curl = require "plenary.curl"
local json = require('json')
local hits = {}
local res = curl.get(server .. '/indexes/notes/documents?limit=99999999&fields=title,id', {
accept = "application/json",
})
if res then
local tab = json.parse(res.body)
if tab and tab['total'] > 0 then
for i, v in ipairs(tab['results']) do
if not file_exists(prefix .. v['title']) then
print('Delete ' .. v['title'] .. ' from search index')
curl.delete('http://localhost:7700/indexes/notes/documents/' .. v['id'], {})
end
end
end
end
end
return M

@ -0,0 +1,2 @@
require("note-workflow.autocmd")
require("note-workflow.keymap")

@ -0,0 +1,7 @@
local note_workflow = require('note-workflow.notes')
vim.keymap.set("n", "<leader>ms", note_workflow.search, { desc = "Search Notes via Meilisearch" })
vim.keymap.set("n", "<leader>ma", note_workflow.updateAll, { desc = "Update notes" })
vim.keymap.set("n", "<leader>nz", note_workflow.newNeorgNote, { desc = "Create a new Neorg note" })
vim.keymap.set("n", "<leader>nm", note_workflow.newMarkdownNote, { desc = "Create a new Markdown note" })
vim.keymap.set("n", "<leader>nw", note_workflow.createWorknote, { desc = "Create an inline worknote" })

@ -0,0 +1,342 @@
local q = require "vim.treesitter.query"
local ts_utils = require("nvim-treesitter.ts_utils")
local tprint = require("setup.utils").tprint
local M = {}
M.config_values = {
server = 'http://localhost:7700',
dateformat = '%Y%m%d%H%M-',
prefix = os.getenv("HOME") .. "/notes/",
replace_pattern = {
[1] = { ['@'] = '_AT_' },
[2] = { ['[.]'] = '_DOT_' },
[3] = { ['[%$]'] = '_DOLLAR_' },
[4] = { ['%~'] = '_TILDE_' },
[5] = { ['[%|]'] = '_PIPE_' },
[6] = { ['[^a-zA-Z0-9-]'] = '_' },
[7] = { ['__+'] = '_' },
[8] = { ['^_'] = '' },
[9] = { ['_$'] = '' },
},
}
local function hexdecode(hex)
return (hex:gsub("%x%x", function(digits) return string.char(tonumber(digits, 16)) end))
end
local function hexencode(str)
return (string.upper(str:gsub(".", function(char) return string.format("%2x", char:byte()) end)))
end
local function dirLookup(dir)
local files = {}
local p = io.popen('find "' .. dir .. '" -type f') --Open directory look for files, save data in p. By giving '-type f' as parameter, it returns all files.
if p then
for file in p:lines() do --Loop through all files
if file:match('.*norg$') then
table.insert(files, file)
end
end
end
return files
end
local function isempty(s)
return s == nil or s == ''
end
local createfilename = function(suffix)
local name = vim.fn.input("Please enter a title: ")
if string.len(name) == 0 then
print(" ")
print("Title missing: request ignored!")
return
end
local date = os.date(M.config_values.dateformat)
for index, pv in ipairs(M.config_values.replace_pattern) do
for key, value in pairs(pv) do
if name.find(name, key) then
name = string.gsub(name, key, value)
end
end
end
return M.config_values.prefix .. date .. name .. suffix, date, name
end
function M.newNeorgNote()
local name, date, title = createfilename(".norg")
local template = {
"* " .. string.gsub(title or "", "_", " "),
" ",
}
vim.cmd(":e" .. name)
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, template)
vim.cmd(":Neorg inject-metadata")
vim.cmd('startinsert!')
end
function M.newMarkdownNote()
local name, date, title = createfilename(".md")
local template = {
"---",
"title: " .. date .. title,
"description: ",
"authors:",
" - nige",
"categories:",
"project: ",
"created: " .. os.date('%Y-%m-%d'),
"version: na",
"---",
"",
"# " .. string.gsub(title or "", "_", " "),
"",
"",
}
vim.cmd(":e" .. name)
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, template)
vim.cmd('startinsert!')
end
function M.createWorknote()
local date = os.date('%Y-%m-%d %H:%M')
vim.cmd(':normal o')
local pos = vim.api.nvim_win_get_cursor(0)[2]
local line = vim.api.nvim_get_current_line()
local nline = line:sub(0, pos) .. '- Note tagen on /' .. date .. "/: " .. line:sub(pos + 1)
vim.api.nvim_set_current_line(nline)
vim.cmd(':normal $')
vim.api.nvim_set_mode = 'i'
vim.cmd('startinsert!')
end
--------------------------------------------------------------------------------
local index = "notes"
local fillqflist = function(items, query)
local title = "Meilisearch - index: '" .. index .. "'"
if type(query) ~= "nil" then
title = title .. ", query: '" .. query .. "'"
end
vim.fn.setqflist(
{},
' ', -- 'a' to add item(s) to an existing list
{
title = title,
id = 999,
items = items
}
)
end
function M.search()
local query = vim.fn.input("Meilisearch: ")
local curl = require "plenary.curl"
local json = require('json')
local prefix = M.config_values.prefix
local hits = {}
-- print("----" .. query)
local res = curl.get(M.config_values.server .. "/indexes/notes/search", {
accept = "application/json",
query = {
q = query,
showMatchesPosition = "true"
}
})
if res then
local tab = json.parse(res.body)
if tab and type(tab['hits']) ~= "nil" then
for i, v in ipairs(tab['hits']) do
local hit = {
text = "",
pattern = query,
filename = prefix .. v['title'],
-- filename = prefix .. hexdecode(v['id']),
}
--print("id: '" .. hexdecode(v['id']) .. "'")
table.insert(hits, hit)
end
else
print("No data in table")
end
fillqflist(hits, query)
vim.cmd("copen")
end
end
-------------------------------------------------------------------------------
local function i(value)
print(vim.inspect(value))
end
local removeLines = function(str, lines)
local multistring = str
for ii = 1, lines, 1 do
multistring = multistring:gsub("^[^\n]*\n", "")
end
return multistring
end
local keywords = {
["title"] = false,
["description"] = false,
["authors"] = true,
["categories"] = true,
["project"] = false,
["created"] = false,
["version"] = false
}
local contains = function(array, val)
for k, v in pairs(array) do
if k == val then
return true, v
end
end
return false, false
end
local function splitValue(s, delimiter)
local result = {};
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
table.insert(result, match);
end
return result;
end
local function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
local function trimTable(t)
local newTable = {}
for key, value in pairs(t) do
if type(value) == "string" then
newTable[key] = trim(value)
end
end
return newTable
end
local split = function(lines)
local metadata = {}
for line in lines:gmatch("[^\n]*\n?") do
local key = string.match(line, "^[^:]+:")
if type(key) ~= "nil" then
key = string.sub(key, 1, key:len() - 1)
local isContained, isArray = contains(keywords, key:lower())
if isContained then
local value = string.match(line, ":.*$")
if type(value) == "string" then
value = string.match(value, "[^: ]+.*$")
value = string.gsub(value, "\n", "")
if isArray then
value = splitValue(value, ",")
value = trimTable(value)
end
else
value = ""
if isArray then
value = { "" }
end
end
metadata[key] = value
end
end
end
return metadata
end
function M.upsertNote(bufnr)
if isempty(bufnr) then
bufnr = vim.api.nvim_get_current_buf()
end
-- local language_tree = vim.treesitter.get_parser(bufnr, 'norg')
local language_tree = vim.treesitter.get_parser(bufnr)
local syntax_tree = language_tree:parse()
local root = syntax_tree[1]:root()
local query = vim.treesitter.parse_query('norg', [[
(ranged_tag
name: (tag_name) @name (#eq? @name "document.meta")
content: (ranged_tag_content) @content
(ranged_tag_end) @end (#offset! @end)
)
]])
local header_lines = 0
local note
for s, captures, metadata in query:iter_matches(root, bufnr) do
local headerText = q.get_node_text(captures[2], bufnr)
note = split(headerText)
local text = q.get_node_text(captures[2], bufnr)
print('######### s')
tprint(s)
print('######### captures')
tprint(captures)
print('######### metadata')
tprint(metadata)
print('#########')
header_lines = metadata['ranged_verbatim_tag'][1][1]
end
-- if header_lines then
-- note["headerlines"] = header_lines
-- end
note["id"] = hexencode(string.gsub(vim.api.nvim_buf_get_name(bufnr), M.config_values.prefix, ""))
note["body"] = removeLines(q.get_node_text(root, bufnr), header_lines)
--i(note)
local curl = require "plenary.curl"
local json = require('json')
local prefix = "/Users/nige/notes/"
local hits = {}
local header = {}
header = { header = "\"Content-Type\" = \"application/json\"" }
i(curl.post(M.config_values.server .. "/indexes/notes/documents",
{ raw = { "-H", "Content-Type: application/json" }, body = json.stringify(note) }
))
return tonumber(bufnr)
end
M.updateAll = function()
local files = dirLookup(M.config_values.prefix)
for key, value in pairs(files) do
if value:match(".*norg") then
vim.cmd("e " .. value)
local bufnr = M.upsertNote()
--vim.cmd("bw")
--print("number:" .. bufnr .. type(bufnr))
--[[ pcall(vim.api.nvim_buf_delete, bufnr {}) ]]
end
end
end
--M.yaml = function()
-- print ("START")
-- local yaml_string = [[
--title
-- list
-- - item 1
-- - item 2
-- - item 3
-- key: value
-- ]]
-- print ("load require")
-- local yaml = require("lyaml")
-- print ("load table")
-- local tbl = yaml.load(yaml_string)
-- print ("print values")
-- print(tbl.title.list)
-- print(tbl.title.key)
--end
return M

@ -0,0 +1,23 @@
local neorgAutoCmd = vim.api.nvim_create_augroup("NeorgConcealLevel", { clear = true })
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 &>/dev/null")
end
end,
desc = "Trigger meilisearch update via bash script",
})
local fluxAutoCmd = vim.api.nvim_create_augroup("FluxTask", {})
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",
})

@ -0,0 +1,62 @@
local lspconfig = require 'lspconfig'
local configs = require 'lspconfig.configs'
local util = require 'lspconfig.util'
local env = {
HOME = vim.loop.os_homedir(),
XDG_CACHE_HOME = os.getenv 'XDG_CACHE_HOME',
JDTLS_JVM_ARGS = os.getenv 'JDTLS_JVM_ARGS',
}
local function get_cache_dir()
return env.XDG_CACHE_HOME and env.XDG_CACHE_HOME or lspconfig.util.path.join(env.HOME, '.cache')
end
local function get_jdtls_cache_dir()
return lspconfig.util.path.join(get_cache_dir(), 'jdtls')
end
local function get_jdtls_workspace_dir()
return lspconfig.util.path.join(get_jdtls_cache_dir(), 'workspace')
end
local root_files = {
-- Single-module projects
{
'build.xml', -- Ant
'pom.xml', -- Maven
'settings.gradle', -- Gradle
'settings.gradle.kts', -- Gradle
},
-- Multi-module projects
{ 'build.gradle', 'build.gradle.kts' },
}
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" },
filetypes = { 'java' },
root_dir = function(fname)
for _, patterns in ipairs(root_files) do
local root = util.root_pattern(unpack(patterns))(fname)
if root then
return root
end
end
end,
single_file_support = true,
init_options = {
workspace = get_jdtls_workspace_dir(),
jvm_args = {},
os_config = nil,
},
settings = {},
},
docs = {
description = "Language server for ApacheCamel"
}
}
end
lspconfig.camel.setup {}

@ -0,0 +1,80 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
local select_opts = { behavior = cmp.SelectBehavior.Select }
local has_words_before = function()
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
local line, col = 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
cmp.setup {
enabled = true,
preselect = cmp.PreselectMode.None,
snippet = { expand = function(args) luasnip.lsp_expand(args.body) end },
sources = {
{ name = 'path' }, { name = 'nvim_lsp' },
-- { name = 'buffer', keyword_length = 3 },
{ name = 'buffer' }, { name = 'luasnip', keyword_length = 3 },
-- { name = 'cmdline' },
{ name = "cmp_tabnine" }, { name = "nvim_lua" },
{ name = 'buffer' },
{ 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)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { 'i', 's' }),
['<C-b>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' })
}),
window = { documentation = cmp.config.window.bordered() },
formatting = {
fields = { 'menu', 'abbr', 'kind' },
format = function(entry, item)
local menu_icon = {
nvim_lsp = '[lsp]',
luasnip = '[snip]',
buffer = '[buf]',
path = '[path]',
--cmdline = "[cmd]",
cmp_tabnine = "[tab]",
}
item.menu = menu_icon[entry.source.name]
return item
end
}
}
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = 'buffer' } }
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } })
})

@ -0,0 +1,68 @@
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.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.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
}
}
require("dapui").setup({
controls = {
-- Requires Neovim nightly (or 0.8 when released)
enabled = true,
-- Display controls in this element
element = "repl",
icons = {
pause = 'โธ',
play = 'โต',
step_into = 'โ†“',
step_over = '.โƒ•',
step_out = 'โ†‘',
step_back = 'โ†',
run_last = 'โ†ป',
terminate = 'โน'
}
}
})

@ -0,0 +1,25 @@
# DAP Normal commands
<!--toc:start-->
- [DAP Normal commands](#dap-normal-commands)
<!--toc:end-->
Toggle DAP ui
```lua
require("dapui").toggle()
```
Add argument to bash script
```lua
lua require('dap').configurations.sh[1]['args'] = {"This is a variable"}
```
```vim
DapStepOver
DapToggleBreakpoint
DapContinue
DapStepInto
```

@ -0,0 +1,59 @@
require("setup/plugins")
require("setup/set")
require("setup/remap")
require("setup/camel")
require("setup/lsp")
require("setup/cmp")
require("setup/dap")
require("setup/autocmd")
---------------------------------
insert_business_strategy_meeting_agenda_template = function()
local date = os.date("%Y-%m-%d")
local template = [[
---
title: Business Strategy Meeting Agenda
date: ]] .. date .. [[
location: [Insert location or virtual meeting link]
attendees: [Insert names of attendees]
---
# Agenda
1. Introductions
- Welcome and introductions
2. Review of Previous Meeting
- Review and approval of previous meeting minutes
- Action items from previous meeting
3. SWOT Analysis
- Strengths, weaknesses, opportunities, and threats
- Potential opportunities for growth
4. Strategic Planning
- Key strategic initiatives for growth and success
- Action plans and timelines
5. Resource Allocation
- Budget, personnel, and technology allocation for strategic initiatives
- Identification of potential gaps or constraints
6. Risk Management
- Identification and assessment of potential risks associated with strategic initiatives
- Development of risk mitigation and contingency plans
7. Next Steps and Adjournment
- Recap of action items and next steps
- Meeting adjournment
]]
local lines = vim.split(template, "\n", true)
local bufname = vim.fn.bufname() -- get the name of the buffer being deleted
vim.api.nvim_buf_delete(0, {}) -- delete current buffer
vim.api.nvim_create_buf(false, true) -- create new buffer
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines) -- set new buffer content
vim.api.nvim_buf_set_name(0, bufname) -- set new buffer name to the deleted buffer's name
end
vim.cmd(
"command! -nargs=0 InsertBusinessStrategyMeetingAgendaTemplate lua insert_business_strategy_meeting_agenda_template")

@ -0,0 +1,93 @@
require('lspconfig')['jdtls'].setup {
on_attach = on_attach,
flags = lsp_flags,
-- Server-specific settings...
settings = {
["jdtls"] = {
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
autostart = true,
-- autostart = false,
cmd = {
-- ๐Ÿ’€
'java', -- or '/path/to/java17_or_newer/bin/java'
-- depends on if `java` is in your $PATH env variable and if it points to the right version.
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true', '-Dlog.level=ALL', '-Xms1g',
'--add-modules=ALL-SYSTEM', '--add-opens',
'java.base/java.util=ALL-UNNAMED', '--add-opens',
'java.base/java.lang=ALL-UNNAMED', -- ๐Ÿ’€
'-jar',
'/Users/nige/.local/share/lsp/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar',
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
-- Must point to the Change this to
-- eclipse.jdt.ls installation the actual version
-- ๐Ÿ’€
'-configuration',
'/Users/nige/.local/share/lsp/jdtls/config_mac',
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
-- Must point to the Change to one of `linux`, `win` or `mac`
-- eclipse.jdt.ls installation Depending on your system.
-- ๐Ÿ’€
'-data', '/Users/nige/.config/jdtls_workspaces/' ..
vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
},
-- ๐Ÿ’€
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = require('jdtls.setup').find_root({
'.git', 'mvnw', 'gradlew'
}),
-- ๐Ÿ’€
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
eclipse = { downloadSources = true },
maven = { downloadSources = true },
implementationsCodeLens = { enabled = true },
referencesCodeLens = { enabled = true },
references = { includeDecompiledSources = true }
}
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
extendedClientCapabilities = { classFileContentsSupport = true },
bundles = {
vim.fn.glob(
"/Users/nige/.local/share/nvim/dap-servers/com.microsoft.java.debug.plugin_0.43.0.jar",
1)
}
},
on_attach = function(client, bufnr)
-- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes
-- you make during a debug session immediately.
-- Remove the option if you do not want that.
-- You can use the `JdtHotcodeReplace` command to trigger it manually
-- require('jdtls').setup_dap({ hotcodereplace = 'auto' })
local jdtls = require('jdtls')
jdtls.setup_dap({ hotcodereplace = 'auto' })
jdtls.setup.add_commands()
end
}
}
}

@ -0,0 +1,77 @@
require("mason-lspconfig").setup()
local addDesc = function(t, v)
t["desc"] = v
return t
end
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", "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", "<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"))