Initial commit
This commit is contained in:
commit
35aaf58a92
14 changed files with 314 additions and 0 deletions
63
init.lua
Normal file
63
init.lua
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
vim.opt.belloff = "all"
|
||||||
|
vim.opt.backspace = "2"
|
||||||
|
vim.opt.showcmd = true
|
||||||
|
vim.opt.laststatus = 2
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
vim.opt.autoindent = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.opt.copyindent = true
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 2
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.wrap = false
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
vim.opt.hlsearch = false
|
||||||
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Fix for yanking to system clipboard on Windows
|
||||||
|
if vim.fn.has('wsl') == 1 then
|
||||||
|
vim.g.clipboard = {
|
||||||
|
name = 'WslClipboard',
|
||||||
|
copy = {
|
||||||
|
['+'] = 'clip.exe',
|
||||||
|
['*'] = 'clip.exe',
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||||
|
['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||||
|
},
|
||||||
|
cache_enabled = 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lazy").setup("plugins")
|
||||||
|
require("keybinds")
|
||||||
|
|
23
lazy-lock.json
Normal file
23
lazy-lock.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "2463d687fe704b76eb0aa3bb34e95f69a5bb0362" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" },
|
||||||
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "80445d015d2b5f9af0d9e8bce63d303bc86eda8a" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "0d9e870d01894c592d7ea93cfe0fa451916d9a7f" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d" },
|
||||||
|
"nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "808627b8d412b2a6b6fc6eed816fec3557198b01" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||||
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
||||||
|
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||||
|
"vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" },
|
||||||
|
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
|
||||||
|
}
|
21
lua/keybinds.lua
Normal file
21
lua/keybinds.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", {})
|
||||||
|
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", {})
|
||||||
|
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", {})
|
||||||
|
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", {})
|
||||||
|
|
||||||
|
-- Move visual blocks around using J/K (up/down)
|
||||||
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", {})
|
||||||
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", {})
|
||||||
|
|
||||||
|
-- Keep search terms in the middle of the screen
|
||||||
|
vim.keymap.set("n", "n", "nzzzv", {})
|
||||||
|
vim.keymap.set("n", "N", "Nzzzv", {})
|
||||||
|
|
||||||
|
-- Paste without replacing clipboard contents
|
||||||
|
vim.keymap.set("x", "<Leader>p", "\"_dP", {})
|
||||||
|
|
||||||
|
-- Yank into system clipboard
|
||||||
|
vim.keymap.set("n", "<Leader>y", "\"+y", {})
|
||||||
|
|
||||||
|
-- Like ciw on the text under the cursor
|
||||||
|
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
3
lua/plugins/commentary.lua
Normal file
3
lua/plugins/commentary.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
"tpope/vim-commentary"
|
||||||
|
}
|
56
lua/plugins/completion.lua
Normal file
56
lua/plugins/completion.lua
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
-- Highlights the first result always
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert"
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-o>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<Tab>"] = cmp.mapping(function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i" }),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true })
|
||||||
|
}),
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" }
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip"
|
||||||
|
}
|
||||||
|
}
|
9
lua/plugins/fugitive.lua
Normal file
9
lua/plugins/fugitive.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
config = function ()
|
||||||
|
vim.keymap.set("n", "<Leader>gs", vim.cmd.Git)
|
||||||
|
vim.keymap.set("n", "gh", "<cmd>diffget //2<CR>")
|
||||||
|
vim.keymap.set("n", "gl", "<cmd>diffget //3<CR>")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
47
lua/plugins/lsp-config.lua
Normal file
47
lua/plugins/lsp-config.lua
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "lua_ls", "tsserver", "eslint" }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
lspconfig.lua_ls.setup({
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.tsserver.setup({
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Runs :EslintFixAll when saving
|
||||||
|
lspconfig.eslint.setup({
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
buffer = bufnr,
|
||||||
|
command = "EslintFixAll",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
|
||||||
|
vim.keymap.set('n', '<Leader>f', vim.lsp.buf.format, {})
|
||||||
|
vim.keymap.set('n', '<Leader>vca', vim.lsp.buf.code_action, {})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
12
lua/plugins/lualine.lua
Normal file
12
lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
config = function()
|
||||||
|
require('lualine').setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = 'tokyonight'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
12
lua/plugins/neo-tree.lua
Normal file
12
lua/plugins/neo-tree.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
vim.keymap.set("n", "<Leader>nn", ":Neotree<CR>", {})
|
||||||
|
end
|
||||||
|
}
|
3
lua/plugins/surround.lua
Normal file
3
lua/plugins/surround.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
"tpope/vim-surround"
|
||||||
|
}
|
31
lua/plugins/telescope.lua
Normal file
31
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.5',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<Leader>pp', builtin.git_files, {})
|
||||||
|
vim.keymap.set('n', '<Leader>pf', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<Leader>fh', builtin.help_tags, {})
|
||||||
|
vim.keymap.set('n', '<Leader>ps', function()
|
||||||
|
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-ui-select.nvim",
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup {
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
9
lua/plugins/tokyonight.lua
Normal file
9
lua/plugins/tokyonight.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme "tokyonight"
|
||||||
|
end
|
||||||
|
}
|
18
lua/plugins/treesitter.lua
Normal file
18
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
local config = require("nvim-treesitter.configs")
|
||||||
|
config.setup({
|
||||||
|
ensure_installed = { "lua", "javascript", "typescript", "tsx" },
|
||||||
|
sync_install = false,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-context"
|
||||||
|
}
|
||||||
|
}
|
7
lua/plugins/trouble.lua
Normal file
7
lua/plugins/trouble.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
vim.keymap.set("n", "<Leader>tt", ":TroubleToggle<CR>", {})
|
||||||
|
end
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue