recovering custom nvim configs
This commit is contained in:
parent
0622ef41cd
commit
ebb0a5aeed
11 changed files with 340 additions and 5 deletions
2
after/plugin/defaults.lua
Normal file
2
after/plugin/defaults.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require("rahcodes.remap")
|
||||
require("rahcodes.sets")
|
||||
21
after/plugin/fugitive.lua
Normal file
21
after/plugin/fugitive.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
vim.keymap.set("n", "<leader>gs", ":G<CR>")
|
||||
vim.keymap.set("n", "<leader>gh", ":diffget //3<CR>")
|
||||
vim.keymap.set("n", "<leader>gu", ":diffget //2<CR>")
|
||||
vim.keymap.set("n", "<leader>gc", ":GCheckout<CR>")
|
||||
vim.keymap.set("n", "<leader>ga", ":G add %:p<CR><CR>")
|
||||
vim.keymap.set("n", "<leader>gc", ":G commit -v -q<CR>")
|
||||
vim.keymap.set("n", "<leader>gt", ":G commit -v -q %:p<CR>")
|
||||
vim.keymap.set("n", "<leader>gff", ":G ff<CR>")
|
||||
vim.keymap.set("n", "<leader>gfo", ":G fetch origin<CR>")
|
||||
vim.keymap.set("n", "<leader>gd", ":Gdiff<CR>")
|
||||
vim.keymap.set("n", "<leader>ge", ":Gedit<CR>")
|
||||
vim.keymap.set("n", "<leader>gr", ":Gread<CR>")
|
||||
vim.keymap.set("n", "<leader>grb", ":G rebase -i<CR>")
|
||||
vim.keymap.set("n", "<leader>gw", ":Gwrite<CR><CR>")
|
||||
vim.keymap.set("n", "<leader>gl", ":silent! Glog<CR>:bot copen<CR>")
|
||||
vim.keymap.set("n", "<leader>gp", ":Ggrep<Space>")
|
||||
vim.keymap.set("n", "<leader>gm", ":Gmove<Space>")
|
||||
vim.keymap.set("n", "<leader>gbl", ":G blame<CR>")
|
||||
vim.keymap.set("n", "<leader>go", ":G checkout<Space>")
|
||||
vim.keymap.set("n", "<leader>gps", ":Dispatch! git push<CR>")
|
||||
vim.keymap.set("n", "<leader>gpl", ":Dispatch! git pull<CR>")
|
||||
22
after/plugin/git-worktree.lua
Normal file
22
after/plugin/git-worktree.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local Worktree = require("git-worktree")
|
||||
|
||||
-- op = Operations.Switch, Operations.Create, Operations.Delete
|
||||
-- metadata = table of useful values (structure dependent on op)
|
||||
-- Switch
|
||||
-- path = path you switched to
|
||||
-- prev_path = previous worktree path
|
||||
-- Create
|
||||
-- path = path where worktree created
|
||||
-- branch = branch name
|
||||
-- upstream = upstream remote name
|
||||
-- Delete
|
||||
-- path = path where worktree deleted
|
||||
|
||||
Worktree.on_tree_change(function(op, metadata)
|
||||
if op == Worktree.Operations.Switch then
|
||||
print("Switched from " .. metadata.prev_path .. " to " .. metadata.path)
|
||||
end
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>bw", require("telescope").extensions.git_worktree.git_worktrees, { desc = "[B]rowse Git Worktrees" })
|
||||
vim.keymap.set("n", "<leader>cw", require("telescope").extensions.git_worktree.create_git_worktree, { desc = "[C]reate Git [W]orktree" })
|
||||
13
after/plugin/lualine.lua
Normal file
13
after/plugin/lualine.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "tokyonight",
|
||||
tabline = {
|
||||
lualine_a = { "buffers" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { "tabs" },
|
||||
},
|
||||
},
|
||||
})
|
||||
75
after/plugin/null-ls.lua
Normal file
75
after/plugin/null-ls.lua
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
local setup, null_ls = pcall(require, "null-ls")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local conditional = function(fn)
|
||||
local utils = require("null-ls.utils").make_conditional_utils()
|
||||
return fn(utils)
|
||||
end
|
||||
|
||||
local lsp_formatting = function(bufnr)
|
||||
vim.lsp.buf.format({
|
||||
timeout_ms = 2000,
|
||||
filter = function(client)
|
||||
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
||||
return client.name ~= "tsserver"
|
||||
end,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
-- local my_rubocop_formatter = require("rahcodes.null-ls.rubocop")
|
||||
local rubocop = null_ls.builtins.formatting.rubocop
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.prettier,
|
||||
-- formatting.stylua,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
-- setting eslint_d only if we have a ".eslintrc.js" file in the project
|
||||
diagnostics.eslint_d.with({
|
||||
condition = function(utils)
|
||||
return utils.root_has_file({ '.eslintrc.js' })
|
||||
end
|
||||
}),
|
||||
|
||||
-- Here we set a conditional to call the rubocop formatter. If we have a Gemfile in the project, we call "bundle exec rubocop", if not we only call "rubocop".
|
||||
conditional(function(utils)
|
||||
return utils.root_has_file("Gemfile")
|
||||
and rubocop.with({
|
||||
command = "bundle",
|
||||
args = vim.list_extend({ "exec", "rubocop" }, rubocop._opts.args),
|
||||
})
|
||||
or rubocop
|
||||
end),
|
||||
|
||||
-- Same as above, but with diagnostics.rubocop to make sure we use the proper rubocop version for the project
|
||||
conditional(function(utils)
|
||||
return utils.root_has_file("Gemfile")
|
||||
and null_ls.builtins.diagnostics.rubocop.with({
|
||||
command = "bundle",
|
||||
args = vim.list_extend({ "exec", "rubocop" }, null_ls.builtins.diagnostics.rubocop._opts.args),
|
||||
})
|
||||
or null_ls.builtins.diagnostics.rubocop
|
||||
end),
|
||||
},
|
||||
-- format on save
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
lsp_formatting(bufnr)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
2
after/plugin/telescope.lua
Normal file
2
after/plugin/telescope.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
pcall(require("telescope").load_extension, "ui-select")
|
||||
pcall(require("telescope").load_extension, "live_grep_args")
|
||||
Loading…
Add table
Add a link
Reference in a new issue