From d07758bb0b2914fa28532a8c08bb62054295a9c2 Mon Sep 17 00:00:00 2001 From: Justin Bird Date: Sun, 22 Oct 2023 19:31:54 -0700 Subject: [PATCH] moved vim options to separate file --- init.lua | 50 ++++---------------------------- lazy-lock.json | 27 ++++++++++++++++++ lua/custom/init.lua | 2 ++ lua/custom/options.lua | 65 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 44 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/custom/init.lua create mode 100644 lua/custom/options.lua diff --git a/init.lua b/init.lua index a7667ddc..e8f6ff11 100644 --- a/init.lua +++ b/init.lua @@ -232,45 +232,7 @@ require('lazy').setup({ -- [[ 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 - --- 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 - +require('custom') -- [[ Basic Keymaps ]] -- Keymaps for better default experience @@ -319,11 +281,11 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'ff', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set({'n', 'v'}, '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..b9018038 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,27 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "gitsigns.nvim": { "branch": "main", "commit": "5a9a6ac29a7805c4783cda21b80a1e361964b3f2" }, + "indent-blankline.nvim": { "branch": "master", "commit": "8a7b48f5823cc924f815129192288ec2e2b9288f" }, + "lazy.nvim": { "branch": "main", "commit": "9788a19ec0b4036028e78aec702634b4b89d3470" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "09be3766669bfbabbe2863c624749d8da392c916" }, + "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, + "neodev.nvim": { "branch": "main", "commit": "b094a663ccb71733543d8254b988e6bebdbdaca4" }, + "nvim-cmp": { "branch": "main", "commit": "d3a3056204e1a9dbb7c7fe36c114dc43b681768c" }, + "nvim-lspconfig": { "branch": "master", "commit": "38da5bbe1eaab2394056109e48c7e195bdb8fdfe" }, + "nvim-treesitter": { "branch": "master", "commit": "6cb93819c9d7107f5e1ff704eb35d230858ec698" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "eb208bfdfcf76efea0424747e23e44641e13aaa6" }, + "onedark.nvim": { "branch": "master", "commit": "b9acd92ded2ba155867ca5af9d618e933d96e3b0" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 00000000..b7031bea --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1,2 @@ +require("custom.options") +require("custom.keymap") diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 00000000..24d40a66 --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,65 @@ +-- [[ Setting options ]] +-- See `:help vim.o` +-- NOTE: You can change these options as you wish! + +-- Search options +vim.opt.hlsearch = false +vim.opt.incsearch = true -- show matching in file as it is typed + +-- Make line numbers default, and use relative line numbers +vim.opt.number = true +vim.opt.relativenumber = true + +-- Set tab and indent options +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.cindent = true -- C programming smart indents +vim.opt.smartindent = true -- like cindent, but works for other languages + +-- Wrap lines wider than the width of the window. Visual only, doesn't change text in buffer +vim.opt.wrap = false +-- vim.o.breakindent = true -- wrapped lines will continue visually indented + +-- Enable mouse mode +vim.opt.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' + +-- Save undo history +vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" + +-- Decrease update time +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 + +-- Case-insensitive searching UNLESS \C or capital in search +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default @todo: figure out what this is +vim.opt.signcolumn = 'yes' + +-- Set completeopt to have a better completion experience +vim.opt.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.opt.termguicolors = true + +-- Don't use a buffer swapfile or make backup before overwritting +vim.opt.swapfile = false +vim.opt.backup = false + +-- Minimum number of lines to scroll when the cursor gets off the screen +vim.opt.scrolloff = 8 + +-- Not sure what this does - took from primeagon setup +vim.opt.isfname:append("@-@") + +-- Set visual column at 100 spaces +vim.opt.colorcolumn = "100"