moved config files to single location
This commit is contained in:
54
nvim/plugin/keymaps.lua
Normal file
54
nvim/plugin/keymaps.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
local set = vim.keymap.set
|
||||
|
||||
-- Prevent continue comment on new line
|
||||
vim.api.nvim_create_autocmd(
|
||||
"FileType",
|
||||
{ pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] }
|
||||
)
|
||||
vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*"
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- stay in indent mode only
|
||||
set("v", "<", "<gv")
|
||||
set("v", ">", ">gv")
|
||||
|
||||
-- Move lines by selecting
|
||||
set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Keep yaa head straight
|
||||
set("n", "<C-d>", "<C-d>zz")
|
||||
set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- Navigate with Netrw
|
||||
set("n", "<leader>n", vim.cmd.Ex, { desc = "Open [N]etrw" })
|
||||
-- Prime said this is greatest remap ever
|
||||
set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- Next greatest reamap
|
||||
set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
|
||||
set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
|
||||
set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
|
||||
set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
|
||||
|
||||
-- Disable arrow keys in normal mode
|
||||
set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
|
||||
set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
|
||||
set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
|
||||
set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
47
nvim/plugin/options.lua
Normal file
47
nvim/plugin/options.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
local opt = vim.opt
|
||||
|
||||
-- Use 4 space tabs
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
opt.breakindent = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- opt.list = true
|
||||
-- opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
-- Save undo history
|
||||
opt.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
opt.updatetime = 250
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
opt.inccommand = "split"
|
||||
|
||||
-- Show which line your cursor is on
|
||||
opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
opt.scrolloff = 10
|
||||
|
||||
-- line wrap settings
|
||||
vim.o.linebreak = true
|
||||
vim.o.wrap = true
|
||||
vim.o.breakindent = true
|
||||
vim.o.showbreak = "↳ "
|
||||
23
nvim/plugin/terminal.lua
Normal file
23
nvim/plugin/terminal.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local set = vim.opt_local
|
||||
|
||||
-- Set local settings for terminal buffers
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
group = vim.api.nvim_create_augroup("custom-term-open", {}),
|
||||
callback = function()
|
||||
set.number = false
|
||||
set.relativenumber = false
|
||||
set.scrolloff = 0
|
||||
end,
|
||||
})
|
||||
|
||||
-- Easily hit escape in terminal mode.
|
||||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||
|
||||
-- Open a terminal at the bottom of the screen with a fixed height.
|
||||
vim.keymap.set("n", "<leader>st", function()
|
||||
vim.cmd.new()
|
||||
vim.cmd.wincmd "J"
|
||||
vim.api.nvim_win_set_height(0, 12)
|
||||
vim.wo.winfixheight = true
|
||||
vim.cmd.term()
|
||||
end)
|
||||
Reference in New Issue
Block a user