fix up broken junk and snippets
This commit is contained in:
parent
afcf119fb8
commit
b88bb9ed6e
|
@ -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" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -1,69 +1,69 @@
|
||||||
local setup, null_ls = pcall(require, "null-ls")
|
local setup, null_ls = pcall(require, 'null-ls')
|
||||||
if not setup then
|
if not setup then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
-- local diagnostics = null_ls.builtins.diagnostics
|
||||||
local conditional = function(fn)
|
local conditional = function(fn)
|
||||||
local utils = require("null-ls.utils").make_conditional_utils()
|
local utils = require('null-ls.utils').make_conditional_utils()
|
||||||
return fn(utils)
|
return fn(utils)
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_formatting = function(bufnr)
|
local lsp_formatting = function(bufnr)
|
||||||
vim.lsp.buf.format({
|
vim.lsp.buf.format {
|
||||||
timeout_ms = 2000,
|
timeout_ms = 2000,
|
||||||
filter = function(client)
|
filter = function(client)
|
||||||
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
||||||
return client.name ~= "tsserver"
|
return client.name ~= 'tsserver'
|
||||||
end,
|
end,
|
||||||
bufnr = bufnr,
|
bufnr = bufnr,
|
||||||
})
|
}
|
||||||
end
|
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 my_rubocop_formatter = require("rahcodes.null-ls.rubocop")
|
||||||
local rubocop = null_ls.builtins.formatting.rubocop
|
local rubocop = null_ls.builtins.formatting.rubocop
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup {
|
||||||
debug = false,
|
debug = false,
|
||||||
sources = {
|
sources = {
|
||||||
formatting.prettier,
|
formatting.prettier,
|
||||||
-- formatting.stylua,
|
-- formatting.stylua,
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
-- setting eslint_d only if we have a ".eslintrc.js" file in the project
|
-- setting eslint_d only if we have a ".eslintrc.js" file in the project
|
||||||
diagnostics.eslint_d.with({
|
-- diagnostics.eslint_d.with {
|
||||||
condition = function(utils)
|
-- condition = function(utils)
|
||||||
return utils.root_has_file({ '.eslintrc.js' })
|
-- return utils.root_has_file { '.eslintrc', '.eslintrc.js', '.eslintrc.json' }
|
||||||
end
|
-- 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".
|
-- 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)
|
conditional(function(utils)
|
||||||
return utils.root_has_file("Gemfile")
|
return utils.root_has_file 'Gemfile'
|
||||||
and rubocop.with({
|
and rubocop.with {
|
||||||
command = "bundle",
|
command = 'bundle',
|
||||||
args = vim.list_extend({ "exec", "rubocop" }, rubocop._opts.args),
|
args = vim.list_extend({ 'exec', 'rubocop' }, rubocop._opts.args),
|
||||||
})
|
}
|
||||||
or rubocop
|
or rubocop
|
||||||
end),
|
end),
|
||||||
|
|
||||||
-- Same as above, but with diagnostics.rubocop to make sure we use the proper rubocop version for the project
|
-- Same as above, but with diagnostics.rubocop to make sure we use the proper rubocop version for the project
|
||||||
conditional(function(utils)
|
conditional(function(utils)
|
||||||
return utils.root_has_file("Gemfile")
|
return utils.root_has_file 'Gemfile'
|
||||||
and null_ls.builtins.diagnostics.rubocop.with({
|
and null_ls.builtins.diagnostics.rubocop.with {
|
||||||
command = "bundle",
|
command = 'bundle',
|
||||||
args = vim.list_extend({ "exec", "rubocop" }, null_ls.builtins.diagnostics.rubocop._opts.args),
|
args = vim.list_extend({ 'exec', 'rubocop' }, null_ls.builtins.diagnostics.rubocop._opts.args),
|
||||||
})
|
}
|
||||||
or null_ls.builtins.diagnostics.rubocop
|
or null_ls.builtins.diagnostics.rubocop
|
||||||
end),
|
end),
|
||||||
},
|
},
|
||||||
-- format on save
|
-- format on save
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method 'textDocument/formatting' then
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
|
@ -72,4 +72,4 @@ null_ls.setup({
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
pcall(require("telescope").load_extension, "ui-select")
|
|
||||||
pcall(require("telescope").load_extension, "live_grep_args")
|
|
6
init.lua
6
init.lua
|
@ -652,7 +652,7 @@ require('lazy').setup {
|
||||||
-- you can use this plugin to help you. It even has snippets
|
-- you can use this plugin to help you. It even has snippets
|
||||||
-- for various frameworks/libraries/etc. but you will have to
|
-- for various frameworks/libraries/etc. but you will have to
|
||||||
-- set up the ones that are useful for you.
|
-- set up the ones that are useful for you.
|
||||||
-- 'rafamadriz/friendly-snippets',
|
'rafamadriz/friendly-snippets',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- See `:help cmp`
|
-- See `:help cmp`
|
||||||
|
@ -806,7 +806,7 @@ require('lazy').setup {
|
||||||
-- Here are some example plugins that I've included in the kickstart repository.
|
-- 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).
|
-- 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',
|
-- require 'kickstart.plugins.indent_line',
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- 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.
|
-- 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`
|
-- 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`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
|
|
|
@ -1,68 +1,80 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"ThePrimeagen/refactoring.nvim",
|
'ThePrimeagen/refactoring.nvim',
|
||||||
requires = {
|
requires = {
|
||||||
{ "nvim-lua/plenary.nvim" },
|
{ 'nvim-lua/plenary.nvim' },
|
||||||
{ "nvim-treesitter/nvim-treesitter" },
|
{ 'nvim-treesitter/nvim-treesitter' },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("refactoring").setup({})
|
require('refactoring').setup {}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ThePrimeagen/git-worktree.nvim",
|
'ThePrimeagen/git-worktree.nvim',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/tokyonight.nvim",
|
'folke/tokyonight.nvim',
|
||||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
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
|
priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
config = function()
|
config = function()
|
||||||
-- load the colorscheme here
|
-- load the colorscheme here
|
||||||
vim.cmd([[colorscheme tokyonight]])
|
vim.cmd [[colorscheme tokyonight]]
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- formatting & linting
|
-- formatting & linting
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
-- use("jayp0521/mason-null-ls.nvim")
|
-- use("jayp0521/mason-null-ls.nvim")
|
||||||
{
|
{
|
||||||
"kylechui/nvim-surround",
|
'kylechui/nvim-surround',
|
||||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
version = '*', -- Use for stability; omit to use `main` branch for the latest features
|
||||||
event = "VeryLazy",
|
event = 'VeryLazy',
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim-surround").setup({
|
require('nvim-surround').setup {
|
||||||
-- Configuration here, or leave empty to use defaults
|
-- Configuration here, or leave empty to use defaults
|
||||||
})
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/trouble.nvim",
|
'folke/trouble.nvim',
|
||||||
requires = "nvim-tree/nvim-web-devicons",
|
requires = 'nvim-tree/nvim-web-devicons',
|
||||||
config = function()
|
config = function()
|
||||||
require("trouble").setup({
|
require('trouble').setup {
|
||||||
-- your configuration comes here
|
-- your configuration comes here
|
||||||
-- or leave it empty to use the default settings
|
-- or leave it empty to use the default settings
|
||||||
-- refer to the configuration section below
|
-- refer to the configuration section below
|
||||||
})
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rafamadriz/friendly-snippets",
|
'rafamadriz/friendly-snippets',
|
||||||
config = function()
|
config = function()
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
"nvim-telescope/telescope.nvim",
|
'nvim-telescope/telescope.nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-live-grep-args.nvim",
|
'nvim-telescope/telescope-live-grep-args.nvim',
|
||||||
-- This will not install any breaking changes.
|
-- This will not install any breaking changes.
|
||||||
-- For major updates, this must be adjusted manually.
|
-- For major updates, this must be adjusted manually.
|
||||||
version = "^1.0.0",
|
version = '^1.0.0',
|
||||||
},
|
keys = {
|
||||||
|
{ '<leader>sga', ":lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>", desc = 'Live Grep (Args)' },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("telescope").load_extension("live_grep_args")
|
require('telescope').load_extension 'live_grep_args'
|
||||||
end
|
end,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
dependencies = { { 'tpope/vim-rhubarb' } },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'pmizio/typescript-tools.nvim',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +1,81 @@
|
||||||
local Remap = require("rahcodes.keymap")
|
local Remap = require 'rahcodes.keymap'
|
||||||
local nmap = Remap.nmap
|
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', 'J', ":m '>+1<CR>gv=gv")
|
||||||
vim.keymap.set("v", "K", ":m '<-2<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-d>', '<C-d>zz')
|
||||||
vim.keymap.set("n", "<C-u>", "<C-u>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
|
-- 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("n", "/", "/\v")
|
||||||
-- vim.keymap.set("v", "/", "/\v")
|
-- vim.keymap.set("v", "/", "/\v")
|
||||||
vim.keymap.set("n", "<leader>`", ":noh<cr>")
|
vim.keymap.set('n', '<leader>`', ':noh<cr>')
|
||||||
|
|
||||||
-- No Cheating
|
-- No Cheating
|
||||||
vim.keymap.set("n", "<up>", "<nop>")
|
vim.keymap.set('n', '<up>', '<nop>')
|
||||||
vim.keymap.set("n", "<down>", "<nop>")
|
vim.keymap.set('n', '<down>', '<nop>')
|
||||||
vim.keymap.set("n", "<left>", "<nop>")
|
vim.keymap.set('n', '<left>', '<nop>')
|
||||||
vim.keymap.set("n", "<right>", "<nop>")
|
vim.keymap.set('n', '<right>', '<nop>')
|
||||||
vim.keymap.set("i", "<up>", "<nop>")
|
vim.keymap.set('i', '<up>', '<nop>')
|
||||||
vim.keymap.set("i", "<down>", "<nop>")
|
vim.keymap.set('i', '<down>', '<nop>')
|
||||||
vim.keymap.set("i", "<left>", "<nop>")
|
vim.keymap.set('i', '<left>', '<nop>')
|
||||||
vim.keymap.set("i", "<right>", "<nop>")
|
vim.keymap.set('i', '<right>', '<nop>')
|
||||||
|
|
||||||
-- No weird line jumps
|
-- No weird line jumps
|
||||||
vim.keymap.set("n", "j", "gj")
|
vim.keymap.set('n', 'j', 'gj')
|
||||||
vim.keymap.set("n", "k", "gk")
|
vim.keymap.set('n', 'k', 'gk')
|
||||||
|
|
||||||
-- Copy to system clipboard
|
-- Copy to system clipboard
|
||||||
vim.keymap.set("n", "<leader>y", '"*y')
|
vim.keymap.set('n', '<leader>y', '"*y')
|
||||||
vim.keymap.set("v", "<leader>y", '"*y')
|
vim.keymap.set('v', '<leader>y', '"*y')
|
||||||
vim.keymap.set("n", "<leader>yy", '"+y')
|
vim.keymap.set('n', '<leader>yy', '"+y')
|
||||||
vim.keymap.set("v", "<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
|
-- Move buffers
|
||||||
nmap("sp", ":bprev<Return>")
|
nmap('sp', ':bprev<Return>')
|
||||||
nmap("sn", ":bnext<Return>")
|
nmap('sn', ':bnext<Return>')
|
||||||
|
|
||||||
-- Quickfix list navigation
|
-- Quickfix list navigation
|
||||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<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', '<C-j>', '<cmd>cprev<CR>zz')
|
||||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<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', '<leader>j', '<cmd>lprev<CR>zz')
|
||||||
|
|
||||||
-- Save
|
-- Save
|
||||||
nmap("<C-s>", ":wa<CR>")
|
nmap('<C-s>', ':wa<CR>')
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
vim.keymap.set("n", "<leader>m", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" })
|
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>/', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
|
||||||
-- Trouble bindings
|
-- Trouble bindings
|
||||||
vim.keymap.set("n", "<leader>xx", function() require("trouble").open() end)
|
vim.keymap.set('n', '<leader>xx', function()
|
||||||
vim.keymap.set("n", "<leader>xw", function() require("trouble").open("workspace_diagnostics") end)
|
require('trouble').open()
|
||||||
vim.keymap.set("n", "<leader>xd", function() require("trouble").open("document_diagnostics") end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>xq", function() require("trouble").open("quickfix") end)
|
vim.keymap.set('n', '<leader>xw', function()
|
||||||
vim.keymap.set("n", "<leader>xl", function() require("trouble").open("loclist") end)
|
require('trouble').open 'workspace_diagnostics'
|
||||||
vim.keymap.set("n", "gR", function() require("trouble").open("lsp_references") end)
|
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)
|
||||||
|
|
Loading…
Reference in New Issue