aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/neovim/nvim/lua')
-rw-r--r--modules/neovim/nvim/lua/config/colorscheme.lua29
-rw-r--r--modules/neovim/nvim/lua/config/keybinds.lua44
-rw-r--r--modules/neovim/nvim/lua/config/lsp.lua55
-rw-r--r--modules/neovim/nvim/lua/config/settings.lua21
4 files changed, 149 insertions, 0 deletions
diff --git a/modules/neovim/nvim/lua/config/colorscheme.lua b/modules/neovim/nvim/lua/config/colorscheme.lua
new file mode 100644
index 0000000..0636088
--- /dev/null
+++ b/modules/neovim/nvim/lua/config/colorscheme.lua
@@ -0,0 +1,29 @@
+vim.cmd[[
+ colorscheme base16-mountain
+ hi LineNr guifg=#ceb188
+ hi LineNrAbove guifg=#262626
+ hi LineNrBelow guifg=#262626
+ hi CursorLineNr guifg=#ceb188 guibg=#191919 gui=bold
+ hi FloatBorder guifg=#4c4c4c
+ hi Pmenu guibg=#0d0d0d
+ hi BlinkCmpMenuBorder guifg=#4c4c4c
+ hi PmenuSel guibg=#191919 guifg=#cacaca
+ hi WinBar guifg=#4c4c4c
+ hi WinSeparator guifg=#191919
+
+ " status line
+ hi StatusLine guibg=#191919 guifg=#4c4c4c
+ hi StatuslineInactive guibg=#191919 guifg=#4c4c4c gui=NONE
+ hi StatuslineAccent guifg=#0f0f0f guibg=#aca98a gui=bold
+ hi StatuslineInsertAccent guifg=#0f0f0f guibg=#8aabac gui=bold
+ hi StatuslineVisualAccent guifg=#0f0f0f guibg=#8f8aac gui=bold
+ hi StatuslineReplaceAccent guifg=#0f0f0f guibg=#ac8a8c gui=bold
+ hi StatuslineTerminalAccent guifg=#0f0f0f guibg=#ac8a8c gui=bold
+ hi StatuslineCommandAccent guifg=#0f0f0f guibg=#8aac8b gui=bold
+ hi StatuslineFileIcon guibg=#191919 guifg=#8f8aac
+ hi StatuslineInfo guibg=#191919 guifg=#4c4c4c
+ hi LspError guibg=#191919 guifg=#c49ea0
+ hi LspWarn guibg=#191919 guifg=#8f8aac
+ hi LspInfo guibg=#191919 guifg=#8f8aac
+ hi LspHint guibg=#191919 guifg=#8aabac
+]]
diff --git a/modules/neovim/nvim/lua/config/keybinds.lua b/modules/neovim/nvim/lua/config/keybinds.lua
new file mode 100644
index 0000000..690a4d8
--- /dev/null
+++ b/modules/neovim/nvim/lua/config/keybinds.lua
@@ -0,0 +1,44 @@
+local map = vim.keymap.set
+
+local function nmap(lhs, rhs, opts)
+ map('n', lhs, rhs, opts)
+end
+
+local function swap(mode, bind1, bind2)
+ local tmp=bind1
+ map(mode, bind1, bind2)
+ map(mode, bind2, tmp)
+end
+
+local function swapnv(bind1, bind2)
+ swap({'n', 'v'}, bind1, bind2)
+end
+
+swapnv('m', 'h')
+swapnv('n', 'j')
+swapnv('e', 'k')
+swapnv('i', 'l')
+
+swapnv('M', 'H')
+swapnv('N', 'J')
+--swapnv('E', 'K')
+swapnv('I', 'L')
+
+nmap('<leader>tn', ':tabnew<CR>', { desc = "Open a new tab" })
+nmap('<leader>tc', ':tabc<CR>', { desc = "Close the current tab" })
+nmap('<leader>tm', ':tabp<CR>', { desc = "Go to previous tab" })
+nmap('<leader>ti', ':tabn<CR>', { desc = "Go to next tab" })
+
+nmap('<leader>wh', ':vne<CR>', { desc = "Create vertical split" })
+nmap('<leader>wv', ':new<CR>', { desc = "Create horizontal split" })
+nmap('<leader>wc', ':clo<CR>', { desc = "Close current window" })
+
+nmap('<leader>wm', '<C-w><C-h>', { desc = "Focus window left of the current one" })
+nmap('<leader>wn', '<C-w><C-j>', { desc = "Focus window below the current one" })
+nmap('<leader>we', '<C-w><C-k>', { desc = "Focus window above the current one" })
+nmap('<leader>wi', '<C-w><C-l>', { desc = "Focus window right of the current one" })
+
+nmap('<leader>fo', '<cmd>Telescope find_files<CR>', { silent = true })
+nmap('<leader>?', '<cmd>Telescope live_grep<CR>', { silent = true })
+
+nmap('<leader>to', '<cmd>te<CR>', { silent = true; desc = "Open a terminal buffer in the current window." })
diff --git a/modules/neovim/nvim/lua/config/lsp.lua b/modules/neovim/nvim/lua/config/lsp.lua
new file mode 100644
index 0000000..62caa5d
--- /dev/null
+++ b/modules/neovim/nvim/lua/config/lsp.lua
@@ -0,0 +1,55 @@
+local servers = {
+ clangd = {},
+ zls = {}
+}
+
+require('blink.cmp').setup({
+ keymap = {
+ preset = 'default',
+ ['<C-n>'] = { function(cmp) cmp.show() end, 'select_next' },
+ ['<Enter>'] = { 'accept', 'fallback' },
+ },
+ completion = {
+ list = {
+ selection = { preselect = true, auto_insert = false },
+ },
+ menu = {
+ border = "rounded",
+ auto_show = false,
+ },
+ documentation = { window = { border = 'rounded' } },
+ },
+ signature = { window = { border = 'rounded' } },
+})
+
+vim.diagnostic.config({
+ virtual_text = false,
+ float = { border = "rounded" },
+ signs = false,
+ underline = true,
+ update_in_insert = false,
+ float = true,
+ jump = { float = true },
+})
+
+vim.api.nvim_create_autocmd("LspAttach", { callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+
+ map('n', 'E', '<cmd>lua vim.lsp.buf.hover()<CR>', { silent = true })
+
+ if client:supports_method(methods.textDocument_formatting) then
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ buffer = args.buf,
+ callback = function()
+ vim.lsp.buf.format({bufnr = args.buf, id = client_id})
+ end
+ })
+ end
+end})
+
+local lspconfig = require('lspconfig')
+
+for server, config in pairs(servers) do
+ config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
+ lspconfig[server].setup(config)
+end
diff --git a/modules/neovim/nvim/lua/config/settings.lua b/modules/neovim/nvim/lua/config/settings.lua
new file mode 100644
index 0000000..7893730
--- /dev/null
+++ b/modules/neovim/nvim/lua/config/settings.lua
@@ -0,0 +1,21 @@
+vim.g.mapleader = ' '
+
+vim.o.number = true
+vim.o.relativenumber = true
+vim.o.splitright = true
+vim.o.splitbelow = true
+vim.o.scrolloff = 15
+vim.o.wrap = false
+vim.o.lbr = true
+vim.o.shortmess = vim.o.shortmess .. "I"
+vim.o.termguicolors = true
+vim.opt.fillchars = {eob = " "}
+--vim.o.smd = false
+--vim.opt.laststatus = 3
+vim.opt.pumheight = 6
+vim.opt.shiftwidth = 8
+vim.opt.tabstop = 8
+vim.opt.expandtab = true
+vim.o.mouse=""
+vim.o.guicursor=""
+vim.o.swapfile=false