dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide nvim: start work on lsp
7192ad0a27f2a009f5b79815f472bb1d8116d9ad
Oliver Krylow <o.krylow@isp-insoft.de > · 21 Jul 2023
unsigned
Browse files Compare with HEAD
Changed files (10) neovim/.editorconfig Added new file mode 100644 13 + continuation_indent =
2 17 + max_line_length =
120 24 + table_separator_style =
comma 27 + trailing_table_separator =
keep 30 + call_arg_parentheses =
remove 32 + detect_end_of_line =
false 35 + insert_final_newline =
true 38 + space_around_table_field_list =
true 40 + space_before_attribute =
true 42 + space_before_function_open_parenthesis =
false 44 + space_before_function_call_open_parenthesis =
false 46 + space_before_closure_open_parenthesis =
true 50 + space_before_function_call_single_arg =
always 52 + space_before_open_square_bracket =
false 54 + space_inside_function_call_parentheses =
true 56 + space_inside_function_param_list_parentheses =
true 58 + space_inside_square_brackets =
false 61 + space_around_table_append_operator =
false 63 + ignore_spaces_inside_function_call =
false 65 + space_before_inline_comment =
1 68 + space_around_math_operator =
true 70 + space_after_comma =
true 72 + space_after_comma_in_for_statement =
true 74 + space_around_concat_operator =
true 78 + align_call_args =
true 80 + align_function_params =
true 82 + align_continuous_assign_statement =
true 84 + align_continuous_rect_table_field =
true 86 + align_continuous_line_space =
2 88 + align_if_branch =
true 91 + align_array_table =
true 93 + align_continuous_similar_call_args =
true 95 + align_continuous_inline_comment =
true 97 + align_chain_expr =
none 101 + never_indent_before_if_condition =
false 103 + never_indent_comment_on_if_branch =
false 114 + line_space_after_if_statement =
keep 116 + line_space_after_do_statement =
keep 118 + line_space_after_while_statement =
keep 120 + line_space_after_repeat_statement =
keep 122 + line_space_after_for_statement =
keep 124 + line_space_after_local_or_assign_statement =
keep 126 + line_space_after_function_statement =
fixed(2) 128 + line_space_after_expression_statement =
keep 130 + line_space_after_comment =
keep 133 + break_all_list_when_line_exceed =
false 135 + auto_collapse_lines =
false 137 + break_before_braces =
false 139 + ignore_space_after_colon =
false 141 + remove_call_expression_list_finish_comma =
false 15 15 require 'bugabinga.diagnostic' 17 17 require 'bugabinga.trim' 18 + require 'bugabinga.lsp' neovim/lazy-lock.json Modified 8 8 "heirline.nvim" : {
"branch" :
"master" ,
"commit" :
"76136ccd93ed608e8109762f032cf1118981ebbd" },
9 9 "hlargs.nvim" : {
"branch" :
"main" ,
"commit" :
"cfc9beab4e176a13311efe03e38e6b6fed5df4f6" },
10 10 "indent-blankline.nvim" : {
"branch" :
"master" ,
"commit" :
"b7aa0aed55887edfaece23f7b46ab22232fc8741" },
11 - "indent-o-matic" : {
"branch" :
"master" ,
"commit" :
"4d11e98f523d3c4500b1dc33f0d1a248a4f69719" },
12 11 "lazy.nvim" : {
"branch" :
"main" ,
"commit" :
"14d76aac4bd3ff07c1fca074c210f28f766a931e" },
13 12 "lush.nvim" : {
"branch" :
"main" ,
"commit" :
"b10ef2bfff0647e701b691019ade3edd5e44eb50" },
14 13 "neodev.nvim" : {
"branch" :
"main" ,
"commit" :
"da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
26 25 "nvim-notify" : {
"branch" :
"master" ,
"commit" :
"ea9c8ce7a37f2238f934e087c255758659948e0f" },
27 26 "nvim-surround" : {
"branch" :
"main" ,
"commit" :
"211eaad7c6d01ef4ac02cba9052b3082ec232101" },
28 27 "nvim-treesitter" : {
"branch" :
"master" ,
"commit" :
"9fa6806b88905d52b5ca36094909630919b432cc" },
29 - "nvim-treesitter-textobjects" : {
"branch" :
"master" ,
"commit" :
"52f1f3280d9092bfaee5c45be5962fabee3d9654" },
30 28 "nvim-ts-autotag" : {
"branch" :
"main" ,
"commit" :
"6be1192965df35f94b8ea6d323354f7dc7a557e4" },
31 29 "nvim-ts-context-commentstring" : {
"branch" :
"main" ,
"commit" :
"7f625207f225eea97ef7a6abe7611e556c396d2f" },
32 30 "nvim-web-devicons" : {
"branch" :
"master" ,
"commit" :
"efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
41 39 "toggleterm.nvim" : {
"branch" :
"main" ,
"commit" :
"b90a1381e9b5b8596f49070ee86c71db267ac868" },
42 40 "treesj" : {
"branch" :
"main" ,
"commit" :
"3203aa553217921fd4dcb79245f9df07278910b2" },
43 41 "virt-column.nvim" : {
"branch" :
"master" ,
"commit" :
"93b40ea038f676f5a72d7d1f2336fe7b051fc0ce" }
neovim/lua/bugabinga/lsp/init.lua Added new file mode 100644 7 + local map
= require 'std.keymap' 8 + local auto
= require 'std.auto' 12 + local token_update = function (lsp_client)
13 + local token
= lsp_client.data.token
14 + local buffer
= lsp_client.buffer
15 + local client_id
= lsp_client.data.client_id
16 + local mutable_variable_highlight
= 'MutableVariable' 19 + if token.type
== 'variable' and not token.modifiers.readonly
then 20 + vim.lsp.semantic_tokens.highlight_token(token, buffer, client_id, mutable_variable_highlight)
30 + cmd =
'lua-language-server' ,
31 + root_dir = project.determine_lua_project_root,
36 + local lsp_start = function (
... ) vim.print(
"START LSP" ,
... )
end 37 + local lsp_attach = function (
... ) vim.print(
"ATTACH LSP" ,
... )
end 38 + local lsp_detach = function (
... ) vim.print(
"DETACH LSP" ,
... )
end 42 + description =
'Start or reuse LSP client' ,
43 + events =
'FileType' ,
44 + command = lsp_start,
47 + description =
'Hook: LSP client attached to buffer' ,
48 + events =
'LspAttach' ,
49 + command = lsp_attach,
52 + description =
'Hook: LSP client detached from buffer' ,
53 + events =
'LspDetach' ,
54 + command = lsp_detach,
57 + description =
'Semantic Tokens from the LSP' ,
58 + events =
'LspTokenUpdate' ,
59 + command = token_update,
64 + return setmetatable (_ ,{
neovim/lua/bugabinga/nugu/init.lua Modified 107 107 Float { String },
109 109 Identifier { Normal },
110 + MutableVariable { Debug },
110 111 Function { Normal },
112 113 Statement {
fg = content_minor },
neovim/lua/std/project.lua Modified 1 + local dirname
= vim.fs.dirname
2 + local exists
= vim.loop.fs_stat
5 + local MAX_TRAVERSAL_COUNT
= 100 29 - local function determine_root (directory, markers, root)
30 - local dirname = function (path)
31 - return vim.fn.fnamemodify(path,
':h' )
33 - local exists = function (path)
34 - return vim.loop.fs_stat(path)
37 + local function find_root (path, markers, stop)
39 + local buffer_name
= vim.api.nvim_buf_get_name(
0 )
40 + local path
= dirname(buffer_name)
43 + stop
= stop
or vim.uv.os_homedir()
45 + if not exists(stop)
then error (
'the stop directory %s does not exist!' :format(stop))
end 36 47 local directory_scores
= {}
37 48 local current_distance_to_buffer
= 0 49 + local loop_count
= 0 44 - while directory
~= root
do 56 + while path
~= stop
do 57 + if loop_count
> MAX_TRAVERSAL_COUNT
then error (
'searching for markers reached the max traversal count!' )
end 48 62 distance_to_buffer_file = current_distance_to_buffer,
52 66 for _, marker
in ipairs (markers)
do 53 - local marker_path
= directory
.. '/' .. marker.name
67 + local marker_path
= path
.. '/' .. marker.name
54 68 if exists(marker_path)
then 55 69 score.marker_count
= score.marker_count
+ marker.weight
56 70 table .
insert (score.markers, marker_path)
61 75 table .
insert (directory_scores, score)
64 - directory
= dirname(directory)
78 + path
= dirname(path)
65 80 current_distance_to_buffer
= current_distance_to_buffer
+ 1 81 + loop_count
= loop_count
+ 1 68 84 local project_root
= nil 90 - local function determine_project_root (custom_markers, custom_root)
93 - local root
= vim.fn.glob(custom_root)
95 - vim.notify(
'the custom root ' .. custom_root
.. ' does not exist!' ,
'error' )
109 + local function find_project_root (markers)
111 + local default_markers
= {
100 112 {
name =
'.git' ,
weight =
1 },
101 113 {
name =
'.gitignore' ,
weight =
1 },
102 114 {
name =
'.svn' ,
weight =
1 },
104 116 {
name =
'Jenkinsfile' ,
weight =
1 },
105 117 {
name =
'.editorconfig' ,
weight =
1 },
106 118 {
name =
'LICENSE' ,
weight =
1 },
119 + {
name =
'LICENSE.md' ,
weight =
1 },
107 120 {
name =
'LICENSE.txt' ,
weight =
1 },
108 121 {
name =
'COPYING' ,
weight =
1 },
109 122 {
name =
'README' ,
weight =
1 },
110 123 {
name =
'README.md' ,
weight =
1 },
124 + {
name =
'Makefile' ,
weight =
1 },
125 + {
name =
'flake.nix' ,
weight =
1 },
126 + {
name =
'flake.nix' ,
weight =
1 },
112 - markers
= vim.tbl_deep_extend(
'force' , markers, custom_markers)
128 + markers
= vim.tbl_deep_extend(
'force' , default_markers, markers)
114 - local buffer_name
= vim.api.nvim_buf_get_name(
0 )
115 - local directory_name
= vim.fn.fnamemodify(buffer_name,
':p:h' )
116 - return determine_root(directory_name, markers, root)
130 + return find_root(
nil , markers)
119 - local java_markers
= {
120 - {
name =
'.idea' ,
weight =
2 },
121 - {
name =
'.classpath' ,
weight =
2 },
122 - {
name =
'.settings' ,
weight =
2 },
123 - {
name =
'.project' ,
weight =
2 },
124 - {
name =
'target' ,
weight =
2 },
125 - {
name =
'pom.xml' ,
weight =
2 },
126 - {
name =
'mvnw' ,
weight =
3 },
127 - {
name =
'.mvn' ,
weight =
3 },
128 - {
name =
'mvnw.cmd' ,
weight =
3 },
129 - {
name =
'build.gradle' ,
weight =
2 },
130 - {
name =
'gradle.properties' ,
weight =
3 },
131 - {
name =
'settings.gradle' ,
weight =
3 },
132 - {
name =
'gradlew' ,
weight =
3 },
133 - {
name =
'gradlew.bat' ,
weight =
3 },
133 + local function find_java_project_root ()
134 + local java_markers
= {
135 + {
name =
'.idea' ,
weight =
2 },
136 + {
name =
'.classpath' ,
weight =
2 },
137 + {
name =
'.settings' ,
weight =
2 },
138 + {
name =
'.project' ,
weight =
2 },
139 + {
name =
'target' ,
weight =
2 },
140 + {
name =
'pom.xml' ,
weight =
2 },
141 + {
name =
'mvnw' ,
weight =
3 },
142 + {
name =
'.mvn' ,
weight =
3 },
143 + {
name =
'mvnw.cmd' ,
weight =
3 },
144 + {
name =
'build.gradle' ,
weight =
2 },
145 + {
name =
'gradle.properties' ,
weight =
3 },
146 + {
name =
'settings.gradle' ,
weight =
3 },
147 + {
name =
'gradlew' ,
weight =
3 },
148 + {
name =
'gradlew.bat' ,
weight =
3 },
151 + return find_root(
nil , java_markers)
154 + local lua_markers
= {
155 + {
name =
'.luacheckrc' ,
weight =
1 },
156 + {
name =
'.stylua.toml' ,
weight =
1 },
157 + {
name =
'selene.toml' ,
weight =
1 },
135 - local function determine_java_project_root (user_root)
136 - return determine_project_root(java_markers, user_root)
159 + local nvim_lua_markers
= {
160 + {
name =
'neovim.yml' ,
weight =
1 },
161 + {
name =
'init.lua' ,
weight =
1 },
162 + {
name =
'lua' ,
weight =
2 },
165 + local find_lua_project_root = function ()
166 + return find_root(
nil , lua_markers)
139 - local function is_java_project_root (directory, user_root)
141 - return determine_root(directory, java_markers, user_root)
~= nil 169 + local find_nvim_lua_project_root = function ()
170 + local markers
= vim.tbl_deep_extend(
'error' , lua_markers, nvim_lua_markers)
171 + return find_root(
nil , markers)
145 - is_java_project_root = is_java_project_root,
146 - determine_root = determine_root,
147 - determine_project_root = determine_project_root,
148 - determine_java_project_root = determine_java_project_root,
175 + find_root = find_root,
176 + find_project_root = find_project_root,
177 + find_java_project_root = find_java_project_root,
178 + find_lua_project_root = find_lua_project_root,
179 + find_nvim_lua_project_root = find_nvim_lua_project_root,
neovim/selene.toml Deleted deleted file mode 1006444 - global_usage =
"allow" 5 - multiple_statements =
"allow" neovim/stylua.toml Deleted deleted file mode 1006443 - indent_type =
"Spaces" 5 - quote_style =
"AutoPreferSingle" 6 - call_parentheses =
"None" wezterm/wezterm.lua Modified 49 49 elseif hostname
== 'PC-00625' then
50 50 font
= wez.font
'BlexMono Nerd Font'