From 2ca1f10796ebd9e26457dcd0bd47b9cae2c91782 Mon Sep 17 00:00:00 2001 From: Tobias Meinert Date: Sun, 3 Mar 2024 14:26:43 +0100 Subject: [PATCH] Changes to be committed: modified: init.lua new file: lua/custom/init.lua new file: lua/custom/remap.lua Added Personal stuff to updated fork --- init.lua | 174 ++++++++++++++++++------------------------- lua/custom/init.lua | 1 + lua/custom/remap.lua | 24 ++++++ 3 files changed, 96 insertions(+), 103 deletions(-) create mode 100644 lua/custom/init.lua create mode 100644 lua/custom/remap.lua diff --git a/init.lua b/init.lua index 0506b3e6..939a04c7 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know how the Neovim basics, you can skip this step) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not sure exactly what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or neovim features used in kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your nvim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -97,6 +11,7 @@ vim.g.maplocalleader = ' ' -- Make line numbers default vim.opt.number = true +vim.opt.relativenumber = true -- You can also add relative line numbers, for help with jumping. -- Experiment for yourself to see if you like it! -- vim.opt.relativenumber = true @@ -106,12 +21,6 @@ vim.opt.mouse = 'a' -- Don't show the mode, since it's already in status line vim.opt.showmode = false - --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.opt.clipboard = 'unnamedplus' - -- Enable break indent vim.opt.breakindent = true @@ -137,7 +46,7 @@ vim.opt.splitbelow = true -- See :help 'list' -- and :help 'listchars' vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +-- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' @@ -146,7 +55,7 @@ vim.opt.inccommand = 'split' vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 +vim.opt.scrolloff = 20 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -161,7 +70,7 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagn vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- Exit terminal mode in the builtin terminal with a shortcutthat is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- @@ -170,10 +79,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -233,7 +142,6 @@ require('lazy').setup { -- -- This is equivalent to: -- require('Comment').setup({}) - -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, @@ -400,7 +308,66 @@ require('lazy').setup { end, { desc = '[S]earch [N]eovim files' }) end, }, - + { + 'theprimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('harpoon'):setup() + end, + keys = { + { + 'A', + function() + require('harpoon'):list():append() + end, + desc = 'harpoon file', + }, + { + 'a', + function() + local harpoon = require 'harpoon' + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = 'harpoon quick menu', + }, + { + '1', + function() + require('harpoon'):list():select(1) + end, + desc = 'harpoon to file 1', + }, + { + '2', + function() + require('harpoon'):list():select(2) + end, + desc = 'harpoon to file 2', + }, + { + '3', + function() + require('harpoon'):list():select(3) + end, + desc = 'harpoon to file 3', + }, + { + '4', + function() + require('harpoon'):list():select(4) + end, + desc = 'harpoon to file 4', + }, + { + '5', + function() + require('harpoon'):list():select(5) + end, + desc = 'harpoon to file 5', + }, + }, + }, { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { @@ -534,9 +501,10 @@ require('lazy').setup { -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = {}, + zls = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 00000000..6bc22bc5 --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1 @@ +require("custom.remap") diff --git a/lua/custom/remap.lua b/lua/custom/remap.lua new file mode 100644 index 00000000..3de52015 --- /dev/null +++ b/lua/custom/remap.lua @@ -0,0 +1,24 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Erlubt es markierte Bloecke an code mit ctr j k zu verschieben +vim.keymap.set("v", "J", ":m '>+1gv+gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- Keep cursour in the middle while page jumping +vim.keymap.set("n", "C-d", "zz") +vim.keymap.set("n", "C-u", "zz") + +-- Keep search tearms in the middle +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- Paste over marked Text, keep buffer +vim.keymap.set("x", "p", "\"_d") + +-- Seperate vim and system clipboard +vim.keymap.set("n", "d", "\"_d") + +-- telescope remaps +-- +-- quckfixes