summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/init.lua28
-rw-r--r--.config/nvim/lua/lazy-nvim.lua35
-rw-r--r--.config/nvim/lua/misc.lua40
-rw-r--r--.config/nvim/lua/plugins/autopair.lua8
-rw-r--r--.config/nvim/lua/plugins/colorscheme.lua8
-rw-r--r--.config/nvim/lua/plugins/indentbars.lua16
-rw-r--r--.config/nvim/lua/plugins/telescope.lua27
-rw-r--r--.config/nvim/lua/plugins/treesitter.lua27
-rw-r--r--.config/nvim/lua/plugins/undotree.lua6
-rw-r--r--.config/nvim/lua/remap.lua31
-rw-r--r--.config/nvim/lua/settings.lua23
-rw-r--r--.config/nvim/lua/user/autocmds.lua22
-rw-r--r--.config/nvim/lua/user/init.lua0
-rw-r--r--.config/nvim/lua/user/keymaps.lua32
-rw-r--r--.config/nvim/lua/user/options.lua14
-rw-r--r--.config/nvim/lua/user/plugins/cmp.lua24
-rw-r--r--.config/nvim/lua/user/plugins/colorscheme.lua6
-rw-r--r--.config/nvim/lua/user/plugins/find-file.lua10
-rw-r--r--.config/nvim/lua/user/plugins/init.lua1
-rw-r--r--.config/nvim/lua/user/plugins/lspconfig.lua73
-rw-r--r--.config/nvim/lua/user/plugins/luadev.lua5
-rw-r--r--.config/nvim/lua/user/plugins/mini.lua7
-rw-r--r--.config/nvim/lua/user/plugins/trouble.lua5
-rw-r--r--.config/nvim/oldinit.lua319
24 files changed, 222 insertions, 545 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index dc60c4f..8fd5abe 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,6 +1,24 @@
-require("misc")
-require("settings")
-require("remap")
+require('user.options')
+require('user.keymaps')
+require('user.autocmds')
+
+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)
+
+require('lazy').setup(
+ 'user.plugins',
+ {
+ change_detection = { enabled = false }
+ }
+)
--- add plugins
-require("lazy-nvim")
diff --git a/.config/nvim/lua/lazy-nvim.lua b/.config/nvim/lua/lazy-nvim.lua
deleted file mode 100644
index f5ee74c..0000000
--- a/.config/nvim/lua/lazy-nvim.lua
+++ /dev/null
@@ -1,35 +0,0 @@
--- Bootstrap lazy.nvim
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
-if not (vim.uv or vim.loop).fs_stat(lazypath) then
- local lazyrepo = "https://github.com/folke/lazy.nvim.git"
- local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
- if vim.v.shell_error ~= 0 then
- vim.api.nvim_echo({
- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
- { out, "WarningMsg" },
- { "\nPress any key to exit..." },
- }, true, {})
- vim.fn.getchar()
- os.exit(1)
- end
-end
-vim.opt.rtp:prepend(lazypath)
-
--- Make sure to setup `mapleader` and `maplocalleader` before
--- loading lazy.nvim so that mappings are correct.
--- This is also a good place to setup other settings (vim.opt)
-vim.g.mapleader = " "
-vim.g.maplocalleader = "\\"
-
--- Setup lazy.nvim
-require("lazy").setup({
- spec = {
- -- import your plugins
- { import = "plugins" },
- },
- -- Configure any other settings here. See the documentation for more details.
- -- colorscheme that will be used when installing plugins.
- install = { colorscheme = { "habamax" } },
- -- automatically check for plugin updates
- checker = { enabled = true },
-})
diff --git a/.config/nvim/lua/misc.lua b/.config/nvim/lua/misc.lua
deleted file mode 100644
index 588e8c9..0000000
--- a/.config/nvim/lua/misc.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-function FormatBuffer()
- local save_cursor = vim.fn.getpos('.')
- local save_view = vim.fn.winsaveview()
-
- vim.api.nvim_command('normal! ggVG')
- vim.api.nvim_command('normal! ==')
-
- vim.fn.setpos('.', save_cursor)
- vim.fn.winrestview(save_view)
-end
-
--- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
--- pattern = {"*"},
--- callback = function()
--- local save_cursor = vim.fn.getpos(".")
--- vim.cmd([[%s/\s\+$//e]])
--- vim.fn.setpos(".", save_cursor)
--- end,
--- })
-
--- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
--- pattern = { "*.tex" },
--- callback = function()
--- vim.cmd("!pdflatex *.tex")
--- end,
--- })
-
-vim.filetype.add {
- extension = {
- rasi = 'rasi',
- vert = "glsl",
- frag = "glsl",
- },
- pattern = {
- ['.*/waybar/config'] = 'jsonc',
- ['.*/mako/config'] = 'dosini',
- ['.*/kitty/*.conf'] = 'bash',
- ['.*/hypr/.*%.conf'] = 'hyprlang',
- },
-}
diff --git a/.config/nvim/lua/plugins/autopair.lua b/.config/nvim/lua/plugins/autopair.lua
deleted file mode 100644
index 40222e1..0000000
--- a/.config/nvim/lua/plugins/autopair.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-return {
- "windwp/nvim-autopairs",
- opt = true,
- event = "InsertEnter",
- config = function()
- require("nvim-autopairs").setup()
- end
-}
diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua
deleted file mode 100644
index 5fcd21a..0000000
--- a/.config/nvim/lua/plugins/colorscheme.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-return {
- "https://github.com/Mofiqul/dracula.nvim",
- lazy=false,
- priority=1000,
- config = function()
- vim.cmd.colorscheme("dracula")
- end
-}
diff --git a/.config/nvim/lua/plugins/indentbars.lua b/.config/nvim/lua/plugins/indentbars.lua
deleted file mode 100644
index 0a98358..0000000
--- a/.config/nvim/lua/plugins/indentbars.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-return {
- "lukas-reineke/indent-blankline.nvim",
- event = { "VeryLazy" },
- config = function()
- vim.opt.list = true
- vim.opt.listchars = {
- tab = "| ",
- }
- require("ibl").setup({
- indent = {
- tab_char = "|",
- char = "|"
- }
- })
- end,
-}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
deleted file mode 100644
index 58ec3f7..0000000
--- a/.config/nvim/lua/plugins/telescope.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return {
- 'nvim-telescope/telescope.nvim',
- dependencies = { 'nvim-lua/plenary.nvim' },
- config = function()
- require('telescope').setup({
- defaults = {
- sorting_strategy = "ascending",
- layout_strategy = 'bottom_pane',
- layout_config = {
- height = 10,
- },
- prompt_prefix = "",
- selection_caret = "",
- entry_prefix = "",
- border = true,
- borderchars = { "─", " ", " ", " ", "─", "─", " ", " " },
- preview = false,
- },
- })
- local builtin = require('telescope.builtin')
- vim.keymap.set('n', '<leader>f', builtin.find_files, {})
- vim.keymap.set('n', '<leader>r', builtin.live_grep, {})
- vim.keymap.set('n', '<leader>b', function()
- builtin.buffers({ sort_mru = true, ignore_current_buffer = true})
- end)
- end
-}
diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua
deleted file mode 100644
index 6ac96af..0000000
--- a/.config/nvim/lua/plugins/treesitter.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return {
- 'nvim-treesitter/nvim-treesitter',
- name = 'treesitter',
- build = ':TSUpdate',
- config = function()
- require('nvim-treesitter.configs').setup({
- ensure_installed = {
- "vimdoc", "c", "lua", "cpp",
- "bash", "css", "glsl", "nasm", "haskell",
- "hyprlang", "zig",
- },
- sync_install = false,
-
- auto_install = true,
-
- indent = {
- enable = true
- },
-
- highlight = {
- enable = true,
-
- additional_vim_regex_highlighting = { "markdown" },
- },
- })
- end
-}
diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua
deleted file mode 100644
index 1404add..0000000
--- a/.config/nvim/lua/plugins/undotree.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-return {
- "mbbill/undotree",
- config = function()
- vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
- end
-}
diff --git a/.config/nvim/lua/remap.lua b/.config/nvim/lua/remap.lua
deleted file mode 100644
index 6d842dc..0000000
--- a/.config/nvim/lua/remap.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-vim.g.mapleader = " "
-vim.g.maplocalleader = "\\"
-
--- vim.keymap.set("i", "<C-BS>", "<C-w>")
--- vim.keymap.set("v", "<", "<gv")
--- vim.keymap.set("v", ">", ">gv")
-
--- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
--- vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-
--- vim.keymap.set("n", "<leader>k", "<cmd>:bd<CR>")
-
-vim.keymap.set("n", "<leader>=", FormatBuffer)
-
--- vim.keymap.set({"n", "v"}, "<leader>d", "\"_d")
-vim.keymap.set("n", "<leader>p", "\"+p")
-vim.keymap.set("v", "<leader>y", "\"+y")
-
--- vim.keymap.set({"n", "i", "v", "s"}, "<F1>", "<Nop>")
-
-vim.keymap.set("n", "<leader>=", FormatBuffer)
-
--- insert mode moving
-vim.keymap.set('i', '<C-h>', '<Left>', opts)
-vim.keymap.set('i', '<C-j>', '<Down>', opts)
-vim.keymap.set('i', '<C-k>', '<Up>', opts)
-vim.keymap.set('i', '<C-l>', '<Right>', opts)
-
--- C-g to escape
-vim.keymap.set('i', '<C-g>', '<Esc>', opts)
-vim.keymap.set('v', '<C-g>', '<Esc>', opts)
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
deleted file mode 100644
index e750225..0000000
--- a/.config/nvim/lua/settings.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-vim.o.tabstop = 4
-vim.o.shiftwidth = 4
-vim.o.smartindent = true
-vim.opt.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir"
-vim.opt.undofile = true
-vim.opt.swapfile = false
-
-vim.opt.relativenumber = true
-vim.opt.number = true
-
-vim.opt.scrolloff = 7
-
-vim.opt.termguicolors = true
-vim.opt.background = "dark"
-
-vim.opt.incsearch = true
-
-vim.opt.signcolumn = "no"
-vim.opt.isfname:append("@-@")
-
-vim.opt.splitbelow = true
-vim.opt.splitright = true
-
diff --git a/.config/nvim/lua/user/autocmds.lua b/.config/nvim/lua/user/autocmds.lua
new file mode 100644
index 0000000..bff808a
--- /dev/null
+++ b/.config/nvim/lua/user/autocmds.lua
@@ -0,0 +1,22 @@
+-- Wrap and check for spell in text filetypes.
+vim.api.nvim_create_autocmd('FileType', {
+ group = vim.api.nvim_create_augroup('wrap_spell', { clear = true }),
+ pattern = { 'gitcommit', 'markdown' },
+ callback = function()
+ vim.opt_local.wrap = true
+ vim.opt_local.spell = true
+ end,
+})
+
+-- Go to last loc when opening a buffer.
+vim.api.nvim_create_autocmd('BufReadPost', {
+ group = vim.api.nvim_create_augroup('last_loc', { clear = true }),
+ callback = function()
+ local mark = vim.api.nvim_buf_get_mark(0, '"')
+ local lcount = vim.api.nvim_buf_line_count(0)
+ if mark[1] > 0 and mark[1] <= lcount then
+ -- Protected call to catch errors.
+ pcall(vim.api.nvim_win_set_cursor, 0, mark)
+ end
+ end,
+})
diff --git a/.config/nvim/lua/user/init.lua b/.config/nvim/lua/user/init.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.config/nvim/lua/user/init.lua
diff --git a/.config/nvim/lua/user/keymaps.lua b/.config/nvim/lua/user/keymaps.lua
new file mode 100644
index 0000000..0a6d7f7
--- /dev/null
+++ b/.config/nvim/lua/user/keymaps.lua
@@ -0,0 +1,32 @@
+-- Remap for dealing with word wrap
+vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
+vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
+
+-- Move to window using the <C-hjkl> keys
+vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Switch to left window' })
+vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Switch to lower window' })
+vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Switch to upper window' })
+vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Switch to right window' })
+
+-- Quickfix list
+vim.keymap.set('n', '[q', vim.cmd.cprev, { desc = 'Previous quickfix item' })
+vim.keymap.set('n', ']q', vim.cmd.cnext, { desc = 'Next quickfix item' })
+
+-- Diagnostics
+vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to prev diagnostic message' })
+vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
+vim.keymap.set('n', 'gl', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
+vim.keymap.set('n', '<leader>q', vim.diagnostic.setqflist, { desc = 'Open diagnostic quickfix list' })
+
+-- Nagivation in insert
+vim.keymap.set('i', '<C-h>', '<Left>', { desc = "Forward char" })
+vim.keymap.set('i', '<C-j>', '<C-o>gj', { desc = "Up char" })
+vim.keymap.set('i', '<C-k>', '<C-o>gk', { desc = "Forward char" })
+vim.keymap.set('i', '<C-l>', '<Right>', { desc = "Forward char" })
+
+-- <C-g> to exit
+vim.keymap.set({'i', 'n', 'v', 'c'}, '<C-g>', '<Esc>', { desc = "Exit mode" })
+vim.cmd('cmap <C-g> <C-c>')
+
+-- C-d to delete
+vim.keymap.set('i', '<C-d>', '<Del>', { desc = "Delete forward char"})
diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua
new file mode 100644
index 0000000..ef987ff
--- /dev/null
+++ b/.config/nvim/lua/user/options.lua
@@ -0,0 +1,14 @@
+vim.opt.tabstop = 4
+vim.opt.shiftwidth = 0
+vim.opt.expandtab = false
+
+vim.opt.shortmess:append { s = true, I = true }
+
+vim.g.mapleader = ' '
+vim.g.maplocalleader = '\\'
+
+vim.opt.signcolumn="yes"
+
+vim.diagnostic.config({
+ virtual_text = true
+})
diff --git a/.config/nvim/lua/user/plugins/cmp.lua b/.config/nvim/lua/user/plugins/cmp.lua
new file mode 100644
index 0000000..8776310
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/cmp.lua
@@ -0,0 +1,24 @@
+return {
+ 'hrsh7th/nvim-cmp',
+ event = { 'InsertEnter', 'CmdlineEnter' },
+ dependencies = {
+ 'hrsh7th/cmp-buffer',
+ 'hrsh7th/cmp-cmdline',
+ 'hrsh7th/cmp-path',
+ },
+ opts = function()
+ local cmp = require('cmp')
+
+ return {
+ mapping = cmp.mapping.preset.insert(),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ }, {
+ { name = 'buffer' },
+ }, {
+ { name = 'path' },
+ })
+ }
+ end,
+}
+
diff --git a/.config/nvim/lua/user/plugins/colorscheme.lua b/.config/nvim/lua/user/plugins/colorscheme.lua
new file mode 100644
index 0000000..7862f25
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/colorscheme.lua
@@ -0,0 +1,6 @@
+return {
+ "Mofiqul/dracula.nvim",
+ config = function ()
+ vim.cmd[[colorscheme dracula]]
+ end
+}
diff --git a/.config/nvim/lua/user/plugins/find-file.lua b/.config/nvim/lua/user/plugins/find-file.lua
new file mode 100644
index 0000000..b547d10
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/find-file.lua
@@ -0,0 +1,10 @@
+return {
+ "NAHTAIV3L/vertico.nvim",
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ },
+ config = function ()
+ vim.keymap.set("n", "<leader>f", require("vertico").find_file)
+ vim.keymap.set("n", "<C-g>", require("vertico").close)
+ end
+}
diff --git a/.config/nvim/lua/user/plugins/init.lua b/.config/nvim/lua/user/plugins/init.lua
new file mode 100644
index 0000000..a564707
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/init.lua
@@ -0,0 +1 @@
+return {}
diff --git a/.config/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua
new file mode 100644
index 0000000..371fdec
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/lspconfig.lua
@@ -0,0 +1,73 @@
+local on_attach = function(client, bufnr)
+ local keymap = function(mode, keys, func, opts)
+ opts.buffer = bufnr
+ vim.keymap.set(mode, keys, func, opts)
+ end
+
+ keymap('n', 'gd', vim.lsp.buf.definition, { desc = 'Go to definition' })
+ keymap('n', 'gD', vim.lsp.buf.declaration, { desc = 'Go to declaration' })
+ keymap('n', 'gI', vim.lsp.buf.implementation, { desc = 'Go to implementation' })
+ keymap('n', 'gy', vim.lsp.buf.type_definition, { desc = 'Go to type definition' })
+ keymap('n', 'gr', vim.lsp.buf.references, { desc = 'List references' })
+
+ keymap('n', '<leader>ds', vim.lsp.buf.document_symbol, { desc = 'List document symbols' })
+ keymap('n', '<leader>ws', vim.lsp.buf.workspace_symbol, { desc = 'List workspace symbols' })
+
+ keymap('n', 'K', vim.lsp.buf.hover, { desc = 'Show documentation' })
+ keymap('n', 'gK', vim.lsp.buf.signature_help, { desc = 'Show signature' })
+ keymap('i', '<C-k>', vim.lsp.buf.signature_help, { desc = 'Show signature' })
+
+ keymap('n', '<leader>rn', vim.lsp.buf.rename, { desc = 'Rename symbol' })
+ keymap('n', '<leader>ca', vim.lsp.buf.code_action, { desc = 'Code action' })
+
+ keymap('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, { desc = 'Add workspace folder' })
+ keymap('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, { desc = 'Remove workspace folder' })
+ keymap(
+ 'n',
+ '<leader>wl',
+ function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end,
+ { desc = 'List workspace folders' }
+ )
+end
+
+return {
+ 'neovim/nvim-lspconfig',
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ },
+ ft = { 'lua', 'zig' },
+ opts = {
+ servers = {
+ lua_ls = {
+ settings = {
+ Lua = {
+ workspace = { checkThirdParty = false },
+ telemetry = { enable = false },
+ },
+ },
+ },
+ zls = {
+ settings = {},
+ },
+ },
+ },
+ config = function(_, opts)
+ local lspconfig = require('lspconfig');
+ local capabilities = require('cmp_nvim_lsp').default_capabilities()
+
+ for name, conf in pairs(opts.servers) do
+ lspconfig[name].setup {
+ capabilities = capabilities,
+ settings = conf.settings,
+ on_attach = function(client, bufnr)
+ local _, err = pcall(on_attach, client, bufnr)
+ if err then
+ vim.notify('[on_attach] error: ' .. err, vim.log.levels.ERROR)
+ else
+ vim.notify('[on_attach] ' .. client.name .. ' attached to buffer ' .. bufnr, vim.log.levels.INFO)
+ end
+ end,
+ }
+ end
+ end
+}
diff --git a/.config/nvim/lua/user/plugins/luadev.lua b/.config/nvim/lua/user/plugins/luadev.lua
new file mode 100644
index 0000000..7011f66
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/luadev.lua
@@ -0,0 +1,5 @@
+return {
+ "folke/lazydev.nvim",
+ ft = "lua",
+ config = true,
+}
diff --git a/.config/nvim/lua/user/plugins/mini.lua b/.config/nvim/lua/user/plugins/mini.lua
new file mode 100644
index 0000000..879c14d
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/mini.lua
@@ -0,0 +1,7 @@
+return {
+ {
+ 'echasnovski/mini.pairs',
+ event = 'InsertEnter',
+ config = true,
+ },
+}
diff --git a/.config/nvim/lua/user/plugins/trouble.lua b/.config/nvim/lua/user/plugins/trouble.lua
new file mode 100644
index 0000000..1e81a92
--- /dev/null
+++ b/.config/nvim/lua/user/plugins/trouble.lua
@@ -0,0 +1,5 @@
+return {
+ "folke/trouble.nvim",
+ config = true,
+ cmd = "Trouble"
+}
diff --git a/.config/nvim/oldinit.lua b/.config/nvim/oldinit.lua
deleted file mode 100644
index fafc8f8..0000000
--- a/.config/nvim/oldinit.lua
+++ /dev/null
@@ -1,319 +0,0 @@
-vim.g.mapleader = " "
-
--- LAZY
-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",
- lazypath,
- })
-end
-vim.opt.rtp:prepend(lazypath)
-
--- Packages
-require("lazy").setup({
- {
- "https://github.com/junegunn/fzf.vim",
- dependencies = {
- "https://github.com/junegunn/fzf",
- },
- keys = {
- { "<Leader><Leader>", "<Cmd>Files<CR>", desc = "Find files" },
- { "<Leader>b", "<Cmd>Buffers<CR>", desc = "Find buffers" },
- { "<Leader>/", "<Cmd>Rg<CR>", desc = "Search project" },
- },
- },
- {
- "https://github.com/stevearc/oil.nvim",
- config = function()
- require("oil").setup()
- end,
- keys = {
- { "-", "<Cmd>Oil<CR>", desc = "Browse files from here" },
- },
- },
- {
- "https://github.com/windwp/nvim-autopairs",
- event = "InsertEnter", -- Only load when you enter Insert mode
- config = function()
- require("nvim-autopairs").setup()
- end,
- },
- {
- "https://github.com/numToStr/Comment.nvim",
- event = "VeryLazy", -- Special lazy.nvim event for things that can load later and are not important for the initial UI
- config = function()
- require("Comment").setup()
- end,
- },
- {
- "https://github.com/tpope/vim-sleuth",
- event = { "BufReadPost", "BufNewFile" }, -- Load after your file content
- },
- {
- "nvim-treesitter/nvim-treesitter",
- build = ":TSUpdate",
- config = function ()
- local configs = require("nvim-treesitter.configs")
-
- configs.setup({
- ensure_installed = { "c", "lua", "html", "zig" },
- sync_install = false,
- highlight = { enable = true },
- indent = { enable = true },
- incremental_selection = {
- enable = true,
- keymaps = {
- node_incremental = "v",
- node_decremental = "V",
- },
- },
- })
- end
- },
- {
- "https://github.com/farmergreg/vim-lastplace",
- event = "BufReadPost",
- },
- {
- "https://github.com/NeogitOrg/neogit",
- dependencies = {
- "nvim-lua/plenary.nvim",
- "sindrets/diffview.nvim"
- },
- cmd = "Neogit", -- Only load when you run the Neogit command
- config = function()
- require("neogit").setup()
- end,
- },
- {
- "https://github.com/Mofiqul/dracula.nvim",
- lazy=false,
- priority=1000,
- },
- {
- "neovim/nvim-lspconfig",
- dependencies = {
- "williamboman/mason.nvim",
- "williamboman/mason-lspconfig.nvim",
- "L3MON4D3/LuaSnip",
- 'saghen/blink.cmp',
- },
- config = function()
- local blink = require('blink.cmp')
- local capabilities = vim.tbl_deep_extend(
- "force",
- {},
- vim.lsp.protocol.make_client_capabilities(),
- blink.get_lsp_capabilities())
- require("mason").setup({
- PATH = "append",
- })
- require("mason-lspconfig").setup({
- ensure_installed = {
- "lua_ls",
- "zls",
- "texlab",
- "clangd",
- },
- handlers = {
- function(server_name) -- default handler (optional)
- require("lspconfig")[server_name].setup {
- capabilities = capabilities
- }
- end,
- ["zls"] = function ()
- vim.g.zig_fmt_parse_errors = 0
- vim.g.zig_fmt_autosave = 0
- local lspconfig = require("lspconfig")
- lspconfig.zls.setup({
- capabilities = capabilities,
- autoformat = false,
- })
- end,
- ["lua_ls"] = function()
- local lspconfig = require("lspconfig")
- lspconfig.lua_ls.setup {
- capabilities = capabilities,
- settings = {
- Lua = {
- runtime = { version = "Lua 5.1" },
- diagnostics = {
- globals = { "bit", "vim", "it", "describe", "before_each", "after_each" },
- }
- }
- }
- }
- end,
- }
- })
- vim.diagnostic.config({
- -- update_in_insert = true,
- float = {
- focusable = false,
- style = "minimal",
- border = "rounded",
- source = true,
- header = "",
- prefix = "",
- },
- })
- vim.api.nvim_create_autocmd('LspAttach', {
- callback = function(event)
- local opts = {buffer = event.buf}
- vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
- vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
- vim.keymap.set('n', 'go', vim.lsp.buf.type_definition, opts)
- vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
- vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, opts)
- vim.keymap.set('n', '<F2>', vim.lsp.buf.rename, opts)
- vim.keymap.set({'n', 'x'}, '<F3>', vim.lsp.buf.format, opts)
- vim.keymap.set('n', '<F4>', vim.lsp.buf.code_action, opts)
- end,
- })
- end
- },
- {
- 'dnlhc/glance.nvim',
- cmd = 'Glance'
- },
- {
- 'saghen/blink.cmp',
- version = "*",
- -- build = "cargo build --release",
- opts = {
- snippets = { preset = 'luasnip', },
- completion = {
- keyword = {
- range = 'prefix',
- },
- trigger = {
- -- show_in_snippet = false,
- -- show_on_keyword = false,
- -- show_on_trigger_character = false,
- -- show_on_accept_on_trigger_character = false,
- -- show_on_insert_on_trigger_character = false,
- },
- list = {
- selection = {
- preselect = false,
- auto_insert = false,
- },
- },
- menu = {
- draw = {
- columns = { { "label", "label_description", gap = 1 }, { "kind" , "source_name", gap = 1} },
- },
- },
- documentation = {
- auto_show = true,
- },
- ghost_text = {
- enabled = true,
- },
- },
- fuzzy = {
- prebuilt_binaries = {
- download = true,
- },
- },
- keymap = {
- preset = 'default',
- ['<Tab>'] = { 'accept', 'fallback' },
- ['<CR>'] = { 'accept', 'fallback' },
- ['<C-M-i>'] = { 'show', 'select_and_accept', 'fallback' },
- },
- cmdline = {
- completion = {
- list = {
- selection = {
- preselect = false,
- auto_insert = false,
- },
- },
- },
- keymap = {
- preset = 'cmdline',
- ['<Tab>'] = { 'show', 'accept', 'fallback' },
- ['<CR>'] = { 'accept', 'fallback' },
- ['<C-M-i>'] = { 'show', 'select_and_accept', 'fallback' },
- },
- },
- sources = {
- default = { 'lsp', 'path', 'snippets', 'buffer' },
- providers = {
- buffer = {
- name = 'Buffer',
- module = 'blink.cmp.sources.buffer',
- opts = {
- -- all buffers of same filetype
- get_bufnrs = function()
- return vim
- .iter(vim.api.nvim_list_bufs())
- :filter(
- function (buf)
- return vim.bo[buf].buftype ~= 'nofile'
- and vim.bo[buf].filetype == vim.bo.filetype
- end)
- :totable()
- end,
- }
- },
- }
- },
- },
- }
-})
-
-vim.cmd.colorscheme("dracula")
-
-vim.opt.number = true
-vim.opt.relativenumber = true
-
-vim.opt.splitbelow = true
-vim.opt.splitright = true
-
-vim.o.shiftwidth = 4
-vim.o.tabstop = 4;
-vim.o.expandtab = false
-vim.opt.signcolumn = "no"
-vim.o.smartindent = true;
-
-vim.opt.swapfile = false
-vim.opt.backup = false
-vim.opt.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir"
-vim.opt.undofile = true
-
-vim.opt.pumheight = 8
-
-vim.opt.scrolloff = 7
-
-vim.opt.list = true
-vim.opt.listchars = { tab = " " }
-
--- Map movement keys in insert and command modes
-local map = vim.api.nvim_set_keymap
-local opts = { noremap = true }
-
--- Insert mode mappings
-map('i', '<C-h>', '<Left>', opts)
-map('i', '<C-j>', '<Down>', opts)
-map('i', '<C-k>', '<Up>', opts)
-map('i', '<C-l>', '<Right>', opts)
-
--- Command-line mode mappings
-map('c', '<C-h>', '<Left>', opts)
-map('c', '<C-j>', '<Down>', opts)
-map('c', '<C-k>', '<Up>', opts)
-map('c', '<C-l>', '<Right>', opts)
-
-map('i', '<C-g>', '<Esc>', opts)
-map('v', '<C-g>', '<Esc>', opts)
-
-vim.keymap.set('n', 'gR', '<CMD>Glance references<CR>')