initial commit
This commit is contained in:
84
nvim/.config/nvim/init.lua
Normal file
84
nvim/.config/nvim/init.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
local g = vim.g
|
||||
local o = vim.o
|
||||
local keymap = vim.keymap.set
|
||||
local cmd = vim.cmd
|
||||
local fn = vim.fn
|
||||
local api = vim.api
|
||||
|
||||
-- Leader Key
|
||||
g.mapleader = " "
|
||||
|
||||
-- Disable netrw for Nvim Tree
|
||||
g.loaded_netrw = 1
|
||||
g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Numbers
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.numberwidth = 1
|
||||
|
||||
-- Clipboard
|
||||
cmd[[set clipboard+=unnamedplus]]
|
||||
|
||||
-- Files
|
||||
o.swapfile = false
|
||||
o.backup = false
|
||||
|
||||
-- Scroll Offset
|
||||
o.scrolloff = 15
|
||||
|
||||
-- Cursor & Column Lines
|
||||
o.colorcolumn = "80"
|
||||
o.cursorline = true
|
||||
|
||||
-- Mouse
|
||||
o.mouse = "a"
|
||||
|
||||
-- Spacing
|
||||
o.tabstop = 2
|
||||
o.shiftwidth = 2
|
||||
o.expandtab = true
|
||||
|
||||
-- Update Time
|
||||
o.updatetime = 50
|
||||
|
||||
-- Hide Highlighting
|
||||
cmd[[set nohlsearch]]
|
||||
|
||||
-- Indent
|
||||
keymap("n", "<S-Tab>", "<<")
|
||||
keymap("n", "<Tab>", ">>")
|
||||
keymap("v", "<S-Tab>", "<<")
|
||||
keymap("v", "<Tab>", ">>")
|
||||
keymap("i", "<S-Tab>", "<BS>")
|
||||
|
||||
-- Move Between Panels
|
||||
keymap("", "<C-h>", ":wincmd h<CR>")
|
||||
keymap("", "<C-j>", ":wincmd j<CR>")
|
||||
keymap("", "<C-k>", ":wincmd k<CR>")
|
||||
keymap("", "<C-l>", ":wincmd l<CR>")
|
||||
|
||||
-- Jump Up/Down A Half Page
|
||||
keymap("n", "<C-d>", "<C-d>zz")
|
||||
keymap("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- Keep Copy/Paste Value
|
||||
keymap("x", "<leader>p", "\"_dP")
|
||||
|
||||
-- Sort
|
||||
keymap("v", "<C-s>", ":sort<CR>")
|
||||
|
||||
-- Disable F1 in Insert mode
|
||||
keymap('i', '<F1>', '<nop>')
|
||||
|
||||
-- Close Neovim
|
||||
cmd("command! Qa qa")
|
||||
|
||||
-- Remove trailing whitespace when focus is lost or the window is closed,
|
||||
-- without moving the cursor
|
||||
api.nvim_exec([[
|
||||
autocmd FocusLost,WinLeave * if &modifiable | let w:save_cursor = getcurpos() | %s/\s\+$//e | call setpos('.', w:save_cursor) | endif
|
||||
]], false)
|
||||
|
||||
-- Lazy.nvim
|
||||
require("plugins")
|
22
nvim/.config/nvim/lazy-lock.json
Normal file
22
nvim/.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ff2b85abaa810f6611233dbe6d31c07510ebf43d" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "68fc4c20f5803444277022c681785c5edd11916d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "eb3e850acff4d9f2f2dd8dacd75353043c899753" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "63f552a7f59badc6e6b6d22e603150f0d5abebb7" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
||||
}
|
14
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
14
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
require('gruvbox').setup({
|
||||
priority = 1000,
|
||||
|
||||
config = true,
|
||||
|
||||
contrast = "hard",
|
||||
transparent_mode = true,
|
||||
overrides = {
|
||||
NonText = { fg = "#666666" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Colorscheme
|
||||
vim.cmd("colorscheme gruvbox")
|
0
nvim/.config/nvim/lua/plugins/copilot.lua
Normal file
0
nvim/.config/nvim/lua/plugins/copilot.lua
Normal file
9
nvim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
9
nvim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require('gitsigns').setup({
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
})
|
12
nvim/.config/nvim/lua/plugins/indent-blankline.lua
Normal file
12
nvim/.config/nvim/lua/plugins/indent-blankline.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
vim.cmd [[highlight IndentBlanklineColor guifg=#555555 gui=nocombine]]
|
||||
|
||||
local highlights = {
|
||||
"CursorColumn",
|
||||
"Whitespace",
|
||||
}
|
||||
|
||||
require('ibl').setup({
|
||||
indent = {
|
||||
highlight = highlight,
|
||||
}
|
||||
})
|
68
nvim/.config/nvim/lua/plugins/init.lua
Normal file
68
nvim/.config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or 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)
|
||||
|
||||
-- Plugins
|
||||
require("lazy").setup({
|
||||
{ "windwp/nvim-autopairs" },
|
||||
{ "Pocco81/auto-save.nvim" },
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
{ "lewis6991/gitsigns.nvim" },
|
||||
{ "lukas-reineke/indent-blankline.nvim" },
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = "nvim-lua/plenary.nvim",
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{
|
||||
"github/copilot.vim",
|
||||
config = function()
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.api.nvim_set_keymap(
|
||||
"i",
|
||||
"<C-J>",
|
||||
'copilot#Accept("<CR>")',
|
||||
{ silent = true, expr = true }
|
||||
)
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
require('plugins.colorscheme')
|
||||
require('plugins.gitsigns')
|
||||
require('plugins.indent-blankline')
|
||||
require('plugins.lsp-zero')
|
||||
require('plugins.nvim-autopairs')
|
||||
require('plugins.nvim-tree')
|
||||
require('plugins.telescope')
|
||||
require('plugins.treesitter')
|
62
nvim/.config/nvim/lua/plugins/lsp-zero.lua
Normal file
62
nvim/.config/nvim/lua/plugins/lsp-zero.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local lsp_zero = require('lsp-zero')
|
||||
local cmp = require('cmp')
|
||||
local cmp_action = lsp_zero.cmp_action()
|
||||
|
||||
-- LSP Zero
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({buffer = bufnr})
|
||||
end)
|
||||
|
||||
lsp_zero.set_sign_icons({
|
||||
error = '✘',
|
||||
warn = '▲',
|
||||
hint = '⚑',
|
||||
info = '»'
|
||||
})
|
||||
|
||||
-- CMP
|
||||
cmp.setup({
|
||||
source = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
preselect = 'item',
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert'
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = cmp_action.luasnip_supertab(),
|
||||
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
|
||||
['<CR>'] = cmp.mapping.confirm({select = true}),
|
||||
}
|
||||
})
|
||||
|
||||
-- Mason
|
||||
require('mason').setup({})
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'ts_ls',
|
||||
'html',
|
||||
'cssls',
|
||||
'jsonls',
|
||||
'emmet_ls',
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Show line diagnostics automatically in hover window
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
|
||||
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
|
4
nvim/.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
4
nvim/.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
require('nvim-autopairs').setup({
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
})
|
33
nvim/.config/nvim/lua/plugins/nvim-tree.lua
Normal file
33
nvim/.config/nvim/lua/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
local function custom_mapping(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
local function opts(desc)
|
||||
return {
|
||||
desc = "nvim-tree: " .. desc,
|
||||
buffer = bufnr,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
nowait = true
|
||||
}
|
||||
end
|
||||
|
||||
-- default mappings
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
-- custom mappings
|
||||
vim.keymap.set('n', 's', api.node.open.vertical, opts('Open: Vertical Split'))
|
||||
vim.keymap.set('n', 'u', api.node.navigate.parent_close, opts('Close Directory'))
|
||||
end
|
||||
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
width = {},
|
||||
},
|
||||
on_attach = custom_mapping,
|
||||
})
|
||||
|
||||
-- Tree
|
||||
vim.keymap.set("n", [[<C-\>]], ":NvimTreeToggle<CR>")
|
||||
vim.keymap.set("n", [[<leader>\]], ":NvimTreeToggle<CR>")
|
||||
vim.keymap.set("n", "<leader>ff", ":NvimTreeFindFile<CR>")
|
||||
|
10
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
10
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
require('telescope').setup({})
|
||||
|
||||
-- Telescope
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set("n", "<leader>gf", builtin.git_files)
|
||||
vim.keymap.set("n", "<leader>gs", builtin.git_status)
|
||||
vim.keymap.set("n", "<leader>gg", builtin.live_grep)
|
||||
vim.keymap.set("n", "<leader>b", builtin.buffers)
|
||||
|
31
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
31
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
require('nvim-treesitter.configs').setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"css",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"scss",
|
||||
"svelte",
|
||||
"tmux",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
"tsx",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user