usability achieved

This commit is contained in:
Christoph J. Scherr 2023-09-06 11:47:14 +02:00
parent af22846ff4
commit e12f0f6eec
8 changed files with 99 additions and 39 deletions

View File

@ -8,6 +8,8 @@ config.ensure_lazy()
require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
spec = {
{ import = 'plex.plugins' },
{ import = 'plex.plugins.extras.ui' },
{ import = 'plex.plugins.extras.org' },
{ import = 'plex.plugins.extras.lang.go' },
{ import = 'plex.plugins.extras.lang.json' },
{ import = 'plex.plugins.extras.lang.python' },
@ -36,8 +38,6 @@ require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
'netrwPlugin',
'tutor',
'zipPlugin',
'vim-lsp',
'lua-ls',
},
},
},

View File

@ -31,8 +31,9 @@ map('n', '<leader>l', '<cmd>Lazy<cr>', { desc = 'Open Lazy UI' })
-- ===
-- Move faster between lines
map({ 'n', 'x' }, 'J', "v:count == 30 ? 'gj' : 'J'", { expr = true, silent = true })
map({ 'n', 'x' }, 'K', "v:count == 30 ? 'gk' : 'K'", { expr = true, silent = true })
-- See vim-smoothie
--map({ 'n', 'x' }, 'K', "<C-u>")
--map({ 'n', 'x' }, 'J', "<C-d>")
-- Easier line-wise movement
map('n', 'H', 'g^')
@ -98,9 +99,21 @@ map('x', 'P', 'P:let @+=@0<CR>:let @"=@0<CR>', { silent = true, desc = 'Paste In
-- Macros
map('n', '<C-q>', 'q', { desc = 'Macro Prefix' })
-- Insert new lines above and below
map('n', 'oo', 'o<ESC>', { desc = 'Insert newline below' })
map('n', 'OO', 'O<ESC>', { desc = 'Insert newline below' })
-- keep regular behavior
map('n', 'O', 'O', { desc = 'Insert newline below' })
map('n', 'o', 'o', { desc = 'Insert newline below' })
-- Start new line from any cursor position in insert-mode
map('i', '<S-Return>', '<C-o>o', { desc = 'Start Newline' })
-- Split and join lines
map('n', '<leader>j', ':join<CR>', { desc = 'Join lines', silent = true })
map('n', '<leader>s', 'i<CR><ESC>k', { desc = 'Join lines', silent = true })
-- Re-select blocks after indenting in visual/select mode
map('x', '<', '<gv', { desc = 'Indent Right and Re-select' })
map('x', '>', '>gv|', { desc = 'Indent Left and Re-select' })
@ -151,7 +164,7 @@ map({ 'n', 'x' }, '<BS>', '%', { remap = true, desc = 'Jump to Paren' })
map('n', 'gpp', "'`['.strpart(getregtype(), 0, 1).'`]'", { expr = true, desc = 'Select Paste' })
-- Quick substitute within selected area
map('x', '<leader>sub', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection' })
map('x', '<leader>Sub', ':s//gc<Left><Left><Left>', { desc = 'Substitute Within Selection' })
-- Command & History
-- ===
@ -216,6 +229,10 @@ end, { desc = 'Toggle Wrap' })
map('n', '<A-j>', '<cmd>tabnext<CR>', { desc = 'Next Tab' })
map('n', '<A-k>', '<cmd>tabprevious<CR>', { desc = 'Previous Tab' })
-- New and Close
map('n', '<A-t>', '<cmd>tabnew<CR>', { desc = 'New Tab' })
map('n', '<A-c>', '<cmd>tabclose<CR>', { desc = 'Close Tab' })
-- Moving tabs
map('n', '<A-S-j>', '<cmd>-tabmove<CR>', { desc = 'Tab Move Backwards' })
map('n', '<A-S-k>', '<cmd>+tabmove<CR>', { desc = 'Tab Move Forwards' })
@ -253,8 +270,9 @@ map('n', '<leader>tg', function() Util.float_term({ 'lazygit' }, { cwd = Util.ge
-- Floating terminal
map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Enter Normal Mode' })
map('n', '<Leader>tt', function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = 'Terminal (root dir)' })
map('n', '<Leader>tT', function() Util.float_term() end, { desc = 'Terminal (cwd)' })
map('t', '<C-w>', '<C-\\><C-n>', { desc = 'Enter Normal Mode' })
map('n', '<F12>', function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = 'Terminal (root dir)' })
map('t', '<F12>', function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = 'Terminal (root dir)' })
if vim.fn.has('mac') then
-- Open the macOS dictionary on current word
@ -278,13 +296,14 @@ end
-- ===
-- Ultimatus Quitos
-- Use Q to quit whatever
if vim.F.if_nil(vim.g.plex_window_q_mapping, true) then
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, {
group = augroup('quit_mapping'),
callback = function(event)
if vim.bo.buftype == '' and vim.fn.maparg('q', 'n') == '' then
if vim.bo.buftype == '' and vim.fn.maparg('Q', 'n') == '' then
local args = { buffer = event.buf, desc = 'Quit' }
map('n', 'q', '<cmd>quit<CR>', args)
map('n', 'Q', '<cmd>quit<CR>', args)
end
end,
})
@ -306,22 +325,28 @@ end, { desc = 'Open Location List' })
-- Switch with adjacent window
map('n', '<C-x>', '<C-w>x', { remap = true, desc = 'Swap windows' })
map('n', 'sb', '<cmd>buffer#<CR>', { desc = 'Alternate buffer' })
map('n', 'sc', '<cmd>close<CR>', { desc = 'Close window' })
map('n', 'sd', '<cmd>bdelete<CR>', { desc = 'Buffer delete' })
map('n', 'sv', '<cmd>split<CR>', { desc = 'Split window horizontally' })
map('n', 'sg', '<cmd>vsplit<CR>', { desc = 'Split window vertically' })
map('n', 'st', '<cmd>tabnew<CR>', { desc = 'New tab' })
map('n', 'so', '<cmd>only<CR>', { desc = 'Close other windows' })
map('n', 'sq', '<cmd>quit<CR>', { desc = 'Quit' })
map('n', 'sz', '<cmd>vertical resize | resize | normal! ze<CR>', { desc = 'Maximize' })
map('n', 'sx', function()
map('n', '<leader>%', '<cmd>split<CR>', { desc = 'Split window horizontally' })
map('n', '<leader>"', '<cmd>vsplit<CR>', { desc = 'Split window vertically' })
map('n', '<leader>wb', '<cmd>buffer#<CR>', { desc = 'Alternate buffer' })
map('n', '<leader>wc', '<cmd>close<CR>', { desc = 'Close window' })
map('n', '<leader>wd', '<cmd>bdelete<CR>', { desc = 'Buffer delete' })
map('n', '<leader>wv', '<cmd>split<CR>', { desc = 'Split window horizontally' })
map('n', '<leader>wg', '<cmd>vsplit<CR>', { desc = 'Split window vertically' })
map('n', '<leader>wt', '<cmd>tabnew<CR>', { desc = 'New tab' })
map('n', '<leader>wtp', '<cmd>tabprevious<CR>', { desc = 'Previous tab' })
map('n', '<leader>wtn', '<cmd>tabnext<CR>', { desc = 'Next tab' })
map('n', '<leader>wtc', '<cmd>tabclose<CR>', { desc = 'Close tab' })
map('n', '<leader>wo', '<cmd>only<CR>', { desc = 'Close other windows' })
map('n', '<leader>wq', '<cmd>quit<CR>', { desc = 'Quit' })
map('n', '<leader>wz', '<cmd>vertical resize | resize | normal! ze<CR>', { desc = 'Maximize' })
map('n', '<leader>wx', function()
require('mini.bufremove').delete(0, false)
vim.cmd.enew()
end, { desc = 'Delete buffer and open new' })
-- Background dark/light toggle
map('n', 'sh', function()
map('n', '<leader>uh', function()
if vim.o.background == 'dark' then
vim.o.background = 'light'
else

View File

@ -32,7 +32,7 @@ opt.viewoptions:remove('folds')
opt.sessionoptions:remove({ 'buffers', 'folds' })
-- Sync with system clipboard
opt.clipboard = 'unnamedplus'
--opt.clipboard = 'unnamedplus'
-- Undo
opt.undofile = true

View File

@ -251,11 +251,12 @@ return {
['<leader>c'] = { name = '+code' },
['<leader>g'] = { name = '+git' },
['<leader>h'] = { name = '+hunks' },
['<leader>s'] = { name = '+search' },
['<leader>S'] = { name = '+search' },
['<leader>t'] = { name = '+toggle/tools' },
['<leader>u'] = { name = '+ui' },
['<leader>x'] = { name = '+diagnostics/quickfix' },
['<leader>z'] = { name = '+notes' },
['<leader>w'] = { name = '+window' },
},
},
config = function(_, opts)
@ -276,8 +277,8 @@ return {
{ '<LocalLeader>dt', '<cmd>TodoTelescope<CR>', desc = 'todo' },
{ '<leader>xt', '<cmd>TodoTrouble<CR>', desc = 'Todo (Trouble)' },
{ '<leader>xT', '<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>', desc = 'Todo/Fix/Fixme (Trouble)' },
{ '<leader>st', '<cmd>TodoTelescope<cr>', desc = 'Todo' },
{ '<leader>sT', '<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>', desc = 'Todo/Fix/Fixme' },
{ '<leader>St', '<cmd>TodoTelescope<cr>', desc = 'Todo' },
{ '<leader>ST', '<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>', desc = 'Todo/Fix/Fixme' },
},
opts = { signs = false },
},
@ -452,8 +453,8 @@ return {
'nvim-pack/nvim-spectre',
-- stylua: ignore
keys = {
{ '<Leader>sp', function() require('spectre').toggle() end, desc = 'Spectre', },
{ '<Leader>sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' },
{ '<Leader>Sp', function() require('spectre').toggle() end, desc = 'Spectre', },
{ '<Leader>Sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' },
},
opts = {
mapping = {

View File

@ -0,0 +1,24 @@
return {
{
"nvim-neorg/neorg",
lazy = false,
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
main = "~/Nextcloud/Neorg/",
notes = "~/Nextcloud/Notizen/",
},
},
},
},
}
end,
},
}

View File

@ -0,0 +1,10 @@
return {
{
'psliwka/vim-smoothie',
lazy = true,
keys = {
{ "J", '<cmd>call smoothie#do("\\<C-D>") <CR>', desc = "Scroll down" },
{ "K", '<cmd>call smoothie#do("\\<C-U>") <CR>', desc = "Scroll up" },
},
},
}

View File

@ -169,20 +169,20 @@ return {
{ '<localleader>t', '<cmd>Telescope lsp_dynamic_workspace_symbols<CR>', desc = 'Workspace symbols' },
{ '<localleader>v', '<cmd>Telescope registers<CR>', desc = 'Registers' },
{ '<localleader>u', '<cmd>Telescope spell_suggest<CR>', desc = 'Spell suggest' },
{ '<localleader>s', '<cmd>Telescope persisted<CR>', desc = 'Sessions' },
{ '<localleader>S', '<cmd>Telescope persisted<CR>', desc = 'Sessions' },
{ '<localleader>x', '<cmd>Telescope oldfiles<CR>', desc = 'Old files' },
{ '<localleader>;', '<cmd>Telescope command_history<CR>', desc = 'Command history' },
{ '<localleader>:', '<cmd>Telescope commands<CR>', desc = 'Commands' },
{ '<localleader>/', '<cmd>Telescope search_history<CR>', desc = 'Search history' },
{ '<leader>/', '<cmd>Telescope current_buffer_fuzzy_find<CR>', desc = 'Buffer find' },
{ '<leader>sd', '<cmd>Telescope diagnostics bufnr=0<CR>', desc = 'Document diagnostics' },
{ '<leader>sD', '<cmd>Telescope diagnostics<CR>', desc = 'Workspace diagnostics' },
{ '<leader>sh', '<cmd>Telescope help_tags<CR>', desc = 'Help Pages' },
{ '<leader>sk', '<cmd>Telescope keymaps<CR>', desc = 'Key Maps' },
{ '<leader>sm', '<cmd>Telescope man_pages<CR>', desc = 'Man Pages' },
{ '<leader>sw', '<cmd>Telescope grep_string<CR>', desc = 'Word' },
{ '<leader>sc', '<cmd>Telescope colorscheme<CR>', desc = 'Colorscheme' },
{ '<leader>Sd', '<cmd>Telescope diagnostics bufnr=0<CR>', desc = 'Document diagnostics' },
{ '<leader>SD', '<cmd>Telescope diagnostics<CR>', desc = 'Workspace diagnostics' },
{ '<leader>Sh', '<cmd>Telescope help_tags<CR>', desc = 'Help Pages' },
{ '<leader>Sk', '<cmd>Telescope keymaps<CR>', desc = 'Key Maps' },
{ '<leader>Sm', '<cmd>Telescope man_pages<CR>', desc = 'Man Pages' },
{ '<leader>Sw', '<cmd>Telescope grep_string<CR>', desc = 'Word' },
{ '<leader>Sc', '<cmd>Telescope colorscheme<CR>', desc = 'Colorscheme' },
{ '<leader>uC', '<cmd>Telescope colorscheme<CR>', desc = 'Colorscheme' },
-- LSP related
@ -192,7 +192,7 @@ return {
{ '<localleader>da', '<cmd>Telescope lsp_code_actions<CR>', desc = 'Code actions' },
{ '<localleader>da', ':Telescope lsp_range_code_actions<CR>', mode = 'x', desc = 'Code actions' },
{
'<leader>ss',
'<leader>Ss',
function()
require('telescope.builtin').lsp_document_symbols({
symbols = {
@ -212,7 +212,7 @@ return {
desc = 'Goto Symbol',
},
{
'<leader>sS',
'<leader>SS',
function()
require('telescope.builtin').lsp_dynamic_workspace_symbols({
symbols = {

View File

@ -20,9 +20,9 @@ return {
-- stylua: ignore
keys = {
{ '<S-Enter>', function() require('noice').redirect(tostring(vim.fn.getcmdline())) end, mode = 'c', desc = 'Redirect Cmdline' },
{ '<leader>snl', function() require('noice').cmd('last') end, desc = 'Noice Last Message' },
{ '<leader>snh', function() require('noice').cmd('history') end, desc = 'Noice History' },
{ '<leader>sna', function() require('noice').cmd('all') end, desc = 'Noice All' },
{ '<leader>Snl', function() require('noice').cmd('last') end, desc = 'Noice Last Message' },
{ '<leader>Snh', function() require('noice').cmd('history') end, desc = 'Noice History' },
{ '<leader>Sna', function() require('noice').cmd('all') end, desc = 'Noice All' },
{ '<c-f>', function() if not require('noice.lsp').scroll(4) then return '<c-f>' end end, silent = true, expr = true, desc = 'Scroll forward', mode = {'i', 'n', 's'} },
{ '<c-b>', function() if not require('noice.lsp').scroll(-4) then return '<c-b>' end end, silent = true, expr = true, desc = 'Scroll backward', mode = {'i', 'n', 's'}},
},