123 lines
3 KiB
Lua
123 lines
3 KiB
Lua
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
vim.o.number = true
|
|
vim.o.relativenumber = true
|
|
|
|
vim.o.wrap = true
|
|
vim.o.tabstop = 4
|
|
|
|
vim.o.swapfile = false
|
|
vim.g.have_nerd_font = true
|
|
vim.o.mouse = 'a'
|
|
vim.o.undofile = true
|
|
vim.o.scrolloff = 10
|
|
vim.o.cursorline = true
|
|
vim.g.border = "rounded"
|
|
vim.o.termguicolors = true
|
|
|
|
|
|
-- KEYMAPS ------------------------------------------------------
|
|
|
|
-- unset space so it can be used as leader
|
|
vim.keymap.set("n", " ", "", { silent = true, remap = false })
|
|
|
|
-- move around windows
|
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'focus to l window' })
|
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'focus to r window' })
|
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'focus to dwn window' })
|
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'focus to up window' })
|
|
|
|
-- move lines up and down
|
|
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
|
|
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
|
|
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
|
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
|
|
|
-- toggle nvim tree
|
|
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
|
|
|
|
-- barbar
|
|
vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>")
|
|
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>")
|
|
vim.keymap.set("n", "<leader>x", ":BufferClose<CR>")
|
|
|
|
-- END KEYMAPS ------------------------------------------------------
|
|
|
|
|
|
-- Highlight On Yank
|
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
desc = 'Highlight when yanking (copying) text',
|
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
|
callback = function()
|
|
vim.hl.on_yank()
|
|
end,
|
|
})
|
|
|
|
-- VIM PACKS
|
|
vim.pack.add({
|
|
-- theme
|
|
{ src = "https://github.com/neanias/everforest-nvim.git" },
|
|
|
|
-- lsp
|
|
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
|
{ src = 'https://github.com/mason-org/mason.nvim' },
|
|
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
|
|
{ src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' },
|
|
|
|
-- bar and icons at the top
|
|
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
|
|
{ src = 'https://github.com/romgrk/barbar.nvim' },
|
|
|
|
-- file tree
|
|
{ src = 'https://github.com/nvim-tree/nvim-tree.lua' },
|
|
|
|
-- auto save
|
|
{ src = 'https://github.com/Pocco81/auto-save.nvim' },
|
|
|
|
-- completion
|
|
{ src = 'https://github.com/saghen/blink.cmp' },
|
|
|
|
})
|
|
|
|
require "barbar".setup()
|
|
require "nvim-tree".setup()
|
|
require "auto-save".setup()
|
|
require "blink.cmp".setup({
|
|
keymap = {
|
|
preset = "enter",
|
|
["<CR>"] = { "select_and_accept", "fallback" },
|
|
},
|
|
})
|
|
|
|
vim.cmd("colorscheme everforest")
|
|
|
|
require('mason').setup()
|
|
require('mason-lspconfig').setup()
|
|
require('mason-tool-installer').setup({
|
|
ensure_installed = {
|
|
"lua_ls",
|
|
}
|
|
})
|
|
|
|
vim.lsp.config('lua_ls', {
|
|
settings = {
|
|
Lua = {
|
|
runtime = {
|
|
version = 'LuaJIT',
|
|
},
|
|
diagnostics = {
|
|
globals = {
|
|
'vim',
|
|
'require'
|
|
},
|
|
},
|
|
workspace = {
|
|
library = vim.api.nvim_get_runtime_file("", true),
|
|
},
|
|
telemetry = {
|
|
enable = false,
|
|
},
|
|
},
|
|
},
|
|
})
|