repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

changed neovim symlink on host EJ-PC-00363

1a5a7bc431e24f96a049f8edb8540e95b11b9cb0

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (5)

+173 / −140 text lines

Diff layout

.gitignore

Modified

+1 / −0 text lines

11bootstripper
2neovim/plugin

EJ-PC-00363.symlinks

Modified

+1 / −1 text lines

11neovim
2~/.config/nvim
2~/AppData/Local/nvim
44git/.gitconfig
55~/.gitconfig

neovim/init.lua

Modified

+1 / −1 text lines

3535local autocommand = require 'autocommand'
3737-- My cheatsheet is an initial buffer (if none was specified) where I put stuff to remember/learn.
38-- Keybinds, commands, TODOs are all fair game.
38-- Keybinds, commands, todos are all fair game.
3939local cheatsheet, setup_cheatsheet = require 'cheatsheet'()
4040-- make cheatsheet globally available for easy access in plugins configurations blocks of packer
4141_G.cheatsheet = cheatsheet

neovim/lua/lsp.lua

Modified

+160 / −127 text lines

11-- This function configures all the LSP clients that i might care about.
22-- It is expected to be called in the 'config' step of the 'lspconfig' plugin.
3return function()
4 local integrate_into_neovim = function(client, buffer_number)
5 print("LSP started.", vim.inspect(client), buffer_number);
6 local chain_complete_list = {
7 default = {
8 {complete_items = {'lsp', 'snippet'}},
9 {complete_items = {'path'}, triggered_only = {'/'}},
10 {complete_items = {'buffers'}},
11 },
12 string = {
13 {complete_items = {'path'}, triggered_only = {'/'}},
14 },
15 comment = {},
16 }
17 require'completion'.on_attach{
18 sorting = 'length',
19 enable_auto_popup = false,
20 chain_complete_list = chain_complete_list
21 }
3-- autocommand: function, that can create autocmds
4return function(autocommand)
5 local integrate_into_neovim = function(client, buffer_number)
6 print("LSP " .. client.name .. " [" .. client.id .. "] " .. "started.")
7 local chain_complete_list = {
8 default = {
9 { complete_items = { "lsp", "snippet" } },
10 { complete_items = { "path" }, triggered_only = { "/" } },
11 { complete_items = { "buffers" } },
12 },
13 string = {
14 { complete_items = { "path" }, triggered_only = { "/" } },
15 },
16 comment = {},
17 }
23 local map = function(type, key, value)
24 vim.api.nvim_buf_set_keymap(buffer_number,type,key,value,{noremap = true, silent = true});
25 end
26 map('n','<LEADER>gD','<CMD>lua vim.lsp.buf.declaration()<CR>')
27 map('n','<LEADER>gd','<CMD>lua vim.lsp.buf.definition()<CR>')
28 map('n','<LEADER>K','<CMD>lua vim.lsp.buf.hover()<CR>')
29 map('n','<LEADER>gr','<CMD>lua vim.lsp.buf.references()<CR>')
30 map('n','<LEADER>gs','<CMD>lua vim.lsp.buf.signature_help()<CR>')
31 map('n','<LEADER>gi','<CMD>lua vim.lsp.buf.implementation()<CR>')
32 map('n','<LEADER>gt','<CMD>lua vim.lsp.buf.type_definition()<CR>')
33 map('n','<LEADER>gw','<CMD>lua vim.lsp.buf.document_symbol()<CR>')
34 map('n','<LEADER>gW','<CMD>lua vim.lsp.buf.workspace_symbol()<CR>')
35 map('n','<LEADER>ah','<CMD>lua vim.lsp.buf.hover()<CR>')
36 map('n','<LEADER>af','<CMD>lua vim.lsp.buf.code_action()<CR>')
37 map('n','<LEADER>ar','<CMD>lua vim.lsp.buf.rename()<CR>')
38 map('n','<LEADER>=', '<CMD>lua vim.lsp.buf.formatting()<CR>')
39 map('n','<LEADER>ai','<CMD>lua vim.lsp.buf.incoming_calls()<CR>')
40 map('n','<LEADER>ao','<CMD>lua vim.lsp.buf.outgoing_calls()<CR>')
19 require("completion").on_attach({
20 sorting = "length",
21 enable_auto_popup = false,
22 chain_complete_list = chain_complete_list,
23 })
42 map('n','<LEADER>n','<CMD>lua vim.lsp.diagnostic.goto_next()<CR>')
43 map('n','<LEADER>N','<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>')
44 map('n','<LEADER><LEADER>','<CMD>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>')
45 end
25 if client.resolved_capabilities.document_formatting then
26 autocommand({
27 format_on_save = [[ BufWritePost <buffer> lua print'Formatting...'; vim.lsp.buf.formatting() ]],
28 })
29 end
47 local lsp = require'lspconfig'
31 local map = function(type, key, value)
32 vim.api.nvim_buf_set_keymap(buffer_number, type, key, value, { noremap = true, silent = true })
33 end
49 -- Nvim lua configuration LSP
50 local neovim_runtime_path = vim.split(package.path, ';')
51 table.insert(neovim_runtime_path, 'lua/?.lua')
52 table.insert(neovim_runtime_path, 'lua/?/init.lua')
53 local sumneko_home = os.getenv'SUMNEKO_HOME'
54 local system_name
55 if vim.fn.has("mac") == 1 then
56 system_name = "macOS"
57 elseif vim.fn.has("unix") == 1 then
58 system_name = "Linux"
59 elseif vim.fn.has('win32') == 1 then
60 system_name = "Windows"
61 else
62 print("Unsupported system for sumneko")
63 end
64 local neovim_lua_library = {}
65 for _, path in pairs(vim.api.nvim_list_runtime_paths()) do
66 local lua_path = path .. "/lua/";
67 if vim.fn.isdirectory(lua_path) then
68 neovim_lua_library[lua_path] = true
69 end
70 end
71 -- This loads the `lua` files from nvim into the runtime.
72 neovim_lua_library[vim.fn.expand("$VIMRUNTIME/lua")] = true
73 --TODO: How to switch this configuration based upon if we are editing neovim configuration or just any Lua file/project?
74 lsp.sumneko_lua.setup {
75 on_attach = integrate_into_neovim,
76 cmd = { sumneko_home .. '/bin/' .. system_name .. '/lua-language-server','-E','-W', sumneko_home .. '/main.lua'},
77 settings = {
78 Lua = {
79 runtime = {
80 version = 'LuaJIT',
81 path = neovim_runtime_path,
82 },
83 diagnostics = {
84 enable = true,
85 disable = 'trailing-space',
86 globals = { 'vim' },
87 },
88 hint = {
89 enable = true,
90 },
91 workspace = {
92 library = neovim_lua_library,
93 maxPreload = 10000,
94 preloadFileSize = 10000,
95 },
96 telemetry = {
97 enable = true,
98 },
99 globals = {
100 'cheatsheet',
101 }
102 }
103 }
104 }
105 -- Markdown Notes (Zettelkasten) LSP
106 lsp.zeta_note.setup{
107 on_attach = integrate_into_neovim,
108 cmd = { 'zeta-note' }
109 }
35 map("n", "<LEADER>gD", "<CMD>lua vim.lsp.buf.declaration()<CR>")
36 map("n", "<LEADER>gd", "<CMD>lua vim.lsp.buf.definition()<CR>")
37 map("n", "<LEADER>K", "<CMD>lua vim.lsp.buf.hover()<CR>")
38 map("n", "<LEADER>gr", "<CMD>lua vim.lsp.buf.references()<CR>")
39 map("n", "<LEADER>gs", "<CMD>lua vim.lsp.buf.signature_help()<CR>")
40 map("n", "<LEADER>gi", "<CMD>lua vim.lsp.buf.implementation()<CR>")
41 map("n", "<LEADER>gt", "<CMD>lua vim.lsp.buf.type_definition()<CR>")
42 map("n", "<LEADER>gw", "<CMD>lua vim.lsp.buf.document_symbol()<CR>")
43 map("n", "<LEADER>gW", "<CMD>lua vim.lsp.buf.workspace_symbol()<CR>")
44 map("n", "<LEADER>ah", "<CMD>lua vim.lsp.buf.hover()<CR>")
45 map("n", "<LEADER>af", "<CMD>lua vim.lsp.buf.code_action()<CR>")
46 map("n", "<LEADER>ar", "<CMD>lua vim.lsp.buf.rename()<CR>")
47 map("n", "<LEADER>=", "<CMD>lua vim.lsp.buf.formatting()<CR>")
48 map("n", "<LEADER>ai", "<CMD>lua vim.lsp.buf.incoming_calls()<CR>")
49 map("n", "<LEADER>ao", "<CMD>lua vim.lsp.buf.outgoing_calls()<CR>")
111 -- YAML LSP
112 lsp.yamlls.setup{
113 on_attach = integrate_into_neovim,
114 --FIXME: Only works on Windows
115 cmd = { 'yaml-language-server.cmd', '--stdio' },
116 root_dir = function() return vim.fn.getcwd() end
117 }
51 map("n", "<LEADER>n", "<CMD>lua vim.lsp.diagnostic.goto_next()<CR>")
52 map("n", "<LEADER>N", "<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>")
53 map("n", "<LEADER><LEADER>", "<CMD>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>")
54 end
119 -- Zig LSP
120 lsp.zls.setup{ on_attach = integrate_into_neovim }
56 local lsp = require("lspconfig")
122 -- JSON LSP
123 lsp.jsonls.setup {
124 on_attach = integrate_into_neovim,
125 cmd = { 'vscode-json-language-server.cmd', '--stdio' },
126 commands = {
127 Format = {
128 -- Apply the ranged formatting to the whole file
129 function()
130 vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})
131 end
132 }
133 }
134 }
58 -- Nvim lua configuration LSP
59 local neovim_runtime_path = vim.split(package.path, ";")
60 table.insert(neovim_runtime_path, "lua/?.lua")
61 table.insert(neovim_runtime_path, "lua/?/init.lua")
62 local sumneko_home = os.getenv("SUMNEKO_HOME")
63 local system_name
64 if vim.fn.has("mac") == 1 then
65 system_name = "macOS"
66 elseif vim.fn.has("unix") == 1 then
67 system_name = "Linux"
68 elseif vim.fn.has("win32") == 1 then
69 system_name = "Windows"
70 else
71 print("Unsupported system for sumneko")
72 end
73 local neovim_lua_library = {}
74 for _, path in pairs(vim.api.nvim_list_runtime_paths()) do
75 local lua_path = path .. "/lua/"
76 if vim.fn.isdirectory(lua_path) then
77 neovim_lua_library[lua_path] = true
78 end
79 end
80 -- This loads the `lua` files from nvim into the runtime.
81 neovim_lua_library[vim.fn.expand("$VIMRUNTIME/lua")] = true
82 --TODO: How to switch this configuration based upon if we are editing neovim configuration or just any Lua file/project?
83 lsp.sumneko_lua.setup({
84 on_attach = integrate_into_neovim,
85 cmd = {
86 sumneko_home .. "/bin/" .. system_name .. "/lua-language-server",
87 "-E",
88 "-W",
89 sumneko_home .. "/main.lua",
90 },
91 settings = {
92 Lua = {
93 runtime = {
94 version = "LuaJIT",
95 path = neovim_runtime_path,
96 },
97 diagnostics = {
98 enable = true,
99 disable = "trailing-space",
100 globals = { "vim" },
101 },
102 hint = {
103 enable = true,
104 },
105 workspace = {
106 library = neovim_lua_library,
107 maxPreload = 10000,
108 preloadFileSize = 10000,
109 },
110 telemetry = {
111 enable = true,
112 },
113 globals = {
114 "cheatsheet",
115 },
116 },
117 },
118 })
119 -- Markdown Notes (Zettelkasten) LSP
120 lsp.zeta_note.setup({
121 on_attach = integrate_into_neovim,
122 cmd = { "zeta-note" },
123 })
136 -- GraphViz Dot LSP
137 lsp.dotls.setup { on_attach = integrate_into_neovim }
125 -- YAML LSP
126 lsp.yamlls.setup({
127 on_attach = integrate_into_neovim,
128 --FIXME: Only works on Windows
129 cmd = { "yaml-language-server.cmd", "--stdio" },
130 root_dir = function()
131 return vim.fn.getcwd()
132 end,
133 })
135 -- Zig LSP
136 lsp.zls.setup({ on_attach = integrate_into_neovim })
138 -- LLVM Clang LSP
139 lsp.clangd.setup({ on_attach = integrate_into_neovim })
141 -- JSON LSP
142 lsp.jsonls.setup({
143 on_attach = integrate_into_neovim,
144 cmd = { "vscode-json-language-server.cmd", "--stdio" },
145 commands = {
146 Format = {
147 -- Apply the ranged formatting to the whole file
148 function()
149 vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
150 end,
151 },
152 },
153 })
155 -- GraphViz Dot LSP
156 lsp.dotls.setup({ on_attach = integrate_into_neovim })
158 -- Null-ls
159 local nls = require("null-ls")
160 nls.setup({
161 debug = true,
162 sources = {
163 nls.builtins.formatting.stylua.with({
164 args = { "-s", "$FILENAME" },
165 to_stdin = false,
166 }),
167 nls.builtins.diagnostics.vale,
168 },
169 on_attach = integrate_into_neovim,
170 })
138171end

neovim/lua/plugins.lua

Modified

+10 / −11 text lines

151151 }
152152 end,
153153 }
154 -- Repository and API for configuring LSP servers in nvim
155 use { 'neovim/nvim-lspconfig',
154 -- null-ls is a plugin, that allows to code custom functions, that get exposed as a lsp server
155 use { "jose-elias-alvarez/null-ls.nvim",
156156 config = function()
157 require'lsp'()
158 end}
157 -- This will configure all LSPs not only Null-ls.
158 -- But because Null-ls depends on lspconfig, we have to delay this
159 require'lsp'(require'autocommand')
160 end,
161 requires = {"nvim-lua/plenary.nvim", "neovim/nvim-lspconfig"}
162 }
159163 -- Utility functions to glue the status messages of LSP servers with the status line in nvim together
160164 use 'nvim-lua/lsp-status.nvim'
161165 -- Deeper integration of JDTLS from Eclipse with nvim
174178 end,
175179 }
176180 -- Nicer view than :registers, also shows popup on CTRL-R in I-mode
177 use { 'tversteeg/registers.nvim' }
181 use { 'tversteeg/registers.nvim', opt = true, command = 'Registers', keys = {'i', '<C-R>'} }
178182 -- comment and uncomment lines
179 use {
180 'b3nj5m1n/kommentary',
181 config = function()
182 cheatsheet'Use gcc to toggle line comment'
183 end,
184 }
183 use { 'b3nj5m1n/kommentary' }
185184 -- smooth scrolling
186185 -- TODO: configure mappings to overide duration
187186 -- currently the scroll steps a pretty slow