File structure change
- Create config directory for vim options and keymaps - update import in init.lua
This commit is contained in:
parent
37107fb8e6
commit
5e9e40c978
5 changed files with 4 additions and 5 deletions
2
lua/custom/config/init.lua
Normal file
2
lua/custom/config/init.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require("options")
|
||||
require("keymaps")
|
||||
43
lua/custom/config/keymaps.lua
Executable file
43
lua/custom/config/keymaps.lua
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
-- Nop overrides
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
-- Open explorer
|
||||
vim.keymap.set("n", "<leader>fv", vim.cmd.Ex)
|
||||
|
||||
-- Allow moving lines or blocks
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Handle positioning cusor in window while scrolling
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
|
||||
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { 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 })
|
||||
65
lua/custom/config/options.lua
Normal file
65
lua/custom/config/options.lua
Normal file
|
|
@ -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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue