add subtree for kickstart.nvim
This commit is contained in:
parent
8163cad7c7
commit
2ed61e5363
|
@ -0,0 +1,2 @@
|
|||
require("rahcodes.remap")
|
||||
require("rahcodes.sets")
|
|
@ -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" },
|
||||
},
|
||||
},
|
||||
})
|
|
@ -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,
|
||||
})
|
6
init.lua
6
init.lua
|
@ -282,7 +282,7 @@ require('lazy').setup({
|
|||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
--
|
||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
}, {})
|
||||
|
||||
-- [[ Setting options ]]
|
||||
|
@ -424,7 +424,7 @@ local function telescope_live_grep_open_files()
|
|||
end
|
||||
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]les' })
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
|
@ -590,7 +590,7 @@ local servers = {
|
|||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- tsserver = {},
|
||||
tsserver = {},
|
||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||
|
||||
lua_ls = {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "60404ba67044c6ab01894dd5bf77bd64ea5e09aa" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
|
||||
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
|
||||
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "3157f2e876fd6223d36cfa76bee4709247d62fa5" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ec7d51a619049c7c597f469f81ea199db6794651" },
|
||||
"nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "6e2b56cbe75ddf18e6efecee44bc3936d70b0b3e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
|
||||
"refactoring.nvim": { "branch": "master", "commit": "1b593e7203b31c7bde3fa638e6869144698df3b6" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "2e88f14a585c014691904ba8fe39e6ea851c9422" },
|
||||
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||
}
|
|
@ -1,5 +1,54 @@
|
|||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
local M = {}
|
||||
|
||||
local function bind(op, outer_opts)
|
||||
outer_opts = outer_opts or {noremap = true}
|
||||
return function(lhs, rhs, opts)
|
||||
opts = vim.tbl_extend("force",
|
||||
outer_opts,
|
||||
opts or {}
|
||||
)
|
||||
vim.keymap.set(op, lhs,rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.nmap = bind("n", {noremap = false})
|
||||
M.nnoremap = bind("n")
|
||||
M.vnoremap = bind("v")
|
||||
M.xnoremap = bind("x")
|
||||
M.inoremap = bind("i")
|
||||
|
||||
return M
|
|
@ -0,0 +1,69 @@
|
|||
local Remap = require("rahcodes.keymap")
|
||||
local nmap = Remap.nmap
|
||||
|
||||
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("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")
|
||||
|
||||
-- don't bork paste buffer when pasting
|
||||
vim.keymap.set("x", "<leader>p", '"_dP')
|
||||
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
-- vim.keymap.set("n", "/", "/\v")
|
||||
-- vim.keymap.set("v", "/", "/\v")
|
||||
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>")
|
||||
|
||||
-- No weird line jumps
|
||||
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", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
|
||||
-- Move buffers
|
||||
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")
|
||||
|
||||
-- Save
|
||||
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" })
|
||||
|
||||
-- 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)
|
|
@ -0,0 +1,26 @@
|
|||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.colorcolumn = "80"
|
||||
|
||||
vim.opt.mouse = "v"
|
Loading…
Reference in New Issue