refactors init.lua - moves options to custom/options.lua and adds my options
This commit is contained in:
		
							parent
							
								
									4a37a0a9b1
								
							
						
					
					
						commit
						2c3654c950
					
				
							
								
								
									
										135
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										135
									
								
								init.lua
								
								
								
								
							|  | @ -1,48 +1,14 @@ | ||||||
| --[[ | ------------------------------------------------------ | ||||||
| 
 |  | ||||||
| ===================================================================== |  | ||||||
| ==================== READ THIS BEFORE CONTINUING ==================== |  | ||||||
| ===================================================================== |  | ||||||
| 
 |  | ||||||
| Kickstart.nvim is *not* a distribution. |  | ||||||
| 
 |  | ||||||
| Kickstart.nvim is a template for your own configuration. |  | ||||||
|   The goal is that you can read every line of code, top-to-bottom, and understand |  | ||||||
|   what your configuration is doing. |  | ||||||
| 
 |  | ||||||
|   Once you've done that, you should start exploring, configuring and tinkering to |  | ||||||
|   explore Neovim! |  | ||||||
| 
 |  | ||||||
|   If you don't know anything about Lua, I recommend taking some time to read through |  | ||||||
|   a guide. One possible example: |  | ||||||
|   - https://learnxinyminutes.com/docs/lua/ |  | ||||||
| 
 |  | ||||||
|   And then you can explore or search through `:help lua-guide` |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| Kickstart Guide: |  | ||||||
| 
 |  | ||||||
| I have left several `:help X` comments throughout the init.lua |  | ||||||
| You should run that command and read that help section for more information. |  | ||||||
| 
 |  | ||||||
| In addition, I have some `NOTE:` items 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. |  | ||||||
| 
 |  | ||||||
| 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 <space> as the leader key | -- Set <space> 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.mapleader = ' ' | ||||||
| vim.g.maplocalleader = ' ' | vim.g.maplocalleader = ' ' | ||||||
| 
 | 
 | ||||||
|  | require 'custom.options' | ||||||
|  | 
 | ||||||
|  | ------------------------------------------------------ | ||||||
| -- Install package manager | -- Install package manager | ||||||
|  | ------------------------------------------------------ | ||||||
| --    https://github.com/folke/lazy.nvim | --    https://github.com/folke/lazy.nvim | ||||||
| --    `:help lazy.nvim.txt` for more info | --    `:help lazy.nvim.txt` for more info | ||||||
| local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' | local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' | ||||||
|  | @ -58,11 +24,14 @@ if not vim.loop.fs_stat(lazypath) then | ||||||
| end | end | ||||||
| vim.opt.rtp:prepend(lazypath) | vim.opt.rtp:prepend(lazypath) | ||||||
| 
 | 
 | ||||||
|  | ------------------------------------------------------ | ||||||
| -- NOTE: Here is where you install your plugins. | -- NOTE: Here is where you install your plugins. | ||||||
| --  You can configure plugins using the `config` key. | --  You can configure plugins using the `config` key. | ||||||
| -- | -- | ||||||
| --  You can also configure plugins after the setup call, | --  You can also configure plugins after the setup call, | ||||||
| --    as they will be available in your neovim runtime. | --    as they will be available in your neovim runtime. | ||||||
|  | ------------------------------------------------------ | ||||||
|  | 
 | ||||||
| require('lazy').setup({ | require('lazy').setup({ | ||||||
|   -- NOTE: First, some plugins that don't require any configuration |   -- NOTE: First, some plugins that don't require any configuration | ||||||
| 
 | 
 | ||||||
|  | @ -73,9 +42,10 @@ require('lazy').setup({ | ||||||
|   -- Detect tabstop and shiftwidth automatically |   -- Detect tabstop and shiftwidth automatically | ||||||
|   'tpope/vim-sleuth', |   'tpope/vim-sleuth', | ||||||
| 
 | 
 | ||||||
|   -- NOTE: This is where your plugins related to LSP can be installed. |   -- NOTE: plugins related to LSP | ||||||
|   --  The configuration is done below. Search for lspconfig to find it below. |   -- The configuration is done below. Search for lspconfig to find it below. | ||||||
|   { -- LSP Configuration & Plugins |   { | ||||||
|  |     -- LSP Configuration & Plugins | ||||||
|     'neovim/nvim-lspconfig', |     'neovim/nvim-lspconfig', | ||||||
|     dependencies = { |     dependencies = { | ||||||
|       -- Automatically install LSPs to stdpath for neovim |       -- Automatically install LSPs to stdpath for neovim | ||||||
|  | @ -91,14 +61,16 @@ require('lazy').setup({ | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   { -- Autocompletion |   { | ||||||
|  |     -- Autocompletion | ||||||
|     'hrsh7th/nvim-cmp', |     'hrsh7th/nvim-cmp', | ||||||
|     dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, |     dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   -- Useful plugin to show you pending keybinds. |   -- Useful plugin to show you pending keybinds. | ||||||
|   { 'folke/which-key.nvim', opts = {} }, |   { 'folke/which-key.nvim',          opts = {} }, | ||||||
|   { -- Adds git releated signs to the gutter, as well as utilities for managing changes |   { | ||||||
|  |     -- Adds git releated signs to the gutter, as well as utilities for managing changes | ||||||
|     'lewis6991/gitsigns.nvim', |     'lewis6991/gitsigns.nvim', | ||||||
|     opts = { |     opts = { | ||||||
|       -- See `:help gitsigns.txt` |       -- See `:help gitsigns.txt` | ||||||
|  | @ -112,28 +84,29 @@ require('lazy').setup({ | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   { -- Theme inspired by Atom |   { | ||||||
|     'navarasu/onedark.nvim', |     -- Theme | ||||||
|  |     'sainnhe/gruvbox-material', | ||||||
|     priority = 1000, |     priority = 1000, | ||||||
|     config = function() |     config = function() | ||||||
|       vim.cmd.colorscheme 'onedark' |       vim.cmd.colorscheme 'gruvbox-material' | ||||||
|     end, |     end, | ||||||
|   }, |   }, | ||||||
| 
 |   { | ||||||
|   { -- Set lualine as statusline |  | ||||||
|     'nvim-lualine/lualine.nvim', |     'nvim-lualine/lualine.nvim', | ||||||
|     -- See `:help lualine.txt` |     -- See `:help lualine.txt` | ||||||
|     opts = { |     opts = { | ||||||
|       options = { |       options = { | ||||||
|         icons_enabled = false, |         icons_enabled = false, | ||||||
|         theme = 'onedark', |         theme = 'gruvbox-material', | ||||||
|         component_separators = '|', |         component_separators = '|', | ||||||
|         section_separators = '', |         section_separators = '', | ||||||
|       }, |       }, | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   { -- Add indentation guides even on blank lines |   { | ||||||
|  |     -- Add indentation guides even on blank lines | ||||||
|     'lukas-reineke/indent-blankline.nvim', |     'lukas-reineke/indent-blankline.nvim', | ||||||
|     -- Enable `lukas-reineke/indent-blankline.nvim` |     -- Enable `lukas-reineke/indent-blankline.nvim` | ||||||
|     -- See `:help indent_blankline.txt` |     -- See `:help indent_blankline.txt` | ||||||
|  | @ -144,7 +117,7 @@ require('lazy').setup({ | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   -- "gc" to comment visual regions/lines |   -- "gc" to comment visual regions/lines | ||||||
|   { 'numToStr/Comment.nvim', opts = {} }, |   { 'numToStr/Comment.nvim',         opts = {} }, | ||||||
| 
 | 
 | ||||||
|   -- Fuzzy Finder (files, lsp, etc) |   -- Fuzzy Finder (files, lsp, etc) | ||||||
|   { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, |   { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, | ||||||
|  | @ -162,7 +135,8 @@ require('lazy').setup({ | ||||||
|     end, |     end, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   { -- Highlight, edit, and navigate code |   { | ||||||
|  |     -- Highlight, edit, and navigate code | ||||||
|     'nvim-treesitter/nvim-treesitter', |     'nvim-treesitter/nvim-treesitter', | ||||||
|     dependencies = { |     dependencies = { | ||||||
|       'nvim-treesitter/nvim-treesitter-textobjects', |       'nvim-treesitter/nvim-treesitter-textobjects', | ||||||
|  | @ -173,10 +147,8 @@ require('lazy').setup({ | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart |   -- 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. |   require 'kickstart.plugins.autoformat', | ||||||
|   --       Uncomment any of the lines below to enable them. |   require 'kickstart.plugins.debug', | ||||||
|   -- require 'kickstart.plugins.autoformat', |  | ||||||
|   -- require 'kickstart.plugins.debug', |  | ||||||
| 
 | 
 | ||||||
|   -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` |   -- NOTE: The import below automatically adds 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 |   --    You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping | ||||||
|  | @ -189,48 +161,9 @@ require('lazy').setup({ | ||||||
|   { import = 'custom.plugins' }, |   { import = 'custom.plugins' }, | ||||||
| }, {}) | }, {}) | ||||||
| 
 | 
 | ||||||
| -- [[ Setting options ]] | ------------------------------------------------------ | ||||||
| -- See `:help vim.o` |  | ||||||
| 
 |  | ||||||
| -- Set highlight on search |  | ||||||
| vim.o.hlsearch = false |  | ||||||
| 
 |  | ||||||
| -- Make line numbers default |  | ||||||
| vim.wo.number = 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.timeout = true |  | ||||||
| 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 ]] | -- [[ Basic Keymaps ]] | ||||||
|  | ------------------------------------------------------ | ||||||
| 
 | 
 | ||||||
| -- Keymaps for better default experience | -- Keymaps for better default experience | ||||||
| -- See `:help vim.keymap.set()` | -- See `:help vim.keymap.set()` | ||||||
|  | @ -284,7 +217,9 @@ vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { de | ||||||
| vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) | vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) | ||||||
| vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) | vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) | ||||||
| 
 | 
 | ||||||
|  | ------------------------------------------------------ | ||||||
| -- [[ Configure Treesitter ]] | -- [[ Configure Treesitter ]] | ||||||
|  | ------------------------------------------------------ | ||||||
| -- See `:help nvim-treesitter` | -- See `:help nvim-treesitter` | ||||||
| require('nvim-treesitter.configs').setup { | require('nvim-treesitter.configs').setup { | ||||||
|   -- Add languages to be installed here that you want installed for treesitter |   -- Add languages to be installed here that you want installed for treesitter | ||||||
|  |  | ||||||
|  | @ -0,0 +1,56 @@ | ||||||
|  | print("hello from options.lua") | ||||||
|  | -- [[ Setting options ]] | ||||||
|  | -- See `:help vim.o` | ||||||
|  | -- See also https://vimdoc.sourceforge.net/htmldoc/options.html#'incsearch' | ||||||
|  | 
 | ||||||
|  | -- options | ||||||
|  | vim.o.hlsearch = false | ||||||
|  | vim.o.mouse = 'a' | ||||||
|  | vim.o.clipboard = 'unnamedplus' | ||||||
|  | vim.o.breakindent = true | ||||||
|  | vim.o.undofile = true | ||||||
|  | vim.o.ignorecase = true | ||||||
|  | vim.o.smartcase = true | ||||||
|  | vim.o.updatetime = 250 | ||||||
|  | vim.o.timeout = true | ||||||
|  | vim.o.timeoutlen = 300 | ||||||
|  | vim.o.completeopt = 'menuone,noselect' | ||||||
|  | vim.o.termguicolors = true | ||||||
|  | 
 | ||||||
|  | -- window-local options | ||||||
|  | vim.wo.conceallevel = 0 | ||||||
|  | vim.wo.cursorline = false | ||||||
|  | vim.wo.number = true | ||||||
|  | vim.wo.numberwidth = 4 | ||||||
|  | vim.wo.relativenumber = true | ||||||
|  | vim.wo.signcolumn = 'yes' | ||||||
|  | vim.wo.wrap = false | ||||||
|  | 
 | ||||||
|  | -- buffer-local options | ||||||
|  | vim.bo.autoindent = true | ||||||
|  | vim.bo.expandtab = true | ||||||
|  | vim.bo.fileencoding = "utf-8" | ||||||
|  | vim.bo.shiftwidth = 4 | ||||||
|  | vim.bo.smartindent = true | ||||||
|  | vim.bo.softtabstop = 2 | ||||||
|  | vim.bo.swapfile = false | ||||||
|  | vim.bo.syntax = "ON" | ||||||
|  | vim.bo.tabstop = 8 | ||||||
|  | 
 | ||||||
|  | -- global options | ||||||
|  | vim.g.background = 'dark' | ||||||
|  | vim.g.backup = true | ||||||
|  | vim.g.belloff = "all" | ||||||
|  | vim.g.cmdheight = 2 -- more space in the neovim command line for displaying messages | ||||||
|  | vim.g.compatible = false | ||||||
|  | vim.g.errorbells = false | ||||||
|  | vim.g.guifont = "monospace:h17" | ||||||
|  | vim.g.incsearch = true | ||||||
|  | vim.g.pumheight = 10 | ||||||
|  | vim.g.scrolloff = 5 | ||||||
|  | vim.g.showtabline = 2 | ||||||
|  | vim.g.sidescrolloff = 5 | ||||||
|  | vim.g.splitbelow = true | ||||||
|  | vim.g.splitright = true | ||||||
|  | vim.g.undodir = '~/.vim/undodir' | ||||||
|  | vim.g.writebackup = false | ||||||
		Loading…
	
		Reference in New Issue