Updated config

This commit is contained in:
Eduard Urbach 2024-01-22 15:04:33 +01:00
parent 4e74495124
commit 8998a54e82
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
12 changed files with 138 additions and 13 deletions

View File

@ -1,20 +1,20 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"gitsigns.nvim": { "branch": "main", "commit": "c5ff7628e19a47ec14d3657294cc074ecae27b99" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"neodev.nvim": { "branch": "main", "commit": "aaeb44589cab39c2545a328661af355622d68479" },
"mini.completion": { "branch": "main", "commit": "3469773c1280a962bff89c06278007e8aaa30eb5" },
"multiple-cursors.nvim": { "branch": "main", "commit": "9f41d2991f36e3558a83760fba8eb94529c68ea6" },
"neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" },
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" },
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
"nvim-tree.lua": { "branch": "master", "commit": "7bdb220d0fe604a77361e92cdbc7af1b8a412126" },
"nvim-treesitter": { "branch": "master", "commit": "e0420e73c9cf4a9fe49d576be313718831a3822d" },
"nvim-treesitter": { "branch": "master", "commit": "97997c928bb038457f49343ffa5304d931545584" },
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
"onedark.nvim": { "branch": "master", "commit": "dc3bad0121298f89b50aaff8599d1946e07eb4c2" },
"onedark.nvim": { "branch": "master", "commit": "14e5de43cf1ff761c280d1ff5b9980897f5b46c7" },
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" },
"telescope-project.nvim": { "branch": "master", "commit": "1aaf16580a614601a7f7077d9639aeb457dc5559" },
"telescope.nvim": { "branch": "master", "commit": "0902bb39ebaf76e655addc65130eb79b29abe6d2" }
"telescope.nvim": { "branch": "master", "commit": "20efb3864903fb854a85faf57513ffd80582275b" }
}

View File

@ -13,3 +13,23 @@ on({ "BufNewFile", "BufRead" }, {
vim.opt_local.signcolumn = "no"
end,
})
on({ "VimEnter" }, {
callback = function()
-- Switch to root directory of the project
local root_patterns = { ".git", "go.mod", "init.lua" }
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1])
if root_dir then
vim.api.nvim_set_current_dir(root_dir)
end
-- Open file explorer if we have enough space
local files = require("nvim-tree.api")
local width = vim.go.columns
if width > 120 then
files.tree.toggle({ focus = false })
end
end,
})

View File

@ -8,8 +8,6 @@ map("n", "qq", "<cmd>qa!<cr>", "Quit all")
map("n", "U", "<cmd>redo<cr>", "Redo")
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
map("n", "<C-q>", "<cmd>bd<cr>", "Delete buffer")
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
map("n", "<C-l>", "^Da", "Rewrite line")
map("i", "<C-l>", "<esc>^Da", "Rewrite line")
map("n", "<C-a>", "ggVG", "Select all")
@ -18,10 +16,34 @@ 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")
-- Buffer management
map("n", "<C-n>", "<cmd>enew<cr>", "New file")
map("n", "<C-q>", "<cmd>bd<cr>", "Delete buffer")
-- Copy and paste
map("v", "<C-c>", "y")
map("n", "<C-v>", '"+p')
-- Indenting
map("v", "<", "<gv")
map("v", ">", ">gv")
-- Shift arrow selection
map("n", "<S-Up>", "v<Up>")
map("n", "<S-Down>", "v<Down>")
map("n", "<S-Left>", "v<Left>")
map("n", "<S-Right>", "v<Right>")
map("v", "<S-Up>", "<Up>")
map("v", "<S-Down>", "<Down>")
map("v", "<S-Left>", "<Left>")
map("v", "<S-Right>", "<Right>")
map("i", "<S-Up>", "<Esc>v<Up>")
map("i", "<S-Down>", "<Esc>v<Down>")
map("i", "<S-Left>", "<Esc>v<Left>")
map("i", "<S-Right>", "<Esc>v<Right>")
-- LSP
map("n", "gr", vim.lsp.buf.references, "References")
map("n", "gd", vim.lsp.buf.definition, "Definition")

View File

@ -11,6 +11,7 @@ local opt = vim.opt
opt.autoindent = true
opt.autowrite = false
opt.clipboard = "unnamedplus"
opt.completeopt = "menu,menuone,noinsert"
opt.conceallevel = 0
opt.cursorline = true
opt.cursorlineopt = "number"
@ -18,11 +19,12 @@ opt.expandtab = false
opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --grep"
opt.ignorecase = false
opt.linespace = 0
opt.mouse = "a"
opt.ruler = false
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.shiftwidth = 4
opt.shortmess:append "sCFI"
opt.shortmess:append "scCFI"
opt.showmode = false
opt.showtabline = 0
opt.smartindent = true
@ -35,7 +37,9 @@ opt.termguicolors = true
opt.undofile = true
opt.undolevels = 10000
opt.updatetime = 250
opt.virtualedit = "onemore"
opt.wildmode = "longest:full,full"
opt.winblend = 10
opt.wrap = false
-- UI
@ -45,3 +49,10 @@ opt.number = true
opt.relativenumber = false
opt.signcolumn = "number"
opt.statusline = "%{repeat('─',winwidth('.'))}"
-- Neovide
if g.neovide then
g.neovide_fullscreen = true
g.neovide_transparency = 0.9
vim.o.guifont = "UbuntuMono Nerd Font:h20"
end

View File

@ -1,8 +1,17 @@
return {
"numToStr/Comment.nvim",
keys = {
{"<C-_>", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", desc = "Toggle comment"},
{"<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", mode = "v", desc = "Toggle comment"},
{
"<C-/>",
"<cmd>lua require('Comment.api').toggle.linewise.current()<cr>",
desc = "Toggle comment",
},
{
"<C-/>",
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
mode = "v",
desc = "Toggle comment",
},
},
config = true,
opts = {

View File

@ -0,0 +1,8 @@
return {
"echasnovski/mini.completion",
event = "InsertEnter",
opts = {
set_vim_settings = false,
},
config = true,
}

View File

@ -0,0 +1,14 @@
return {
"brenton-leighton/multiple-cursors.nvim",
event = "VeryLazy",
keys = {
{"<C-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = {"n", "i"}},
{"<C-j>", "<Cmd>MultipleCursorsAddDown<CR>"},
{"<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = {"n", "i"}},
{"<C-k>", "<Cmd>MultipleCursorsAddUp<CR>"},
{"<C-LeftMouse>", "<Cmd>MultipleCursorsMouseAddDelete<CR>", mode = {"n", "i"}},
{"<Leader>a", "<Cmd>MultipleCursorsAddBySearch<CR>", mode = {"n", "x"}},
{"<Leader>A", "<Cmd>MultipleCursorsAddBySearchV<CR>", mode = {"n", "x"}},
},
config = true,
}

View File

@ -4,7 +4,7 @@ return {
priority = 1000,
opts = {
style = "dark",
transparent = true,
--transparent = true,
term_colors = true,
highlights = {
["StatusLine"] = {fg = "$bg3", bg = "Normal"},

View File

@ -12,6 +12,14 @@ return {
},
config = function()
require("telescope").setup({
defaults = {
mappings = {
i = {
["<esc>"] = require("telescope.actions").close,
},
},
winblend = 10,
},
extensions = {
project = {
base_dirs = {

View File

@ -1,3 +1,34 @@
local function on_attach(bufnr)
local api = require("nvim-tree.api")
-- default mappings
api.config.mappings.default_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- navigation
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Enter>", api.tree.change_root_to_node, opts("Enter"))
-- open folders with a single click
vim.keymap.set("n", "<LeftRelease>", function()
vim.defer_fn(function ()
local win = vim.api.nvim_get_current_win()
local view = require("nvim-tree.view")
if view.get_winnr() ~= win then return end
api.node.open.edit()
api.tree.focus()
-- local node = api.tree.get_node_under_cursor()
-- if node.nodes ~= nil then
-- api.node.open.edit()
-- end
end, 10)
end, opts("Open folder/file"))
end
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
@ -14,6 +45,7 @@ return {
filters = {
dotfiles = false,
},
on_attach = on_attach,
renderer = {
root_folder_label = false,
highlight_git = true,

View File

@ -29,6 +29,7 @@
"godot_tools.gdscript_lsp_server_port": 6005,
"godot_tools.editor_path": "/usr/bin/godot",
"security.workspace.trust.enabled": false,
"svelte.enable-ts-plugin": true,
"telemetry.telemetryLevel": "off",
"window.menuBarVisibility": "hidden",
"window.zoomLevel": 1,
@ -39,5 +40,5 @@
"workbench.iconTheme": "material-icon-theme",
"workbench.layoutControl.enabled": false,
"workbench.startupEditor": "none",
"workbench.statusBar.visible": false
"workbench.statusBar.visible": false,
}