Compare commits

..

3 Commits

Author SHA1 Message Date
c38ec7f2e4 Keybindings:
- rust overrides K for hover actions and J for joinLines
- <space>F now is dioxus format file
- <space>E now is vim.diagnostic.open_float

Config:

- splash shows OGPT entry
- rustaceanvim now requires version ^6 instead of ^5
- dropped sqls.nvim
2025-05-13 21:16:59 +02:00
9206d3ca43 Migrated lspconfig for ts_ls 2025-05-13 10:53:41 +02:00
f3157898b6 Added syntax highlighting for .CON files 2025-05-04 23:31:37 +02:00
6 changed files with 59 additions and 59 deletions

View File

@@ -29,3 +29,9 @@ vim.keymap.set(
end,
{ silent = true, buffer = bufnr, desc = 'RustLSP: show runnables' }
)
-- override signature hover to use RustLsp
vim.keymap.set('n', 'K', ":RustLsp hover actions<cr>", { desc = "RustLSP show signature" })
vim.keymap.set('n', 'J', ":RustLsp joinLines<cr>", { desc = "RustLSP join lines" })

View File

@@ -1,4 +1,5 @@
-- load configurations files from lua/*
require('filetype')
require('options')
require('functions')
require('plugins')

5
lua/filetype.lua Normal file
View File

@@ -0,0 +1,5 @@
vim.filetype.add({
extension = {
CON = 'confile',
},
})

View File

@@ -16,6 +16,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set("n", "<space>f", function()
vim.lsp.buf.format({ async = true })
end, { desc = "LSP Format buffer", unpack(bufopts) })
vim.keymap.set("n", '<space>F', ":silent !dx fmt --file %<cr>", { desc = "DX format rsx! regions", unpack(bufopts) })
vim.keymap.set("v", "<space>f", LSPRangeFormatFunction, { desc = "LSP Format region" })
-- 2024-09-09 - some ccflow commands for diagnostics, symbols and code actions
@@ -26,6 +27,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
local new_config = not vim.diagnostic.config().virtual_lines
vim.diagnostic.config({ virtual_lines = new_config })
end, { desc = "Virtual line diagnostics" })
vim.keymap.set('n', '<space>E', vim.diagnostic.open_float, { desc = "Popup diagnostics" })
vim.keymap.set('n', '<space>s', fzf.lsp_document_symbols, { desc = "Doc symbols" })
vim.keymap.set('n', '<space>c', fzf.lsp_code_actions, { desc = "Code Actions" })
vim.keymap.set('n', '<space>[', vim.diagnostic.goto_prev, { desc = "Previous diagnostics" })
@@ -83,61 +85,33 @@ function LSPRangeFormatFunction()
})
end
-- Set different settings for different languages' LSP
-- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
-- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D
-- - the settings table is sent to the LSP
-- - on_attach: a lua callback function to run after LSP attaches to a given buffer
local lspconfig = require('lspconfig')
-- from :h mason-lspconfig-automatic-server-setup
require('mason-lspconfig').setup_handlers({
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name) -- default handler (optional)
if server_name == 'ts_ls' then
-- taken from https://github.com/vuejs/language-tools
-- If you are using mason.nvim, you can get the ts_plugin_path like this
local mason_registry = require('mason-registry')
local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() ..
'/node_modules/@vue/language-server'
lspconfig[server_name].setup {
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
},
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
}
else
lspconfig[server_name].setup {
}
end
end
})
-- setup sqls support
lspconfig.sqls.setup {
settings = {
sqls = {
connections = {
-- {
-- driver = 'mysql',
-- dataSourceName = 'root:root@tcp(127.0.0.1:13306)/world',
-- },
{
driver = 'postgresql',
dataSourceName = 'host=127.0.0.1 port=5432 sslmode=disable',
},
lspconfig.ts_ls.setup {
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server',
languages = { 'vue' },
},
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
}
-- add autoformat to Dioxus projects
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.rs",
callback = function()
local cwd = vim.lsp.buf.list_workspace_folders()
if not (cwd == nil) then
if vim.fn.filereadable(cwd[1] .. "/Dioxus.toml") == 1 then
local command = "dx fmt --file %"
vim.cmd("silent ! " .. command)
-- vim.notify(command)
end
end
end,
})

View File

@@ -94,7 +94,8 @@ require("lazy").setup({
action = function(exporter)
local current_file = vim.api.nvim_buf_get_name(0)
local target = vim.fn.fnamemodify(current_file, ':p:r') .. '.html'
local command = { 'pandoc', '--filter', 'pandoc-plot', current_file, '--standalone', '--toc', '--number-sections', '--output', target }
local command = { 'pandoc', '--filter', 'pandoc-plot', current_file, '--standalone', '--toc',
'--number-sections', '--output', target }
local on_success = function(output)
print('Success!')
vim.api.nvim_echo({ { table.concat(output, '\n') } }, true, {})
@@ -488,7 +489,7 @@ require("lazy").setup({
dashboard.section.header.val = vim.split(adjustedLogo, '\n')
dashboard.section.buttons.val = {
dashboard.button('h', ' Browse ~', '<cmd>Neotree<CR>'),
dashboard.button('o', '󱙺 AI Chat', '<cmd>OGPT<CR>'),
dashboard.button('n', ' New file', ':ene <BAR> startinsert <CR>'),
dashboard.button('s', ' Settings', '<cmd>WorkspacesOpen config-nvim<CR>'),
dashboard.button('u', '󱐥 Update plugins', '<cmd>Lazy update<CR>'),
@@ -519,7 +520,7 @@ require("lazy").setup({
-- improved Rust support
{
'mrcjkb/rustaceanvim',
version = '^5', -- Recommended
version = '^6', -- Recommended
lazy = false, -- This plugin is already lazy
},
@@ -602,11 +603,6 @@ require("lazy").setup({
opts = {},
},
-- database connectivity
{
"nanotee/sqls.nvim"
},
-- ollama and LLM integration
{
{

18
syntax/confile.vim Normal file
View File

@@ -0,0 +1,18 @@
" Vim Syntax file for CON files
syn match SetLength /^\d\{3\}/ nextgroup=SetKeyword,SetKeywordMarked
syn match SetKeyword /\d\{4\}/ contained
syn match SetKeywordMarked /310[123]\|5000/ contained nextgroup=SetKeywordMarkedInfo
syn match SetKeywordMarkedInfo /..*/ contained
hi SetLength guifg=grey
hi SetKeyword guifg=lightgreen
hi SetKeywordMarked gui=inverse guifg=lightgreen
hi SetKeywordMarkedInfo gui=inverse
syn match SetStart /^0138000/ nextgroup=SetType
syn match SetType /con0\|con9\|besa\|adt0\|adt9\|010[1-4]\|rvsa/ contained " 0101
hi SetStart guifg=white guibg=green
hi SetType guifg=white guibg=red