revamped nvim config with lsp.zero
This commit is contained in:
parent
b32fa96788
commit
1f2f336b64
21
.config/nvim/after/plugin/fugitive.lua
Normal file
21
.config/nvim/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>gca", ":G commit --amend --no-edit<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>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>gb", ":G branch<Space>")
|
||||
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>")
|
@ -1,129 +1,87 @@
|
||||
local lsp = require("lsp-zero")
|
||||
|
||||
lsp.preset("recommended")
|
||||
|
||||
lsp.ensure_installed({
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"sumneko_lua",
|
||||
"rust_analyzer",
|
||||
})
|
||||
|
||||
-- see documentation of null-null-ls for more configuration options!
|
||||
local mason_nullls = require("mason-null-ls")
|
||||
mason_nullls.setup({
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
})
|
||||
mason_nullls.setup_handlers({})
|
||||
|
||||
local Remap = require("rahcodes.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
|
||||
local sumneko_root_path = "/usr/lib/lua-language-server"
|
||||
local sumneko_binary = "/usr/local/bin/lua-language-server"
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require("cmp")
|
||||
local source_mapping = {
|
||||
youtube = "[Suck it YT]",
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
-- cmp_tabnine = "[TN]",
|
||||
path = "[Path]",
|
||||
}
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- For `vsnip` user.
|
||||
-- vim.fn["vsnip#anonymous"](args.body)
|
||||
|
||||
-- For `luasnip` user.
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
|
||||
-- For `ultisnips` user.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
||||
local menu = source_mapping[entry.source.name]
|
||||
-- if entry.source.name == "cmp_tabnine" then
|
||||
-- if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
|
||||
-- menu = entry.completion_item.data.detail .. " " .. menu
|
||||
-- end
|
||||
-- vim_item.kind = ""
|
||||
-- end
|
||||
vim_item.menu = menu
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
||||
sources = {
|
||||
-- tabnine completion? yayaya
|
||||
-- { name = "cmp_tabnine" },
|
||||
|
||||
{ name = "nvim_lsp" },
|
||||
|
||||
-- For vsnip user.
|
||||
-- { name = 'vsnip' },
|
||||
|
||||
-- For luasnip user.
|
||||
{ name = "luasnip" },
|
||||
|
||||
-- For ultisnips user.
|
||||
-- { name = 'ultisnips' },
|
||||
|
||||
{ name = "buffer" },
|
||||
|
||||
{ name = "youtube" },
|
||||
},
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings,
|
||||
})
|
||||
|
||||
--[[
|
||||
local tabnine = require("cmp_tabnine.config")
|
||||
tabnine:setup({
|
||||
max_lines = 1000,
|
||||
max_num_results = 20,
|
||||
sort = true,
|
||||
run_on_every_keystroke = true,
|
||||
snippet_placeholder = "..",
|
||||
})
|
||||
]]
|
||||
--
|
||||
lsp.on_attach = function(client, bufnr)
|
||||
-- Disable LSP server formatting, to prevent formatting twice.
|
||||
-- Once by the LSP server, second time by NULL-ls.
|
||||
if client.name == "volar" or client.name == "tsserver" then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentFormattingRangeProvider = false
|
||||
end
|
||||
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
local function config(_config)
|
||||
return vim.tbl_deep_extend("force", {
|
||||
on_attach = function()
|
||||
nnoremap("gD", function()
|
||||
vim.lsp.buf.definition()
|
||||
end)
|
||||
nnoremap("gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("gD", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, opts)
|
||||
nnoremap("K", function()
|
||||
vim.lsp.buf.hover()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("gi", function()
|
||||
vim.lsp.buf.implementation()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>wa", function()
|
||||
vim.lsp.buf.add_workspace_folder()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>wr", function()
|
||||
vim.lsp.buf.remove_workspace_folder()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("[d", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("]d", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>ca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>vco", function()
|
||||
vim.lsp.buf.code_action({
|
||||
filter = function(code_action)
|
||||
@ -136,110 +94,19 @@ local function config(_config)
|
||||
end,
|
||||
apply = true,
|
||||
})
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>gr", function()
|
||||
vim.lsp.buf.references()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>rn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end)
|
||||
end, opts)
|
||||
inoremap("<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end)
|
||||
end, opts)
|
||||
nnoremap("<leader>f", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end)
|
||||
end,
|
||||
}, _config or {})
|
||||
end, opts)
|
||||
end
|
||||
|
||||
require("lspconfig").solargraph.setup(config())
|
||||
require("lspconfig").zls.setup(config())
|
||||
|
||||
require("lspconfig").tsserver.setup(config())
|
||||
|
||||
require("lspconfig").ccls.setup(config())
|
||||
|
||||
require("lspconfig").jedi_language_server.setup(config())
|
||||
|
||||
require("lspconfig").svelte.setup(config())
|
||||
|
||||
require("lspconfig").solang.setup(config())
|
||||
|
||||
require("lspconfig").cssls.setup(config())
|
||||
|
||||
require("lspconfig").gopls.setup(config({
|
||||
cmd = { "gopls", "serve" },
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
-- who even uses this?
|
||||
require("lspconfig").rust_analyzer.setup(config({
|
||||
cmd = { "rustup", "run", "nightly", "rust-analyzer" },
|
||||
}))
|
||||
|
||||
require("lspconfig").sumneko_lua.setup(config({
|
||||
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ";"),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
local opts = {
|
||||
-- whether to highlight the currently hovered symbol
|
||||
-- disable if your cpu usage is higher than you want it
|
||||
-- or you just hate the highlight
|
||||
-- default: true
|
||||
highlight_hovered_item = true,
|
||||
|
||||
-- whether to show outline guides
|
||||
-- default: true
|
||||
show_guides = true,
|
||||
}
|
||||
|
||||
require("symbols-outline").setup(opts)
|
||||
|
||||
local snippets_paths = function()
|
||||
local plugins = { "friendly-snippets" }
|
||||
local paths = {}
|
||||
local path
|
||||
local root_path = vim.env.HOME .. "/.vim/plugged/"
|
||||
for _, plug in ipairs(plugins) do
|
||||
path = root_path .. plug
|
||||
if vim.fn.isdirectory(path) ~= 0 then
|
||||
table.insert(paths, path)
|
||||
end
|
||||
end
|
||||
return paths
|
||||
end
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load({
|
||||
paths = snippets_paths(),
|
||||
include = nil, -- Load all languages
|
||||
exclude = {},
|
||||
})
|
||||
lsp.setup()
|
||||
|
@ -13,4 +13,19 @@ telescope.setup({
|
||||
},
|
||||
})
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>/", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<leader>*", builtin.grep_string, {})
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||
|
||||
vim.keymap.set("n", "<leader>m", builtin.oldfiles, {})
|
||||
vim.keymap.set("n", "<leader>gb", builtin.git_branches, {})
|
||||
-- vim.keymap.set('n', '<leader>gs', builtin.git_status, {})
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.git_files, {})
|
||||
vim.keymap.set("n", "<leader>ps", function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
@ -1,6 +1,6 @@
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "ruby", "typescript", "javascript", "lua", "rust" },
|
||||
ensure_installed = { "ruby", "typescript", "javascript", "lua", "rust", "typescript" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
@ -1,3 +1,3 @@
|
||||
require("rahcodes.packer")
|
||||
require("rahcodes.set")
|
||||
require("rahcodes.remap")
|
||||
require("rahcodes.packer")
|
||||
|
@ -1,18 +1,12 @@
|
||||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
local is_bootstrap = false
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
is_bootstrap = true
|
||||
vim.fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
require("packer").startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
use("folke/tokyonight.nvim")
|
||||
@ -35,21 +29,29 @@ return require("packer").startup(function(use)
|
||||
ts_update()
|
||||
end,
|
||||
})
|
||||
use({ "williamboman/mason.nvim" })
|
||||
use({ "williamboman/mason-lspconfig.nvim" })
|
||||
|
||||
-- configure lsp servers
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("hrsh7th/cmp-buffer")
|
||||
use("hrsh7th/nvim-cmp")
|
||||
-- use("tzachar/cmp-tabnine", { run = "./install.sh" })
|
||||
use("onsails/lspkind-nvim")
|
||||
use("nvim-lua/lsp_extensions.nvim")
|
||||
use("glepnir/lspsaga.nvim")
|
||||
use("simrat39/symbols-outline.nvim")
|
||||
use("L3MON4D3/LuaSnip")
|
||||
use("saadparwaiz1/cmp_luasnip")
|
||||
-- LSP
|
||||
use({
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
})
|
||||
|
||||
-- formatting & linting
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
@ -92,9 +94,32 @@ return require("packer").startup(function(use)
|
||||
end,
|
||||
})
|
||||
|
||||
use("theprimeagen/harpoon")
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
if is_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- When we are bootstrapping a configuration, it doesn't
|
||||
-- make sense to execute the rest of the init.lua.
|
||||
--
|
||||
-- You'll need to restart nvim, and then it will work.
|
||||
if is_bootstrap then
|
||||
print("==================================")
|
||||
print(" Plugins are being installed")
|
||||
print(" Wait until Packer completes,")
|
||||
print(" then restart nvim")
|
||||
print("==================================")
|
||||
return
|
||||
end
|
||||
|
||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||
local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
command = "source <afile> | silent! LspStop | silent! LspStart | PackerCompile",
|
||||
group = packer_group,
|
||||
pattern = vim.fn.expand("$MYVIMRC"),
|
||||
})
|
||||
|
@ -1,74 +1,61 @@
|
||||
local Remap = require("rahcodes.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local vnoremap = Remap.vnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
local nmap = Remap.nmap
|
||||
|
||||
nnoremap("<leader>pv", "<cmd>Ex<CR>")
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>/", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<leader>*", builtin.grep_string, {})
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("n", "<leader>m", builtin.oldfiles, {})
|
||||
vim.keymap.set("n", "<leader>gb", builtin.git_branches, {})
|
||||
-- vim.keymap.set('n', '<leader>gs', builtin.git_status, {})
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.git_files, {})
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Null Ls
|
||||
nnoremap("<leader>lf", ":lua vim.lsp.buf.format({ timeout_ms = 10000 })<CR>")
|
||||
nnoremap("<leader>lF", ":lua vim.lsp.buf.range_format({ timeout_ms = 2000 })<CR>")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- Git Fugitive
|
||||
nnoremap("<leader>gs", ":G<CR>")
|
||||
nnoremap("<leader>gh", ":diffget //3<CR>")
|
||||
nnoremap("<leader>gu", ":diffget //2<CR>")
|
||||
nnoremap("<leader>gc", ":GCheckout<CR>")
|
||||
nnoremap("<leader>ga", ":G add %:p<CR><CR>")
|
||||
nnoremap("<leader>gc", ":G commit -v -q<CR>")
|
||||
nnoremap("<leader>gt", ":G commit -v -q %:p<CR>")
|
||||
nnoremap("<leader>gca", ":G commit --amend --no-edit<CR>")
|
||||
nnoremap("<leader>gff", ":G ff<CR>")
|
||||
nnoremap("<leader>gfo", ":G fetch origin<CR>")
|
||||
nnoremap("<leader>gd", ":Gdiff<CR>")
|
||||
nnoremap("<leader>ge", ":Gedit<CR>")
|
||||
nnoremap("<leader>gr", ":Gread<CR>")
|
||||
nnoremap("<leader>gw", ":Gwrite<CR><CR>")
|
||||
nnoremap("<leader>gl", ":silent! Glog<CR>:bot copen<CR>")
|
||||
nnoremap("<leader>gp", ":Ggrep<Space>")
|
||||
nnoremap("<leader>gm", ":Gmove<Space>")
|
||||
-- nnoremap("<leader>gb", ":G branch<Space>")
|
||||
nnoremap("<leader>go", ":G checkout<Space>")
|
||||
nnoremap("<leader>gps", ":Dispatch! git push<CR>")
|
||||
nnoremap("<leader>gpl", ":Dispatch! git pull<CR>")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vnoremap("J", ":m '>+1<CR>gv=gv")
|
||||
vnoremap("K", ":m '<-2<CR>gv=gv")
|
||||
-- don't bork paste buffer when pasting
|
||||
vim.keymap.set("x", "<leader>p", '"_dP')
|
||||
|
||||
-- nnoremap("/", "/\v")
|
||||
-- vnoremap("/", "/\v")
|
||||
nnoremap("<leader>`", ":noh<cr>")
|
||||
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
|
||||
nnoremap("<up>", "<nop>")
|
||||
nnoremap("<down>", "<nop>")
|
||||
nnoremap("<left>", "<nop>")
|
||||
nnoremap("<right>", "<nop>")
|
||||
inoremap("<up>", "<nop>")
|
||||
inoremap("<down>", "<nop>")
|
||||
inoremap("<left>", "<nop>")
|
||||
inoremap("<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
|
||||
nnoremap("j", "gj")
|
||||
nnoremap("k", "gk")
|
||||
vim.keymap.set("n", "j", "gj")
|
||||
vim.keymap.set("n", "k", "gk")
|
||||
|
||||
-- Copy to system clipboard
|
||||
vnoremap("<leader>y", '"*y')
|
||||
vnoremap("<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>")
|
||||
|
||||
-- Move buffers
|
||||
nmap("sp", ":bprev<Return>")
|
||||
nmap("sn", ":bnext<Return>")
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
vim.lsp.buf.format()
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>F", function()
|
||||
vim.lsp.buf.range_format()
|
||||
end)
|
||||
|
||||
-- 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")
|
||||
|
@ -3,20 +3,33 @@ vim.opt.guicursor = ""
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = 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.undofile = true
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.opt.colorcolumn = "80"
|
||||
|
||||
vim.opt.mouse = ""
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_winsize = 25
|
||||
|
||||
|
@ -89,31 +89,41 @@ _G.packer_plugins = {
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-nvim-lua"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lua"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["friendly-snippets"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
||||
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["lsp_extensions.nvim"] = {
|
||||
harpoon = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim",
|
||||
url = "https://github.com/nvim-lua/lsp_extensions.nvim"
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||
url = "https://github.com/theprimeagen/harpoon"
|
||||
},
|
||||
["lspkind-nvim"] = {
|
||||
["lsp-zero.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
|
||||
url = "https://github.com/onsails/lspkind-nvim"
|
||||
},
|
||||
["lspsaga.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
|
||||
url = "https://github.com/glepnir/lspsaga.nvim"
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
||||
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
@ -177,11 +187,6 @@ _G.packer_plugins = {
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["symbols-outline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/symbols-outline.nvim",
|
||||
url = "https://github.com/simrat39/symbols-outline.nvim"
|
||||
},
|
||||
["telescope-fzf-native.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim",
|
||||
@ -217,14 +222,14 @@ _G.packer_plugins = {
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: nvim-surround
|
||||
time([[Config for nvim-surround]], true)
|
||||
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround")
|
||||
time([[Config for nvim-surround]], false)
|
||||
-- Config for: gitsigns.nvim
|
||||
time([[Config for gitsigns.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim")
|
||||
time([[Config for gitsigns.nvim]], false)
|
||||
-- Config for: nvim-surround
|
||||
time([[Config for nvim-surround]], true)
|
||||
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround")
|
||||
time([[Config for nvim-surround]], false)
|
||||
-- Config for: trouble.nvim
|
||||
time([[Config for trouble.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
|
||||
|
Loading…
x
Reference in New Issue
Block a user