From f7a2b45abe8f96107ebec06b45a4fd3a96db93d5 Mon Sep 17 00:00:00 2001 From: Simo Soini Date: Tue, 12 Dec 2023 14:58:31 +0200 Subject: [PATCH] Added my initial changes to kickstart.nvim. --- init.lua | 68 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/init.lua b/init.lua index cf4a3790..21135b1e 100644 --- a/init.lua +++ b/init.lua @@ -69,6 +69,18 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration + -- Navigation integration for tmux + 'christoomey/vim-tmux-navigator', + + -- Undotree for saving file editing history + 'mbbill/undotree', + + -- Automatic pairs for parentheses etc. + 'jiangmiao/auto-pairs', + + -- Github copilot + 'github/copilot.vim', + -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', @@ -76,6 +88,23 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- Harpoon for fast navigation within a project + { + 'theprimeagen/harpoon', + config = function() + local mark = require('harpoon.mark') + local ui = require('harpoon.ui') + + vim.keymap.set('n', 'a', mark.add_file) + vim.keymap.set('n', '', ui.toggle_quick_menu) + + vim.keymap.set('n', '', function() ui.nav_file(1) end) + vim.keymap.set('n', '', function() ui.nav_file(2) end) + vim.keymap.set('n', '', function() ui.nav_file(3) end) + end + }, + + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { @@ -113,7 +142,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -190,11 +219,11 @@ require('lazy').setup({ }, { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', + -- Theme + 'nyoom-engineering/oxocarbon.nvim', priority = 1000, config = function() - vim.cmd.colorscheme 'onedark' + vim.cmd.colorscheme 'oxocarbon' end, }, @@ -205,9 +234,9 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', + theme = 'oxocarbon', + -- component_separators = '|', + -- section_separators = '', }, }, }, @@ -257,7 +286,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -273,11 +302,15 @@ require('lazy').setup({ -- See `:help vim.o` -- NOTE: You can change these options as you wish! +-- Enable scrolloff +vim.opt.scrolloff = 8 + -- Set highlight on search vim.o.hlsearch = false --- Make line numbers default +-- Enable relative linenumbers vim.wo.number = true +vim.opt.relativenumber = true -- Enable mouse mode vim.o.mouse = 'a' @@ -326,6 +359,14 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +-- Move highlighted lines up and down +vim.keymap.set('v', 'J', ':m ">+1gv=gv') +vim.keymap.set('v', 'K', ':m ">-2gv=gv') + +-- Center search results +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -426,7 +467,8 @@ vim.defer_fn(function() ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, + auto_install = true, + sync_install = false, highlight = { enable = true }, indent = { enable = true }, @@ -563,12 +605,12 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = {}, -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + -- html = { filetypes = { 'html', 'twig', 'hbs' } }, lua_ls = { Lua = {