fix up broken junk and snippets

This commit is contained in:
Rahsheen Porter 2024-03-03 21:44:34 -05:00
parent afcf119fb8
commit b88bb9ed6e
6 changed files with 193 additions and 184 deletions

View File

@ -1,13 +0,0 @@
require("lualine").setup({
options = {
theme = "tokyonight",
tabline = {
lualine_a = { "buffers" },
lualine_b = { "branch" },
lualine_c = { "filename" },
lualine_x = {},
lualine_y = {},
lualine_z = { "tabs" },
},
},
})

View File

@ -1,75 +1,75 @@
local setup, null_ls = pcall(require, "null-ls")
local setup, null_ls = pcall(require, 'null-ls')
if not setup then
return
return
end
local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
-- local diagnostics = null_ls.builtins.diagnostics
local conditional = function(fn)
local utils = require("null-ls.utils").make_conditional_utils()
return fn(utils)
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,
})
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 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
}),
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', '.eslintrc.js', '.eslintrc.json' }
-- 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),
-- 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,
})
-- 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,
}

View File

@ -1,2 +0,0 @@
pcall(require("telescope").load_extension, "ui-select")
pcall(require("telescope").load_extension, "live_grep_args")

View File

@ -652,7 +652,7 @@ require('lazy').setup {
-- you can use this plugin to help you. It even has snippets
-- for various frameworks/libraries/etc. but you will have to
-- set up the ones that are useful for you.
-- 'rafamadriz/friendly-snippets',
'rafamadriz/friendly-snippets',
},
config = function()
-- See `:help cmp`
@ -806,7 +806,7 @@ require('lazy').setup {
-- Here are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug',
require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
@ -814,7 +814,7 @@ require('lazy').setup {
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}
-- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -1,68 +1,80 @@
return {
{
"ThePrimeagen/refactoring.nvim",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("refactoring").setup({})
end,
},
{
"ThePrimeagen/git-worktree.nvim",
},
{
"folke/tokyonight.nvim",
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
-- load the colorscheme here
vim.cmd([[colorscheme tokyonight]])
end,
},
-- formatting & linting
"jose-elias-alvarez/null-ls.nvim",
-- use("jayp0521/mason-null-ls.nvim")
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
},
{
"folke/trouble.nvim",
requires = "nvim-tree/nvim-web-devicons",
config = function()
require("trouble").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
})
end,
},
{
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = {
{
"nvim-telescope/telescope-live-grep-args.nvim",
-- This will not install any breaking changes.
-- For major updates, this must be adjusted manually.
version = "^1.0.0",
},
},
config = function()
require("telescope").load_extension("live_grep_args")
end
}
{
'ThePrimeagen/refactoring.nvim',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-treesitter/nvim-treesitter' },
},
config = function()
require('refactoring').setup {}
end,
},
{
'ThePrimeagen/git-worktree.nvim',
},
{
'folke/tokyonight.nvim',
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
-- load the colorscheme here
vim.cmd [[colorscheme tokyonight]]
end,
},
-- formatting & linting
'jose-elias-alvarez/null-ls.nvim',
-- use("jayp0521/mason-null-ls.nvim")
{
'kylechui/nvim-surround',
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup {
-- Configuration here, or leave empty to use defaults
}
end,
},
{
'folke/trouble.nvim',
requires = 'nvim-tree/nvim-web-devicons',
config = function()
require('trouble').setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end,
},
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
dependencies = {
{
'nvim-telescope/telescope-live-grep-args.nvim',
-- This will not install any breaking changes.
-- For major updates, this must be adjusted manually.
version = '^1.0.0',
keys = {
{ '<leader>sga', ":lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>", desc = 'Live Grep (Args)' },
},
config = function()
require('telescope').load_extension 'live_grep_args'
end,
},
},
},
{
'tpope/vim-fugitive',
dependencies = { { 'tpope/vim-rhubarb' } },
},
{
'pmizio/typescript-tools.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
opts = {},
},
}

View File

@ -1,69 +1,81 @@
local Remap = require("rahcodes.keymap")
local Remap = require 'rahcodes.keymap'
local nmap = Remap.nmap
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set('n', 'n', 'nzzzv')
vim.keymap.set('n', 'N', 'Nzzzv')
-- don't bork paste buffer when pasting
vim.keymap.set("x", "<leader>p", '"_dP')
vim.keymap.set('x', '<leader>p', '"_dP')
vim.keymap.set("i", "<C-c>", "<Esc>")
vim.keymap.set('i', '<C-c>', '<Esc>')
-- vim.keymap.set("n", "/", "/\v")
-- vim.keymap.set("v", "/", "/\v")
vim.keymap.set("n", "<leader>`", ":noh<cr>")
vim.keymap.set('n', '<leader>`', ':noh<cr>')
-- No Cheating
vim.keymap.set("n", "<up>", "<nop>")
vim.keymap.set("n", "<down>", "<nop>")
vim.keymap.set("n", "<left>", "<nop>")
vim.keymap.set("n", "<right>", "<nop>")
vim.keymap.set("i", "<up>", "<nop>")
vim.keymap.set("i", "<down>", "<nop>")
vim.keymap.set("i", "<left>", "<nop>")
vim.keymap.set("i", "<right>", "<nop>")
vim.keymap.set('n', '<up>', '<nop>')
vim.keymap.set('n', '<down>', '<nop>')
vim.keymap.set('n', '<left>', '<nop>')
vim.keymap.set('n', '<right>', '<nop>')
vim.keymap.set('i', '<up>', '<nop>')
vim.keymap.set('i', '<down>', '<nop>')
vim.keymap.set('i', '<left>', '<nop>')
vim.keymap.set('i', '<right>', '<nop>')
-- No weird line jumps
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
vim.keymap.set('n', 'j', 'gj')
vim.keymap.set('n', 'k', 'gk')
-- Copy to system clipboard
vim.keymap.set("n", "<leader>y", '"*y')
vim.keymap.set("v", "<leader>y", '"*y')
vim.keymap.set("n", "<leader>yy", '"+y')
vim.keymap.set("v", "<leader>yy", '"+y')
vim.keymap.set('n', '<leader>y', '"*y')
vim.keymap.set('v', '<leader>y', '"*y')
vim.keymap.set('n', '<leader>yy', '"+y')
vim.keymap.set('v', '<leader>yy', '"+y')
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set('n', '<C-f>', '<cmd>silent !tmux neww tmux-sessionizer<CR>')
-- Move buffers
nmap("sp", ":bprev<Return>")
nmap("sn", ":bnext<Return>")
nmap('sp', ':bprev<Return>')
nmap('sn', ':bnext<Return>')
-- Quickfix list navigation
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>lprev<CR>zz')
-- Save
nmap("<C-s>", ":wa<CR>")
nmap('<C-s>', ':wa<CR>')
-- See `:help telescope.builtin`
vim.keymap.set("n", "<leader>m", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" })
vim.keymap.set("n", "<leader>/", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" })
vim.keymap.set('n', '<leader>m', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader>/', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
-- Trouble bindings
vim.keymap.set("n", "<leader>xx", function() require("trouble").open() end)
vim.keymap.set("n", "<leader>xw", function() require("trouble").open("workspace_diagnostics") end)
vim.keymap.set("n", "<leader>xd", function() require("trouble").open("document_diagnostics") end)
vim.keymap.set("n", "<leader>xq", function() require("trouble").open("quickfix") end)
vim.keymap.set("n", "<leader>xl", function() require("trouble").open("loclist") end)
vim.keymap.set("n", "gR", function() require("trouble").open("lsp_references") end)
vim.keymap.set('n', '<leader>xx', function()
require('trouble').open()
end)
vim.keymap.set('n', '<leader>xw', function()
require('trouble').open 'workspace_diagnostics'
end)
vim.keymap.set('n', '<leader>xd', function()
require('trouble').open 'document_diagnostics'
end)
vim.keymap.set('n', '<leader>xq', function()
require('trouble').open 'quickfix'
end)
vim.keymap.set('n', '<leader>xl', function()
require('trouble').open 'loclist'
end)
vim.keymap.set('n', 'gR', function()
require('trouble').open 'lsp_references'
end)