diff --git a/README.md b/README.md index f445b65ecd5..68e9c8cd04e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ + # kickstart.nvim +My neovim config, based on kickstart. ## Introduction @@ -11,6 +13,47 @@ A starting point for Neovim that is: **NOT** a Neovim distribution, but instead a starting point for your configuration. ## Installation +TL;DR + +I have added toggleterm, neo-tree, vim-fugitive, notify, scrollview, telescope-env and C/C++ incl. DAP support mainly, as well as little tweaks and shortcuts to make autocomplete more natural (ie. let autocomplete accept with enter) +You get a full C/C++ IDE config incl DAP debugging support working out of the box, clangd based: lsp, linter, formatter, dap config and what kickstart.nvim normally does (see below). You should build gdb from source to have DAP support. + +``` + - If you have an existing setup, I recommend a full clean: + - back it up + - rm -rf ~/.local/share/nvim + - rm -rf ~/.config/nvim + - I strongly recommend to pull latest neovim sources and build current neovim from source + - I strongly recommend to pull and compile gdb so you have version 14.1 with DAP support + - clone this repo into ~/.config and rename it to nvim + - start neovim, wait a bit and enjoy! + +Some of the shortcuts (my is comma) + - ; : : (thx renerocksai for this idea!) + - ,, : fuzzy select / open file + - ,v : open a new vsplit + - ,mm : make (in persistent terminal) + - ,mc : make clean (in persistent terminal) + - : toggle persistent terminal + - : toggle neo-tree + - : keyword fuzzy search +``` +You can search for M64 in init.lua to find my changes. + +To get the full blown C/C++ IDE experience: + +When you have first started nvim after these steps, it autoinstalls almost all packages, and configures neovim. To get the full blown C/C++ IDE experience: have a look at `Mason`! (I do not want to interfere with its's installation mechanisms -> you need to manually follow this steps, to complete setup) + +In nvim start Mason by entering `:Mason`, select and install the following packages: + +``` + ◍ clangd + ◍ cpplint + ◍ cpptools + ◍ markdownlint +``` +to do so - hover over the corresponding package name from the list, and press `i` to install it. That's it! + ### Install Neovim diff --git a/init.lua b/init.lua index 88658ef3033..f70822b377f 100644 --- a/init.lua +++ b/init.lua @@ -1,97 +1,11 @@ ---[[ - -===================================================================== -==================== 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 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 exactly sure of 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 you 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 Neovim 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 +-- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +vim.g.mapleader = ',' +vim.g.maplocalleader = ',' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -161,6 +75,9 @@ vim.opt.scrolloff = 10 vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') +-- M64 additional settings +vim.opt.colorcolumn = '80' + -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) @@ -176,10 +93,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 @@ -190,6 +107,18 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- M64 additional keymaps +vim.keymap.set('n', 'v', 'vnew', { desc = 'New vertical spit' }) +-- vim.keymap.set('n', 'mm', 'vsplit | terminal make', { desc = 'make' }) +vim.keymap.set('n', 'mm', 'TermExec cmd=make direction=vertical', { desc = 'make' }) +-- vim.keymap.set('n', 'mc', 'vsplit | terminal make', { desc = 'make clean' }) +vim.keymap.set('n', 'mc', 'TermExec cmd="make clean" direction=vertical', { desc = 'make' }) +-- vim.keymap.set('n', 'tt', 'vnew | terminal', { desc = 'New vertical spit with a terminal' }) +vim.keymap.set('n', 'tt', 'ToggleTerm direction=vertical size=80', { desc = 'New vertical spit with a terminal' }) +vim.keymap.set('n', '', 'ToggleTerm direction=vertical size=80', { desc = 'New vertical spit with a terminal' }) +vim.keymap.set('n', '', 'Neotree toggle position=right', { desc = 'Toggle Neotree' }) +vim.keymap.set('n', ';', ':', { desc = 'For my lazy fingers ;)' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -239,7 +168,6 @@ require('lazy').setup({ -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, - -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: -- require('gitsigns').setup({ ... }) @@ -323,6 +251,7 @@ require('lazy').setup({ end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'LinArcX/telescope-env.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, @@ -369,6 +298,8 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension, 'env') + pcall(require('telescope').load_extension, 'notify') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' @@ -381,7 +312,10 @@ require('lazy').setup({ vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- M64 + vim.keymap.set('n', '', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', '', builtin.find_files, { desc = '[S]earch [F]iles' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() @@ -733,7 +667,7 @@ require('lazy').setup({ -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, --[''] = cmp.mapping.select_next_item(), --[''] = cmp.mapping.select_prev_item(), @@ -784,7 +718,7 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'tokyonight-moon' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -873,12 +807,13 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', + require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + -- M64 + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. @@ -886,6 +821,12 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, + + -- M64 additional plugins + 'tpope/vim-fugitive', + 'rcarriga/nvim-notify', + 'dstein64/nvim-scrollview', + { 'akinsho/toggleterm.nvim', version = '*', config = true }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the @@ -908,5 +849,8 @@ require('lazy').setup({ }, }) +-- M64 +vim.notify = require 'notify' + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et