diff --git a/init.lua b/init.lua index 3e9aef9..953d16b 100644 --- a/init.lua +++ b/init.lua @@ -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', }, }, }, diff --git a/lua/plex/config/keymaps.lua b/lua/plex/config/keymaps.lua index 0b893c2..ddcad3f 100644 --- a/lua/plex/config/keymaps.lua +++ b/lua/plex/config/keymaps.lua @@ -31,8 +31,9 @@ map('n', 'l', 'Lazy', { 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', "") +--map({ 'n', 'x' }, 'J', "") -- Easier line-wise movement map('n', 'H', 'g^') @@ -98,9 +99,21 @@ map('x', 'P', 'P:let @+=@0:let @"=@0', { silent = true, desc = 'Paste In -- Macros map('n', '', 'q', { desc = 'Macro Prefix' }) +-- Insert new lines above and below +map('n', 'oo', 'o', { desc = 'Insert newline below' }) +map('n', 'OO', 'O', { 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', '', 'o', { desc = 'Start Newline' }) +-- Split and join lines +map('n', 'j', ':join', { desc = 'Join lines', silent = true }) +map('n', 's', 'ik', { desc = 'Join lines', silent = true }) + -- Re-select blocks after indenting in visual/select mode map('x', '<', '', '>gv|', { desc = 'Indent Left and Re-select' }) @@ -151,7 +164,7 @@ map({ 'n', 'x' }, '', '%', { 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', 'sub', ':s//gc', { desc = 'Substitute Within Selection' }) +map('x', 'Sub', ':s//gc', { desc = 'Substitute Within Selection' }) -- Command & History -- === @@ -216,6 +229,10 @@ end, { desc = 'Toggle Wrap' }) map('n', '', 'tabnext', { desc = 'Next Tab' }) map('n', '', 'tabprevious', { desc = 'Previous Tab' }) +-- New and Close +map('n', '', 'tabnew', { desc = 'New Tab' }) +map('n', '', 'tabclose', { desc = 'Close Tab' }) + -- Moving tabs map('n', '', '-tabmove', { desc = 'Tab Move Backwards' }) map('n', '', '+tabmove', { desc = 'Tab Move Forwards' }) @@ -253,8 +270,9 @@ map('n', 'tg', function() Util.float_term({ 'lazygit' }, { cwd = Util.ge -- Floating terminal map('t', '', '', { desc = 'Enter Normal Mode' }) -map('n', 'tt', function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = 'Terminal (root dir)' }) -map('n', 'tT', function() Util.float_term() end, { desc = 'Terminal (cwd)' }) +map('t', '', '', { desc = 'Enter Normal Mode' }) +map('n', '', function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = 'Terminal (root dir)' }) +map('t', '', 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', 'quit', args) + map('n', 'Q', 'quit', args) end end, }) @@ -306,22 +325,28 @@ end, { desc = 'Open Location List' }) -- Switch with adjacent window map('n', '', 'x', { remap = true, desc = 'Swap windows' }) -map('n', 'sb', 'buffer#', { desc = 'Alternate buffer' }) -map('n', 'sc', 'close', { desc = 'Close window' }) -map('n', 'sd', 'bdelete', { desc = 'Buffer delete' }) -map('n', 'sv', 'split', { desc = 'Split window horizontally' }) -map('n', 'sg', 'vsplit', { desc = 'Split window vertically' }) -map('n', 'st', 'tabnew', { desc = 'New tab' }) -map('n', 'so', 'only', { desc = 'Close other windows' }) -map('n', 'sq', 'quit', { desc = 'Quit' }) -map('n', 'sz', 'vertical resize | resize | normal! ze', { desc = 'Maximize' }) -map('n', 'sx', function() +map('n', '%', 'split', { desc = 'Split window horizontally' }) +map('n', '"', 'vsplit', { desc = 'Split window vertically' }) + +map('n', 'wb', 'buffer#', { desc = 'Alternate buffer' }) +map('n', 'wc', 'close', { desc = 'Close window' }) +map('n', 'wd', 'bdelete', { desc = 'Buffer delete' }) +map('n', 'wv', 'split', { desc = 'Split window horizontally' }) +map('n', 'wg', 'vsplit', { desc = 'Split window vertically' }) +map('n', 'wt', 'tabnew', { desc = 'New tab' }) +map('n', 'wtp', 'tabprevious', { desc = 'Previous tab' }) +map('n', 'wtn', 'tabnext', { desc = 'Next tab' }) +map('n', 'wtc', 'tabclose', { desc = 'Close tab' }) +map('n', 'wo', 'only', { desc = 'Close other windows' }) +map('n', 'wq', 'quit', { desc = 'Quit' }) +map('n', 'wz', 'vertical resize | resize | normal! ze', { desc = 'Maximize' }) +map('n', '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', 'uh', function() if vim.o.background == 'dark' then vim.o.background = 'light' else diff --git a/lua/plex/config/options.lua b/lua/plex/config/options.lua index 0b3769e..169b4cb 100644 --- a/lua/plex/config/options.lua +++ b/lua/plex/config/options.lua @@ -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 diff --git a/lua/plex/plugins/editor.lua b/lua/plex/plugins/editor.lua index adb4167..fcdb4a8 100644 --- a/lua/plex/plugins/editor.lua +++ b/lua/plex/plugins/editor.lua @@ -251,11 +251,12 @@ return { ['c'] = { name = '+code' }, ['g'] = { name = '+git' }, ['h'] = { name = '+hunks' }, - ['s'] = { name = '+search' }, + ['S'] = { name = '+search' }, ['t'] = { name = '+toggle/tools' }, ['u'] = { name = '+ui' }, ['x'] = { name = '+diagnostics/quickfix' }, ['z'] = { name = '+notes' }, + ['w'] = { name = '+window' }, }, }, config = function(_, opts) @@ -276,8 +277,8 @@ return { { 'dt', 'TodoTelescope', desc = 'todo' }, { 'xt', 'TodoTrouble', desc = 'Todo (Trouble)' }, { 'xT', 'TodoTrouble keywords=TODO,FIX,FIXME', desc = 'Todo/Fix/Fixme (Trouble)' }, - { 'st', 'TodoTelescope', desc = 'Todo' }, - { 'sT', 'TodoTelescope keywords=TODO,FIX,FIXME', desc = 'Todo/Fix/Fixme' }, + { 'St', 'TodoTelescope', desc = 'Todo' }, + { 'ST', 'TodoTelescope keywords=TODO,FIX,FIXME', desc = 'Todo/Fix/Fixme' }, }, opts = { signs = false }, }, @@ -452,8 +453,8 @@ return { 'nvim-pack/nvim-spectre', -- stylua: ignore keys = { - { 'sp', function() require('spectre').toggle() end, desc = 'Spectre', }, - { 'sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' }, + { 'Sp', function() require('spectre').toggle() end, desc = 'Spectre', }, + { 'Sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' }, }, opts = { mapping = { diff --git a/lua/plex/plugins/extras/org/neorg.lua b/lua/plex/plugins/extras/org/neorg.lua new file mode 100644 index 0000000..6c3dfe6 --- /dev/null +++ b/lua/plex/plugins/extras/org/neorg.lua @@ -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, + }, +} diff --git a/lua/plex/plugins/extras/ui/vim-smoothie.lua b/lua/plex/plugins/extras/ui/vim-smoothie.lua new file mode 100644 index 0000000..9ffc21f --- /dev/null +++ b/lua/plex/plugins/extras/ui/vim-smoothie.lua @@ -0,0 +1,10 @@ +return { + { + 'psliwka/vim-smoothie', + lazy = true, + keys = { + { "J", 'call smoothie#do("\\") ', desc = "Scroll down" }, + { "K", 'call smoothie#do("\\") ', desc = "Scroll up" }, + }, + }, +} diff --git a/lua/plex/plugins/telescope.lua b/lua/plex/plugins/telescope.lua index e9cdf97..784b7b7 100644 --- a/lua/plex/plugins/telescope.lua +++ b/lua/plex/plugins/telescope.lua @@ -169,20 +169,20 @@ return { { 't', 'Telescope lsp_dynamic_workspace_symbols', desc = 'Workspace symbols' }, { 'v', 'Telescope registers', desc = 'Registers' }, { 'u', 'Telescope spell_suggest', desc = 'Spell suggest' }, - { 's', 'Telescope persisted', desc = 'Sessions' }, + { 'S', 'Telescope persisted', desc = 'Sessions' }, { 'x', 'Telescope oldfiles', desc = 'Old files' }, { ';', 'Telescope command_history', desc = 'Command history' }, { ':', 'Telescope commands', desc = 'Commands' }, { '/', 'Telescope search_history', desc = 'Search history' }, { '/', 'Telescope current_buffer_fuzzy_find', desc = 'Buffer find' }, - { 'sd', 'Telescope diagnostics bufnr=0', desc = 'Document diagnostics' }, - { 'sD', 'Telescope diagnostics', desc = 'Workspace diagnostics' }, - { 'sh', 'Telescope help_tags', desc = 'Help Pages' }, - { 'sk', 'Telescope keymaps', desc = 'Key Maps' }, - { 'sm', 'Telescope man_pages', desc = 'Man Pages' }, - { 'sw', 'Telescope grep_string', desc = 'Word' }, - { 'sc', 'Telescope colorscheme', desc = 'Colorscheme' }, + { 'Sd', 'Telescope diagnostics bufnr=0', desc = 'Document diagnostics' }, + { 'SD', 'Telescope diagnostics', desc = 'Workspace diagnostics' }, + { 'Sh', 'Telescope help_tags', desc = 'Help Pages' }, + { 'Sk', 'Telescope keymaps', desc = 'Key Maps' }, + { 'Sm', 'Telescope man_pages', desc = 'Man Pages' }, + { 'Sw', 'Telescope grep_string', desc = 'Word' }, + { 'Sc', 'Telescope colorscheme', desc = 'Colorscheme' }, { 'uC', 'Telescope colorscheme', desc = 'Colorscheme' }, -- LSP related @@ -192,7 +192,7 @@ return { { 'da', 'Telescope lsp_code_actions', desc = 'Code actions' }, { 'da', ':Telescope lsp_range_code_actions', mode = 'x', desc = 'Code actions' }, { - 'ss', + 'Ss', function() require('telescope.builtin').lsp_document_symbols({ symbols = { @@ -212,7 +212,7 @@ return { desc = 'Goto Symbol', }, { - 'sS', + 'SS', function() require('telescope.builtin').lsp_dynamic_workspace_symbols({ symbols = { diff --git a/lua/plex/plugins/ui.lua b/lua/plex/plugins/ui.lua index 33ee63d..48ce9f7 100644 --- a/lua/plex/plugins/ui.lua +++ b/lua/plex/plugins/ui.lua @@ -20,9 +20,9 @@ return { -- stylua: ignore keys = { { '', function() require('noice').redirect(tostring(vim.fn.getcmdline())) end, mode = 'c', desc = 'Redirect Cmdline' }, - { 'snl', function() require('noice').cmd('last') end, desc = 'Noice Last Message' }, - { 'snh', function() require('noice').cmd('history') end, desc = 'Noice History' }, - { 'sna', function() require('noice').cmd('all') end, desc = 'Noice All' }, + { 'Snl', function() require('noice').cmd('last') end, desc = 'Noice Last Message' }, + { 'Snh', function() require('noice').cmd('history') end, desc = 'Noice History' }, + { 'Sna', function() require('noice').cmd('all') end, desc = 'Noice All' }, { '', function() if not require('noice.lsp').scroll(4) then return '' end end, silent = true, expr = true, desc = 'Scroll forward', mode = {'i', 'n', 's'} }, { '', function() if not require('noice.lsp').scroll(-4) then return '' end end, silent = true, expr = true, desc = 'Scroll backward', mode = {'i', 'n', 's'}}, },