From 84782e1599a99d347a4c74a981fde96e816b8d2f Mon Sep 17 00:00:00 2001 From: Shadow Cat Date: Tue, 20 Jun 2023 15:06:30 -0400 Subject: [PATCH] ascension (re enable primary c+p, treesitter textobjects --- init.lua | 1 + lua/config/filetype.lua | 5 +++ lua/config/lsp-settings.lua | 6 ++- lua/config/mappings.lua | 4 -- lua/config/reload.lua | 1 + lua/config/settings.lua | 7 ++++ lua/config/theme.lua | 25 +++++-------- lua/plugins/dev.lua | 36 ++++++++++++++++++ lua/plugins/lsp.lua | 24 ------------ lua/plugins/lspconfig.lua | 1 + lua/plugins/visual.lua | 74 ++++++++++++++++++++++++++++++------- 11 files changed, 126 insertions(+), 58 deletions(-) create mode 100644 lua/config/filetype.lua create mode 100644 lua/plugins/dev.lua delete mode 100644 lua/plugins/lsp.lua diff --git a/init.lua b/init.lua index b960a60..33f4133 100644 --- a/init.lua +++ b/init.lua @@ -4,4 +4,5 @@ for _, name in ipairs({ "mappings", "plugins", "theme", + "filetype", }) do require("config." .. name) end diff --git a/lua/config/filetype.lua b/lua/config/filetype.lua new file mode 100644 index 0000000..bfeb9c3 --- /dev/null +++ b/lua/config/filetype.lua @@ -0,0 +1,5 @@ +vim.filetype.add({ + extension = { + wgsl = 'wgsl', + }, +}) diff --git a/lua/config/lsp-settings.lua b/lua/config/lsp-settings.lua index c3fe6f7..6335a12 100644 --- a/lua/config/lsp-settings.lua +++ b/lua/config/lsp-settings.lua @@ -11,6 +11,7 @@ vim.api.nvim_create_autocmd('LspAttach', { end local builtin = require('telescope.builtin') + local dap = require('dap') map("gd", builtin.lsp_definitions) map("gr", builtin.lsp_references) @@ -28,9 +29,12 @@ vim.api.nvim_create_autocmd('LspAttach', { end) map("D", vim.lsp.buf.type_definition) map("rn", vim.lsp.buf.rename) - map("ca", vim.lsp.buf.code_action) + map("a", vim.lsp.buf.code_action) map("fm", function() vim.lsp.buf.format { async = true } end) + map("da", dap.toggle_breakpoint) + map("dc", dap.continue) + map("ds", dap.step_into) end }) diff --git a/lua/config/mappings.lua b/lua/config/mappings.lua index 65ed608..d766a5f 100644 --- a/lua/config/mappings.lua +++ b/lua/config/mappings.lua @@ -8,10 +8,6 @@ local l = "o" local m = u.mapping --- terminal copy paste -m.map("v", "", '"+y') -m.map("i", "", '"+p`]a') - -- terminal m.map("t", "", "") m.map("t", "", "") diff --git a/lua/config/reload.lua b/lua/config/reload.lua index f81adef..cc0e16a 100644 --- a/lua/config/reload.lua +++ b/lua/config/reload.lua @@ -11,4 +11,5 @@ for _, mod in ipairs({ "utils", "theme", "lsp-settings", + "filetype", }) do u.mod_post_write(g, "config." .. mod, u.reload) end diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 5124a94..8d87121 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -4,11 +4,13 @@ local g = vim.g -- basic stuff o.number = true o.showmode = false +o.clipboard = "unnamedplus" g.mapleader = " " g.maplocalleader = "," vim.cmd("filetype plugin on") vim.cmd("syntax on") +o.guifont = "Comic\\ Code\\ Ligatures" -- line break (wrapping) settings o.linebreak = true @@ -40,3 +42,8 @@ end vim.diagnostic.config({ virtual_text = { prefix = "●" }, }) + +-- neovide +if vim.g.neovide then + +end diff --git a/lua/config/theme.lua b/lua/config/theme.lua index 8d323ce..52d8235 100644 --- a/lua/config/theme.lua +++ b/lua/config/theme.lua @@ -9,22 +9,15 @@ end hl("ExtraWhitespace", { ctermbg = "red", bg = "#ff8888" }) vim.cmd [[match ExtraWhitespace /\s\+$/]] -local bg = "#201918" +-- make background partially transparent + +-- local bg = "#1e1e2e" +-- local bg2 = "#181825" --- make background transparent -- gbhl("Normal", "none") --- gbhl("EndOfBuffer", "none") --- gbhl("SignColumn", "none") --- gbhl("NeoTreeEndOfBuffer", "none") +-- gbhl("NormalNC", "none") +-- gbhl("MsgArea", bg) +-- gbhl("NeoTreeNormal", bg) +-- gbhl("NeoTreeNormalNC", bg) +-- hl("VertSplit", { bg = bg2, fg = bg2 }) ---[=[ -for _, name in ipairs({ - "NeoTreeNormal", - "NeoTreeNormalNC", - "MsgArea", - "lualine_a_command", - "lualine_a_inactive", - "lualine_b_inactive", - "lualine_c_inactive", -}) do gbhl(name, bg) end -]=]-- diff --git a/lua/plugins/dev.lua b/lua/plugins/dev.lua new file mode 100644 index 0000000..91dc014 --- /dev/null +++ b/lua/plugins/dev.lua @@ -0,0 +1,36 @@ +local rt_config = function() + local rt = require "rust-tools" + rt.setup { + server = { + -- on_attach = function(_, bufnr) + -- vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) + -- end + } + } +end +return { + { + "simrat39/rust-tools.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "mfussenegger/nvim-dap", + }, + config = rt_config + }, + { + "windwp/nvim-autopairs", + config = function() require "nvim-autopairs".setup {} end + }, + { + "scalameta/nvim-metals", + dependencies = { "nvim-lua/plenary.nvim" } + }, + { + "numToStr/Comment.nvim", + config = function() require "Comment".setup {} end + }, + "mfussenegger/nvim-jdtls", + "mfussenegger/nvim-dap", + "folke/neodev.nvim", +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua deleted file mode 100644 index 9300ca7..0000000 --- a/lua/plugins/lsp.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - { - "simrat39/rust-tools.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "mfussenegger/nvim-dap", - }, - config = function() require "rust-tools".setup {} end - }, - { - "windwp/nvim-autopairs", - config = function() require "nvim-autopairs".setup {} end - }, - { - "scalameta/nvim-metals", - dependencies = { "nvim-lua/plenary.nvim" } - }, - { - "numToStr/Comment.nvim", - config = function() require "Comment".setup{} end - }, - "mfussenegger/nvim-jdtls", - "folke/neodev.nvim", -} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 30fdf5b..513090b 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -48,6 +48,7 @@ local config = function() } } } + c.wgsl_analyzer.setup {} require 'config.lsp-settings' end diff --git a/lua/plugins/visual.lua b/lua/plugins/visual.lua index 6cf4454..7226bb6 100644 --- a/lua/plugins/visual.lua +++ b/lua/plugins/visual.lua @@ -10,14 +10,6 @@ return { require("config.theme") end }, - { - "norcalli/nvim-colorizer.lua", - config = function() - if vim.o.termguicolors then - require("colorizer").setup() - end - end - }, { "nvim-lualine/lualine.nvim", dependencies = { "kyazdani42/nvim-web-devicons" }, @@ -29,6 +21,14 @@ return { } end }, + { + "norcalli/nvim-colorizer.lua", + config = function() + if vim.o.termguicolors then + require("colorizer").setup() + end + end + }, { "lewis6991/gitsigns.nvim", config = function() @@ -37,6 +37,59 @@ return { }) end }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + lazy = false, + enabled = true, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + config = function() + require("nvim-treesitter.configs").setup { + highlight = { enable = true }, + textobjects = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]f"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]F"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + swap = { + enable = true, + swap_next = { + ["so"] = "@parameter.inner", + }, + swap_previous = { + ["sn"] = "@parameter.inner", + }, + }, + + }, + } + end + }, { "nvim-treesitter/nvim-treesitter", build = function() @@ -44,11 +97,6 @@ return { with_sync = true } end, - config = function() - require("nvim-treesitter.configs").setup { - highlight = { enable = true } - } - end, }, "elkowar/yuck.vim", "kmonad/kmonad-vim"