Word highlighting, lsp_signature, calendar and settings / keybindings

Plugins:

- added word highlighting plugin mywords
- added lsp_signature plugin to show parameter signature while typing a
  function call
- added calendar.vim
- added lush.nvim needed for some theme definitions, though not for the
  nice and current default lunaperche

Keybindings:

- <space>m[mrc] for mywords
- <C-W>0 and <C-W>1 for window close / make single
- <C-,> for lsp references
- <C-.> for lsp definitions

Options:

- highlight last search term
- add I to shortmess to start with an empty file instead of splash
  screen
- fzf uses default-title as theme
- fzf registered as vim.ui.select implementation
- which_key shows global definitions, too
This commit is contained in:
2024-09-26 10:10:06 +02:00
parent db62337357
commit c80752ebea
4 changed files with 70 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
-- Setup fzf-lua keybindings
-- Setup fzf-lua keybindings and some other searches
local fzf = require('fzf-lua')
vim.keymap.set('n', '<leader>ff', fzf.files, { desc = "Find file" })
vim.keymap.set('n', '<leader>fs', fzf.blines, { desc = "Search buffer" })
@@ -43,3 +43,22 @@ workspaces_fzf_picker = function(opts)
end, opts)
end
vim.keymap.set('n', '<leader>w', workspaces_fzf_picker, { desc = "Workspaces" } )
------------------------------------------
--
-- Word higlighting
--
------------------------------------------
local mywords = require('mywords')
vim.keymap.set('n', '<space>mm', mywords.hl_toggle, { desc = "Highlight current word" })
vim.keymap.set('n', '<space>mr', mywords.hl_toggle_regex, { desc = "Highlight regexp" })
vim.keymap.set('n', '<space>mc', mywords.uhl_all, { desc = "Clear all highlights" })
------------------------------------------
--
-- Shortcuts which are known from Emacs
--
------------------------------------------
vim.keymap.set('n', '<C-W>1', ":wincmd o<CR>", { desc = "Win: close others" })
vim.keymap.set('n', '<C-W>0', ":only<CR>", { desc = "Win: close current" })

View File

@@ -25,8 +25,9 @@ require('mason-lspconfig').setup({
-- Customized on_attach function
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { noremap = true, silent = true, desc = "Popup diagnostics" })
-- 2024-09-23 - currently unused
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
@@ -58,13 +59,13 @@ local on_attach = function(client, bufnr)
-- 2024-09-09 - some ccflow commands
local fzf = require('fzf-lua')
vim.keymap.set('n', '<space>d', fzf.diagnostics_document, { desc = "Doc diagnostics" })
vim.keymap.set('n', '<space>d', fzf.diagnostics_document, { desc = "Document diagnostics" })
vim.keymap.set('n', '<space>D', fzf.diagnostics_workspace, { desc = "Workspace 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', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<C-[>', fzf.lsp_references, { desc = "Find References" })
vim.keymap.set('n', '<C-]>', fzf.lsp_definitions, { desc = "Find References" })
vim.keymap.set('n', '<C-,>', fzf.lsp_references, { desc = "Find References" })
vim.keymap.set('n', '<C-.>', fzf.lsp_definitions, { desc = "Find References" })
end
-- Set different settings for different languages' LSP

View File

@@ -27,7 +27,7 @@ vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSE
-- Searching
vim.opt.incsearch = true -- search as characters are entered
vim.opt.hlsearch = false -- do not highlight matches
vim.opt.hlsearch = true -- do not highlight matches
vim.opt.ignorecase = true -- ignore case in searches by default
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
@@ -45,3 +45,11 @@ vim.opt.wrap = false
-- Spelling
vim.opt.spell = true
vim.opt.spelllang = "de,en"
--------------------------------------------------
--
-- Other options
--
--------------------------------------------------
vim.opt.shortmess = vim.opt.shortmess + 'I'

View File

@@ -43,10 +43,19 @@ require("lazy").setup({
end,
},
-- LSP manager
--
-- LSP manager and others
--
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
-- show lsp signature while coding
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
opts = {},
config = function(_, opts) require 'lsp_signature'.setup(opts) end
},
-- neogit setup
{
@@ -90,7 +99,9 @@ require("lazy").setup({
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
-- calling `setup` is optional for customization
require("fzf-lua").setup({})
local fzf = require("fzf-lua")
fzf.setup({ "default-title" })
fzf.register_ui_select()
end
},
@@ -119,7 +130,7 @@ require("lazy").setup({
{
"<leader>?",
function()
require("which-key").show({ global = false })
require("which-key").show({ global = true })
end,
desc = "Buffer Local Keymaps (which-key)",
},
@@ -247,4 +258,25 @@ require("lazy").setup({
-- refer to the configuration section below
}
},
-- highlight word under cursor
{
"dwrdx/mywords.nvim",
},
-- Calendar view
{
"itchyny/calendar.vim"
},
--------------------------------------------------
--
-- Color schemes
--
--------------------------------------------------
{
"rktjmp/lush.nvim"
-- if you wish to use your own colorscheme:
-- { dir = '/absolute/path/to/colorscheme', lazy = true },
},
})