Updated config

This commit is contained in:
2024-06-17 16:19:21 +02:00
parent cbc235c993
commit 33e490f05f
22 changed files with 59 additions and 135 deletions

View File

@ -56,17 +56,4 @@ on({ "VimEnter" }, {
require("telescope.builtin").find_files()
end
end,
})
-- on({ "VimEnter" }, {
-- desc = "Open file explorer if there is enough horizontal space",
-- group = group,
-- callback = function()
-- local files = require("nvim-tree.api")
-- local width = vim.go.columns
--
-- if width > 120 then
-- files.tree.toggle({ focus = false })
-- end
-- end,
-- })
})

View File

@ -1,12 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

View File

@ -2,47 +2,25 @@ local function map(mode, lhs, rhs, info)
vim.keymap.set(mode, lhs, rhs, { desc = info })
end
-- Basics
map("n", ";", ":", "Command mode")
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
map({"n", "v"}, "<leader>q", "<cmd>qa!<cr>", "Quit all")
-- Buffer management
map("n", "<C-t>", "<cmd>enew<cr>", "New file")
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr>", "Save file")
map("n", "U", "<cmd>redo<cr>", "Redo")
map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word")
map("n", "<C-q>", "<cmd>close<cr>", "Close window")
-- Copy and paste
map("v", "<C-c>", "y")
map("n", "<C-v>", '"+P<right>')
-- Editing lines
map({ "n", "v" }, "<C-b>", "^", "Beginning of line")
map("i", "<C-b>", "<esc>^i", "Beginning of line")
map({ "i", "n", "v" }, "<C-e>", "<end>", "End of line")
map("n", "<C-l>", "^Da", "Rewrite line")
map("i", "<C-l>", "<esc>^Da", "Rewrite line")
map("v", "<C-l>", "V", "Select line")
map("n", "<C-Enter>", "i<Enter>", "Split line")
map({"n", "v"}, "<C-a>", "<esc>ggVG", "Select all")
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
map({"n", "v"}, "<leader>q", "<cmd>qa!<cr>", "Quit all")
map({"n", "i"}, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
map({"n", "i", "s", "v"}, "<C-s>", "<cmd>w<cr>", "Save file")
-- Editing multiple instances
map("n", "<f2>", "*#:%s//<C-r><C-w>/g<left><left>", "Replace word under cursor")
map("v", "<f2>", "y/<C-r>\"<cr>N:%s//<C-r>\"/g<left><left>", "Replace selection")
map("n", "<f3>", "#*", "Search word under cursor")
map("v", "<f3>", "y/<C-r>\"<cr>N", "Search selection")
-- map("n", "<C-d>", "viw", "Select word under cursor")
-- map("v", "<C-d>", "y/<C-r>\"<cr>N", "Search selection")
map("n", "<C-r>", "*#:%s//<C-r><C-w>/g<left><left>", "Replace word under cursor")
map("v", "<C-r>", "y/<C-r>\"<cr>N:%s//<C-r>\"/g<left><left>", "Replace selection")
-- Editing words
map("n", "<C-w>", "ciw", "Rewrite word")
map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word")
-- Indenting
map("n", "<Tab>", "V>gv<esc>")
map("n", "<S-Tab>", "V<gv<esc>")
map("v", "<Tab>", ">gv")
map("v", "<S-Tab>", "<gv")
-- Line movement
map({"n", "v"}, "<C-b>", "^", "Beginning of line")
map("i", "<C-b>", "<esc>^i", "Beginning of line")
map({"i", "n", "v"}, "<C-e>", "<end>", "End of line")
-- Increasing and decreasing numbers
map("n", "+", "<C-a>", "Increase number")
@ -50,11 +28,11 @@ map("n", "-", "<C-x>", "Decrease number")
map("n", "<kPlus>", "<C-a>", "Increase number")
map("n", "<kMinus>", "<C-x>", "Decrease number")
-- Package manager
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
-- Redo
map("n", "U", "<cmd>redo<cr>", "Redo")
-- Indenting
map("n", "<Tab>", "V>gv<esc>")
map("n", "<S-Tab>", "V<gv<esc>")
map("v", "<Tab>", ">gv")
map("v", "<S-Tab>", "<gv")
-- Shift arrow selection
map("n", "<S-Up>", "v<Up>")
@ -76,4 +54,4 @@ map("i", "<S-Right>", "<Esc>v<Right>")
map("n", "<A-Up>", "<C-w>k", "Move to the window above")
map("n", "<A-Down>", "<C-w>j", "Move to the window below")
map("n", "<A-Left>", "<C-w>h", "Move to the window on the left")
map("n", "<A-Right>", "<C-w>l", "Move to the window on the right")
map("n", "<A-Right>", "<C-w>l", "Move to the window on the right")

View File

@ -1,3 +1,20 @@
-- Install the package manager if needed
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Load plugins
require("lazy").setup("plugins", {
defaults = {
lazy = true,
@ -46,4 +63,4 @@ require("lazy").setup("plugins", {
},
},
},
})
})

View File

@ -6,4 +6,4 @@ return {
{ "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" },
},
config = true,
}
}

View File

@ -2,4 +2,4 @@ return {
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = true,
}
}

View File

@ -1,20 +1,14 @@
return {
"nvim-telescope/telescope.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
-- "nvim-telescope/telescope-ui-select.nvim",
},
keys = {
{"<C-Tab>", "<cmd>Telescope buffers<cr>", desc = "Buffers"},
{"<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find files"},
{"<leader>h", "<cmd>Telescope help_tags<cr>", desc = "Help"},
{"<leader>p", "<cmd>Telescope project<cr>", desc = "Projects"},
{"<leader>r", "<cmd>Telescope oldfiles<cr>", desc = "Recent files"},
{"<leader>w", "<cmd>Telescope grep_string<cr>", desc = "Word"},
{"<leader>ds", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Document symbols"},
{"<leader>ws", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", desc = "Workspace symbols"},
},
config = function()
require("telescope").setup({
@ -36,14 +30,7 @@ return {
sync_with_nvim_tree = true,
theme = "dropdown",
},
-- ["ui-select"] = {
-- require("telescope.themes").get_dropdown(),
-- },
},
})
require("telescope").load_extension("project")
require("telescope").load_extension("notify")
-- require("telescope").load_extension("ui-select")
end,
}

View File

@ -4,30 +4,10 @@ return {
build = ":TSUpdate",
opts = {
ensure_installed = {
-- basics
"bash",
"json",
"markdown",
"markdown_inline",
"lua",
"regex",
"vim",
-- go
"go",
"gomod",
"gowork",
"gosum",
-- web dev
"html",
"css",
"javascript",
"typescript",
"svelte",
-- game dev
"gdscript",
},
highlight = { enable = true },
indent = { enable = true },

View File

@ -10,6 +10,7 @@ end
local opt = vim.opt
opt.autowrite = false
opt.clipboard = "unnamedplus"
opt.cmdheight = 0
opt.completeopt = "menu,menuone,noinsert"
opt.conceallevel = 0
opt.cursorline = true
@ -50,4 +51,4 @@ opt.statusline = "%{repeat('─',winwidth('.'))}"
-- Undo
opt.undofile = true
opt.undolevels = 10000
opt.undolevels = 10000