Compare commits

...

5 Commits

Author SHA1 Message Date
Ryan 6d0cbe06cc
Update treesitter
Signed-off-by: Ryan <ryan@alien.gov>
2023-12-10 11:05:26 +08:00
Ryan 8cd7b081ad
Update snippets
Signed-off-by: Ryan <ryan@alien.gov>
2023-12-09 20:07:47 +08:00
Ryan d73c69d8ff
chore(quickfix): Clean up, use nvim-bqf
Use nvim-bqf instead of trouble

Signed-off-by: Ryan <ryan@alien.gov>
2023-12-09 18:05:53 +08:00
Ryan 7ea7eaac8d
Add keybind for going to changed lines
Signed-off-by: Ryan <ryan@alien.gov>
2023-12-07 13:23:19 +08:00
Ryan fb0a07f68f
Update netrw
Signed-off-by: Ryan <ryan@alien.gov>
2023-12-05 21:47:57 +08:00
7 changed files with 161 additions and 95 deletions

View File

@ -1,6 +1,6 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "1def35377854535bb3b0f4cc7a33c083cdb12571" },
"LuaSnip": { "branch": "master", "commit": "954c81b53989097faaff0fabc11c29575288c3e1" },
"cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
@ -8,32 +8,32 @@
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" },
"dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"gitsigns.nvim": { "branch": "main", "commit": "87640f5a877b18bdd49884dbcac220fed924b867" },
"gruvbox-material": { "branch": "master", "commit": "7f56d9f9c4860df528031539d321a61f6e081dee" },
"killersheep.nvim": { "branch": "master", "commit": "506823c47b854df02e78d5fec9468ab0e542dcf5" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "41674c9d50f23cfa3e11f0ca964eb9100c2a8922" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" },
"mason-null-ls.nvim": { "branch": "main", "commit": "d1f7258f80867f718d643d88eee66959671a4bef" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
"neogit": { "branch": "master", "commit": "bb538f12fa032c97d4632a6df71d5e0704088139" },
"none-ls.nvim": { "branch": "main", "commit": "3a4826687da4310af379515086d71faca4d21288" },
"neogit": { "branch": "master", "commit": "857adaeef272af25361c1b57f1f4d829333213df" },
"none-ls.nvim": { "branch": "main", "commit": "45d0e8fa9094dcc3fabad9065a5822af9cf099c7" },
"nvim-bqf": { "branch": "main", "commit": "bdc2a4e5bb670b3c0e33ada9c0eec636d93a0748" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "fcf153fbbf1facd16a71d46b92be8be495123a9f" },
"nvim-treesitter": { "branch": "master", "commit": "93750d388162f5658cfdb77bdcfe80711e637647" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },
"plenary.nvim": { "branch": "master", "commit": "366b0837486f60ae0e7550c15de8ff66d057c4cd" },
"nvim-lspconfig": { "branch": "master", "commit": "bd405e45c5fb122c16af8f87fa2dd7ab1981b243" },
"nvim-treesitter": { "branch": "master", "commit": "7958ff9ec7a2baea2842323d0e7ac67a509da4d2" },
"nvim-treesitter-context": { "branch": "master", "commit": "cfa8ee19ac9bae9b7fb2958eabe2b45b70c56ccb" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
"nvim-web-devicons": { "branch": "master", "commit": "8b2e5ef9eb8a717221bd96cb8422686d65a09ed5" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"rainbow_csv.nvim": { "branch": "main", "commit": "a520dabf1c74d7d7d8341dd3f3570063ef51b3aa" },
"range-highlight.nvim": { "branch": "master", "commit": "8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "3b8c8b153b54b2cb86dc6fcc547264a84c31f775" },
"vim-matchup": { "branch": "master", "commit": "269f9bea87e20a01438085eb13df539929a12727" },
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" }

View File

@ -4,16 +4,17 @@ local global = vim.g
local map = vim.keymap.set
-- look and feel
global.netrw_banner = 0
global.netrw_bufsettings = "noma nomod relativenumber nowrap ro nobl"
global.netrw_liststyle = 3
global.netrw_winsize = 25
o.number = true
o.relativenumber = true
o.ruler = true
o.scrolloff = 10
o.showmode = false
o.spell = true
if vim.fn.has("termguicolors") == 1 then
o.termguicolors = true
end
o.termguicolors = true
o.title = true
-- controlling
global.mapleader = ' '

View File

@ -47,23 +47,26 @@ local plugins = {
{
"nvim-treesitter/nvim-treesitter",
lazy = true,
config = function()
require("plugins.treesitter")
end,
build = ":TSUpdate"
},
{
"nvim-treesitter/nvim-treesitter-context",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
"nvim-treesitter/nvim-treesitter-context",
"nvim-treesitter/nvim-treesitter-textobjects"
}
},
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
lazy = true
config = function()
require("luasnip").setup()
require("luasnip.loaders.from_vscode").lazy_load()
end,
lazy = true,
-- install jsregexp (optional!).
build = "make install_jsregexp"
},
{
"hrsh7th/nvim-cmp",
@ -85,17 +88,6 @@ local plugins = {
require("plugins/cmp")
end
},
{
"Dynge/gitmoji.nvim",
ft = { "gitcommit", "NeogitCommitMessage" },
opts = {
filetypes = { "gitcommit", "octo", "NeogitCommitMessage" },
completion = {
append_space = true,
},
},
dependencies = "hrsh7th/nvim-cmp"
},
{
"hrsh7th/cmp-nvim-lsp",
event = { "BufReadPre", "BufNewFile" },
@ -157,36 +149,16 @@ local plugins = {
vim.keymap.set('', '<leader>tb', ':Telescope buffers<cr>'),
vim.keymap.set('', '<leader>tf', ':Telescope fd<cr>'),
},
config = function()
require("plugins.telescope")
end
opts = {
defaults = {
layout_strategy = 'flex',
layout_config = { flex = { flip_columns = 144 } },
},
},
},
{
"folke/trouble.nvim",
lazy = true,
keys = {
vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end),
vim.keymap.set("n", "<leader>xw",
function() require("trouble").toggle("workspace_diagnostics") end),
vim.keymap.set("n", "<leader>xd",
function() require("trouble").toggle("document_diagnostics") end),
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end),
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end),
-- lsp
vim.keymap.set("n", "<leader>gr", function()
require("trouble").toggle("lsp_references")
end),
vim.keymap.set('n', '<leader>D', function()
require("trouble").toggle("lsp_type_definitions")
end),
vim.keymap.set('n', 'gd', function()
require("trouble").toggle("lsp_definitions")
end),
vim.keymap.set('n', '<leader>gi', function()
require("trouble").toggle("lsp_implementations")
end),
},
dependencies = { "nvim-tree/nvim-web-devicons" },
'kevinhwang91/nvim-bqf',
ft = 'qf'
},
{
"danymat/neogen",
@ -252,6 +224,28 @@ local plugins = {
{
"lewis6991/gitsigns.nvim",
event = "BufEnter",
lazy = true,
keys = {
-- View changed in git
vim.keymap.set('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function()
require("gitsigns").next_hunk()
end)
return '<Ignore>'
end, { expr = true }),
vim.keymap.set('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function()
require("gitsigns").prev_hunk()
end)
return '<Ignore>'
end, { expr = true }),
vim.keymap.set("n", "<leader>hp",
function() require("gitsigns").preview_hunk() end)
},
opts = {
signcolumn = false,
numhl = true,

View File

@ -28,6 +28,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set('n', '<leader>fm', function()
vim.lsp.buf.format { async = true }
end, opts)
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<leader>gi', vim.lsp.buf.implementation, opts)
end,
})

View File

@ -1,10 +0,0 @@
-- require'colorizer'.setup ({
-- '*',
-- css = {
-- css = true, -- CSS rgb() and rgba() functions
-- css_fn = true -- CSS hsl() and hsla() functions
-- },
-- html = {names = false} -- Disable parsing "names" like Blue or Gray
-- })
require 'colorizer'.setup()

View File

@ -1,12 +0,0 @@
local trouble = require("trouble.providers.telescope")
require('telescope').setup {
defaults = { layout_strategy = 'flex',
layout_config = { flex = { flip_columns = 144 } },
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
}

View File

@ -1,13 +1,102 @@
require("nvim-treesitter.configs").setup({
ensure_installed = { "lua" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = {
"lua",
"gitignore",
"gitattributes",
"gitcommit",
"git_config",
"git_rebase",
"vim",
"vimdoc",
"query"
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
highlight = {
enable = true, -- false will disable the whole extension
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = true,
use_languagetree = true,
enable = true, -- false will disable the whole extension
additional_vim_regex_highlighting = true, -- git commit, etc.
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
},
indent = { enable = true },
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
-- You can optionally set descriptions to the mappings (used in the desc parameter of
-- nvim_buf_set_keymap) which plugins like which-key display
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
-- You can also use captures from other query groups like `locals.scm`
["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
-- If you set this to `true` (default is `false`) then any textobject is
-- extended to include preceding or succeeding whitespace. Succeeding
-- whitespace has priority in order to act similarly to eg the built-in
-- `ap`.
--
-- Can also be a function which gets passed a table with the keys
-- * query_string: eg '@function.inner'
-- * selection_mode: eg 'v'
-- and should return true of false
include_surrounding_whitespace = true,
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = { query = "@class.outer", desc = "Next class start" },
["]o"] = "@loop.*",
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
-- Below will go to either the start or the end, whichever is closer.
-- Use if you want more granular movements
-- Make it even more gradual by adding multiple queries and regex.
goto_next = {
["]d"] = "@conditional.outer",
},
goto_previous = {
["[d"] = "@conditional.outer",
}
},
},
})
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
-- Repeat movement with ; and ,
-- vim way: ; goes to the direction you were moving.
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)