diff --git a/init.lua b/init.lua index a9d3748b..a204a574 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,5 @@ --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +require('lornest.remap') +require('lornest.set') -- Install package manager -- https://github.com/folke/lazy.nvim @@ -26,7 +23,6 @@ vim.opt.rtp:prepend(lazypath) -- You can also configure plugins after the setup call, -- as they will be available in your neovim runtime. require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', @@ -34,7 +30,10 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', - -- NOTE: This is where your plugins related to LSP can be installed. + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + + -- NOTE: This is where plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { -- LSP Configuration & Plugins @@ -69,31 +68,6 @@ require('lazy').setup({ }, }, - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, - { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) - end, - }, - }, - - -- NOTE: A couple of colour schemes that I like. - { -- Theme inspired by Atom 'navarasu/onedark.nvim', @@ -103,42 +77,7 @@ require('lazy').setup({ end, }, - -- { - -- "folke/tokyonight.nvim", - -- lazy = false, - -- priority = 1000, - -- opts = {}, - -- config = function() - -- vim.cmd.colorscheme 'tokyonight' - -- end, - -- }, - - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = true, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, - - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` - opts = { - char = '┊', - show_trailing_blankline_indent = false, - }, - }, - - -- "gc" to comment visual regions/lines + -- use "gcc" to comment a line and "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) @@ -174,74 +113,18 @@ 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 'lornest.plugins.fugitive', - require 'lornest.plugins.harpoon', - require 'lornest.plugins.copilot', - require 'lornest.plugins.nvim-tree', require 'lornest.plugins.autoformat', + require 'lornest.plugins.copilot', + require 'lornest.plugins.fugitive', + require 'lornest.plugins.gitsigns', + require 'lornest.plugins.harpoon', + require 'lornest.plugins.indent-blankline', + require 'lornest.plugins.lualine', + require 'lornest.plugins.nvim-tree', -- require 'kickstart.plugins.debug', - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, }, {}) --- [[ Setting options ]] --- See `:help vim.o` --- NOTE: You can change these options as you wish! - --- Set highlight on search -vim.o.hlsearch = false - --- Make line numbers default -vim.wo.number = true -vim.o.relativenumber = true - --- Enable mouse mode -vim.o.mouse = 'a' - --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' - --- Enable break indent -vim.o.breakindent = true - --- Save undo history -vim.o.undofile = true - --- Case-insensitive searching UNLESS \C or capital in search -vim.o.ignorecase = true -vim.o.smartcase = true - --- Keep signcolumn on by default -vim.wo.signcolumn = 'yes' - --- Decrease update time -vim.o.updatetime = 250 -vim.o.timeoutlen = 300 - --- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' - --- NOTE: You should make sure your terminal supports this -vim.o.termguicolors = true - --- [[ Basic Keymaps ]] - --- Keymaps for better default experience --- See `:help vim.keymap.set()` -vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) - --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) - -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) diff --git a/lua/lornest/plugins/gitsigns.lua b/lua/lornest/plugins/gitsigns.lua new file mode 100644 index 00000000..ff940fa0 --- /dev/null +++ b/lua/lornest/plugins/gitsigns.lua @@ -0,0 +1,20 @@ +return { + -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, + { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) + vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) + vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) + end, + }, +} diff --git a/lua/lornest/plugins/indent-blankline.lua b/lua/lornest/plugins/indent-blankline.lua new file mode 100644 index 00000000..8149a398 --- /dev/null +++ b/lua/lornest/plugins/indent-blankline.lua @@ -0,0 +1,9 @@ +return { + -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- See `:help indent_blankline.txt` + opts = { + char = '┊', + show_trailing_blankline_indent = false, + }, +} diff --git a/lua/lornest/plugins/lualine.lua b/lua/lornest/plugins/lualine.lua new file mode 100644 index 00000000..f7269075 --- /dev/null +++ b/lua/lornest/plugins/lualine.lua @@ -0,0 +1,12 @@ +return { + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = true, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, +} diff --git a/lua/lornest/remap.lua b/lua/lornest/remap.lua new file mode 100644 index 00000000..b6a70546 --- /dev/null +++ b/lua/lornest/remap.lua @@ -0,0 +1,12 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) diff --git a/lua/lornest/set.lua b/lua/lornest/set.lua new file mode 100644 index 00000000..aebf737b --- /dev/null +++ b/lua/lornest/set.lua @@ -0,0 +1,40 @@ +-- [[ Setting options ]] +-- See `:help vim.o` + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true +vim.o.relativenumber = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = 'unnamedplus' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = 'yes' + +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true