Compare commits
22 Commits
fbbd0c5512
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 82af4d91d4 | |||
| f0378b57e6 | |||
| c62cbcd80d | |||
| b0e4d0b4be | |||
| 4717d2726c | |||
| f14f03bd88 | |||
| 1d563ec9d4 | |||
| 8de9de662f | |||
| 14edeb2713 | |||
| 92a6cfc071 | |||
| 89e118f1a1 | |||
| 670ecf53dd | |||
| 4c81d0b05b | |||
| a56b8f7029 | |||
|
|
50b8c88e92 | ||
|
|
9ce77dacc9 | ||
|
|
c9bcbf2327 | ||
|
|
e3762ced4e | ||
|
|
8b714fabfa | ||
|
|
9b831f0e3a | ||
|
|
f942ea2f91 | ||
|
|
b366437a6a |
9
after/ftplugin/rust.lua
Normal file
9
after/ftplugin/rust.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
|
||||
local default_diagnostic_handler = vim.lsp.handlers[method]
|
||||
vim.lsp.handlers[method] = function(err, result, context, config)
|
||||
if err ~= nil and err.code == -32802 then
|
||||
return
|
||||
end
|
||||
return default_diagnostic_handler(err, result, context, config)
|
||||
end
|
||||
end
|
||||
17
init.lua
17
init.lua
@@ -13,7 +13,6 @@ end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.g.mapleader = " "
|
||||
require("lazy").setup("plugins")
|
||||
require("maps").init()
|
||||
require("commands")
|
||||
|
||||
vim.opt.backup = false
|
||||
@@ -31,6 +30,15 @@ vim.opt.sidescrolloff = 8
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.autochdir = false
|
||||
vim.opt.clipboard = 'unnamed,unnamedplus'
|
||||
in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil
|
||||
if in_wsl then
|
||||
vim.g.clipboard = {
|
||||
name = 'wsl clipboard',
|
||||
copy = { ["+"] = { "clip.exe" }, ["*"] = { "clip.exe" } },
|
||||
paste = { ["+"] = { "win32yank.exe" }, ["*"] = { "win32yank.exe" } },
|
||||
cache_enabled = true
|
||||
}
|
||||
end
|
||||
vim.opt.number = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.signcolumn = 'yes:2'
|
||||
@@ -43,3 +51,10 @@ vim.opt.expandtab = false
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
--vim.opt.foldmethod = "expr"
|
||||
--vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
--vim.opt.foldtext = ""
|
||||
--vim.opt.foldlevelstart = 1
|
||||
--vim.opt.foldnestmax = 2
|
||||
|
||||
-- TODO replace config with opts in every plugin
|
||||
|
||||
@@ -1,37 +1,41 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "e5f7b8a804360f0a48e40d0083a97193ee4fcc87" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "b45d21d33d61ed9295308eb6571c0a5f0f7f3765" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "48ca9aaee733911424646cb1605f27bc01dedbe3" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "99e4b2081de1d9162666cc7b563cbeb01c26b66b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a67bc39aaa4f1e13212c5022a561120846eaef27" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "047ce49ccf9a2dce22e1cf3843bef3b5682a8144" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a1067cf84b4ff81b66d2bf4d01f4cbdb5de40bd0" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||
"minuet-ai.nvim": { "branch": "main", "commit": "2083b86ea01cb18dc9e7cb7a68f932ea06e999e8" },
|
||||
"mssql.nvim": { "branch": "main", "commit": "51bf5e8629c2f0153160e36afb57a3743b9b6fd9" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "b69924ca90014fef485ee153571bdcbc1ece8c2e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ef73a4f2a1ddf0439eb97b46de2aab265ddba1cd" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
|
||||
"vimwiki": { "branch": "dev", "commit": "705ad1e0dded0e3b7ff5fac78547ab67c9d39bdf" }
|
||||
"trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" },
|
||||
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
|
||||
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
|
||||
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
-- I don't know why but whenever I accidentally type :W instead of :w, I slows down the ide and reverts all changes
|
||||
-- It doesn't even save files with sudo...
|
||||
-- vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
|
||||
-- Array of file names indicating root directory. Modify to your liking.
|
||||
local root_names = { '.git', 'Makefile' }
|
||||
local root_names = { '.git', 'Makefile', 'justfile', 'CMakeLists.txt', 'maskfile.md' }
|
||||
|
||||
-- Cache to use for speed up (at cost of possibly outdated results)
|
||||
local root_cache = {}
|
||||
@@ -35,3 +37,18 @@ end
|
||||
|
||||
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
|
||||
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })
|
||||
|
||||
local function set_makeprg()
|
||||
local cwd = vim.fn.getcwd()
|
||||
|
||||
if vim.fn.filereadable(cwd .. '/justfile') == 1 then
|
||||
vim.o.makeprg = 'just'
|
||||
elseif vim.fn.filereadable(cwd .. '/Makefile') == 1 then
|
||||
vim.o.makeprg = 'make'
|
||||
elseif vim.fn.filereadable(cwd .. '/maskfile.md') == 1 then
|
||||
vim.o.makeprg = 'mask'
|
||||
end
|
||||
end
|
||||
|
||||
local makeprg_augroup = vim.api.nvim_create_augroup('MyMakeprg', {})
|
||||
vim.api.nvim_create_autocmd('BufEnter', { pattern = '*', group = makeprg_augroup, callback = set_makeprg, })
|
||||
|
||||
55
lua/maps.lua
55
lua/maps.lua
@@ -1,55 +0,0 @@
|
||||
-- maps.lua
|
||||
|
||||
local maps = {}
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function maps.term()
|
||||
-- Open and move to resized terminal
|
||||
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', { noremap = false })
|
||||
-- Enter normal mode in terminal
|
||||
map('t', 'ß<C-N>', '<C-\\><C-N>')
|
||||
end
|
||||
|
||||
function maps.telescope()
|
||||
map('n', '<Leader>ff', '<cmd>lua require(\'telescope.builtin\').git_files()<CR>')
|
||||
map('n', '<Leader>fg', '<cmd>lua require(\'telescope.builtin\').live_grep()<CR>')
|
||||
map('n', '<Leader>fb', '<cmd>lua require(\'telescope.builtin\').buffers()<CR>')
|
||||
map('n', '<Leader>fh', '<cmd>lua require(\'telescope.builtin\').help_tags()<CR>')
|
||||
end
|
||||
|
||||
function maps.fixIndent()
|
||||
map('v', '<', '<gv')
|
||||
map('v', '>', '>gv')
|
||||
end
|
||||
|
||||
function maps.moveByRow()
|
||||
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
|
||||
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', { silent = true, expr = true })
|
||||
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', { silent = true, expr = true })
|
||||
end
|
||||
|
||||
function maps.centeredSearch()
|
||||
map('n', 'n', 'nzzzv')
|
||||
map('n', 'N', 'Nzzzv')
|
||||
end
|
||||
|
||||
function maps.init()
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- map('n', '<leader>b', '<cmd>NvimTreeToggle<CR>')
|
||||
map('n', '<leader>b', '<cmd>Lexplore | vert res 30<CR>')
|
||||
map('n', '<leader>cc', '<cmd>Telescope colorscheme<CR>')
|
||||
|
||||
maps.term()
|
||||
maps.telescope()
|
||||
maps.fixIndent()
|
||||
maps.moveByRow()
|
||||
maps.centeredSearch()
|
||||
end
|
||||
|
||||
return maps
|
||||
44
lua/plugins/ai.lua
Normal file
44
lua/plugins/ai.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
return {
|
||||
-- I don't know if I use this wrong or what but opencode does not seem to work that well
|
||||
-- {
|
||||
-- 'NickvanDyke/opencode.nvim',
|
||||
-- dependencies = { 'folke/snacks.nvim', },
|
||||
-- ---@type opencode.Config
|
||||
-- opts = {
|
||||
-- port = 48291,
|
||||
-- },
|
||||
-- -- stylua: ignore
|
||||
-- keys = {
|
||||
-- { '<leader>ot', function() require('opencode').toggle({ port = 48291 }) end, desc = 'Toggle embedded opencode', },
|
||||
-- { '<leader>oa', function() require('opencode').ask() end, desc = 'Ask opencode', mode = 'n', },
|
||||
-- { '<leader>oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', },
|
||||
-- { '<leader>op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, },
|
||||
-- { '<leader>on', function() require('opencode').command('session_new') end, desc = 'New session', },
|
||||
-- { '<leader>oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', },
|
||||
-- { '<S-C-u>', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', },
|
||||
-- { '<S-C-d>', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', },
|
||||
-- },
|
||||
-- },
|
||||
-- This is great tho
|
||||
{
|
||||
'milanglacier/minuet-ai.nvim',
|
||||
dependencies = { 'hrsh7th/nvim-cmp', 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('minuet').setup {
|
||||
-- Your configuration options here
|
||||
provider_options = {
|
||||
codestral = {
|
||||
model = 'codestral-latest',
|
||||
end_point = 'https://codestral.mistral.ai/v1/fim/completions',
|
||||
api_key = 'CODESTRAL_API_KEY',
|
||||
stream = true,
|
||||
optional = {
|
||||
stop = { '\n\n' }, -- the identifier to stop the completion generation
|
||||
max_tokens = 256,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,17 +1,37 @@
|
||||
return {
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
lazy = true,
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local wk = require("which-key")
|
||||
local dap = require("dap")
|
||||
wk.add({
|
||||
{ '<leader>d', group = "dap" },
|
||||
{ '<leader>db', dap.toggle_breakpoint, desc = "Toggle breakpoint" },
|
||||
{ '<leader>dc', dap.continue, desc = "Launch/resume debug session" },
|
||||
{ '<leader>do', dap.step_over, desc = "Step over" },
|
||||
{ '<leader>di', dap.step_into, desc = "Step into" },
|
||||
{ '<leader>du', dap.step_out, desc = "Step out" },
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'rcarriga/nvim-dap-ui',
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("dapui").setup()
|
||||
local dapui = require("dapui")
|
||||
dapui.setup()
|
||||
local wk = require("which-key")
|
||||
wk.add({
|
||||
{ '<leader>dd', dapui.toggle, desc = "Toggle dap ui" }
|
||||
})
|
||||
end,
|
||||
dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }
|
||||
},
|
||||
{
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
lazy = true,
|
||||
config = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', ',d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', '.d', vim.diagnostic.goto_next, opts)
|
||||
|
||||
local lsp_attach = function(client, buf)
|
||||
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf })
|
||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf })
|
||||
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf })
|
||||
|
||||
vim.lsp.inlay_hint.enable(true, nil)
|
||||
|
||||
local bufopts = { noremap = true, silent = true, buffer = buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
local wk = require("which-key")
|
||||
|
||||
local diag_next = function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end
|
||||
|
||||
local diag_prev = function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end
|
||||
|
||||
wk.add({
|
||||
{ '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" },
|
||||
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
|
||||
{ '[d', diag_prev, bufopts },
|
||||
{ ']d', diag_next, bufopts },
|
||||
|
||||
{ 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" },
|
||||
{ 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" },
|
||||
{ 'gi', vim.lsp.buf.implementation, bufopts, desc = "Go to implementation" },
|
||||
{ '<C-k>', vim.lsp.buf.signature_help, bufopts, desc = "Show signature" },
|
||||
{ '<leader>rn', vim.lsp.buf.rename, bufopts, desc = "Rename" },
|
||||
{ '<leader>ca', vim.lsp.buf.code_action, bufopts, desc = "Show code actions" },
|
||||
{ 'gr', require("telescope.builtin").lsp_references, bufopts, desc = "Shwo references" },
|
||||
})
|
||||
end
|
||||
|
||||
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
|
||||
@@ -34,21 +44,25 @@ return {
|
||||
-- lsp
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
lazy = true,
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
config = true
|
||||
--config = function()
|
||||
-- ensure_installed = { "lua_ls", "ts_ls", "gopls", "rust_analyzer", "bashls", "sqlls", "html", "cssls",
|
||||
-- "tailwindcss", "phpactor", "julials", "glsl_analyzer", "wgsl_analyzer", "emmet_language_server", "zls" }
|
||||
--end
|
||||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
vim.lsp.config('lua_ls', {
|
||||
capabilities = capabilities,
|
||||
root_dir = lspconfig.util.root_pattern('.git'),
|
||||
root_markers = { '.git' },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
@@ -67,58 +81,105 @@ return {
|
||||
}
|
||||
},
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.tsserver.setup {
|
||||
})
|
||||
vim.lsp.config('ts_ls', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.gopls.setup {
|
||||
})
|
||||
vim.lsp.config('gopls', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
--lspconfig.rust_analyzer.setup {
|
||||
})
|
||||
--vim.lsp.config(rust_analyzer.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = lsp_attach
|
||||
--}
|
||||
lspconfig.bashls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.sqlls.setup({
|
||||
--})
|
||||
vim.lsp.config('bashls', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.html.setup({
|
||||
vim.lsp.config('sqlls', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.cssls.setup({
|
||||
vim.lsp.config('html', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.tailwindcss.setup({
|
||||
vim.lsp.config('cssls', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.phpactor.setup({
|
||||
vim.lsp.config('tailwindcss', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
lspconfig.emmet_ls.setup({
|
||||
vim.lsp.config('phpactor', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
vim.lsp.config('julials', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
vim.lsp.config('wgsl_analyzer', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
vim.lsp.config('glsl_analyzer', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
vim.lsp.config('emmet_ls', {
|
||||
filetypes = { "css", "html", "javascript", "typescript" },
|
||||
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
|
||||
-- **Note:** only the options listed in the table are supported.
|
||||
init_options = {
|
||||
---@type table<string, string>
|
||||
includeLanguages = {},
|
||||
--- @type string[]
|
||||
excludeLanguages = {},
|
||||
--- @type string[]
|
||||
extensionsPath = {},
|
||||
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
|
||||
preferences = {},
|
||||
--- @type boolean Defaults to `true`
|
||||
showAbbreviationSuggestions = true,
|
||||
--- @type "always" | "never" Defaults to `"always"`
|
||||
showExpandedAbbreviation = "always",
|
||||
--- @type boolean Defaults to `false`
|
||||
showSuggestionsAsSnippets = false,
|
||||
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
|
||||
syntaxProfiles = {},
|
||||
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
|
||||
variables = {},
|
||||
},
|
||||
})
|
||||
-- vim.lsp.config('ccls.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = lsp_attach,
|
||||
-- })
|
||||
vim.lsp.config('clangd', {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach,
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = "^4",
|
||||
version = "^6",
|
||||
lazy = false,
|
||||
ft = { "rust" },
|
||||
config = function()
|
||||
local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer"))
|
||||
if rust_analyzer_path == "" then
|
||||
vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer",
|
||||
vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
cmd = { rust_analyzer_path },
|
||||
on_attach = lsp_attach,
|
||||
settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
@@ -127,16 +188,11 @@ return {
|
||||
extraArgs = { "+nightly" },
|
||||
},
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
loadOutDirsFromCheck = true,
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
checkOnSave = true,
|
||||
-- TODO this breaks diagnostics, look into what can be done
|
||||
-- procMacro = {
|
||||
-- enable = true,
|
||||
@@ -281,6 +337,15 @@ return {
|
||||
jdtls.start_or_attach(config)
|
||||
end
|
||||
},
|
||||
{
|
||||
"Kurren123/mssql.nvim",
|
||||
opts = {
|
||||
-- optional
|
||||
keymap_prefix = "<leader>m"
|
||||
},
|
||||
-- optional
|
||||
dependencies = { "folke/which-key.nvim" }
|
||||
},
|
||||
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
@@ -325,7 +390,15 @@ return {
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 5 },
|
||||
{ name = 'minuet' },
|
||||
}),
|
||||
performance = {
|
||||
-- It is recommended to increase the timeout duration due to
|
||||
-- the typically slower response speed of LLMs compared to
|
||||
-- other completion sources. This is not needed when you only
|
||||
-- need manual completion.
|
||||
fetching_timeout = 2000,
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
with_text = true,
|
||||
@@ -335,6 +408,7 @@ return {
|
||||
nvim_lua = "[api]",
|
||||
path = "[path]",
|
||||
luasnip = "[snip]",
|
||||
minuet = "[llm]",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,53 @@ return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '0.1.*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local telescope = require("telescope.builtin")
|
||||
local wk = require("which-key")
|
||||
wk.add({
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gh", telescope.git_bcommits, { noremap = true, silent = true }, desc = "View commits of current buffer" },
|
||||
{ "<leader>gb", telescope.git_branches, { noremap = true, silent = true }, desc = "View git branches" },
|
||||
{ "<leader>gs", telescope.git_status, { noremap = true, silent = true }, desc = "View git status" },
|
||||
{ "<leader>f", group = "find" },
|
||||
{ '<Leader>ff', telescope.git_files, { noremap = true, silent = true }, desc = "Search files" },
|
||||
{ '<Leader>fg', telescope.live_grep, { noremap = true, silent = true }, desc = "Search in files" },
|
||||
{ '<Leader>fb', telescope.buffers, { noremap = true, silent = true }, desc = "Search in buffers" },
|
||||
{ '<Leader>fh', telescope.help_tags, { noremap = true, silent = true }, desc = "Search in help" },
|
||||
{ '<Leader>fk', telescope.keymaps, { noremap = true, silent = true }, desc = "Search in keymaps" },
|
||||
{ '<leader>cc', telescope.colorscheme, desc = "Select colorscheme" },
|
||||
})
|
||||
require("telescope.config").set_defaults({
|
||||
file_ignore_patterns = { "doc/" }
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
dependencies = { 'nvim-telescope/telescope.nvim' },
|
||||
config = function()
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-h>"] = "which_key"
|
||||
}
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
colorscheme = {
|
||||
enable_preview = true,
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_cursor()
|
||||
}
|
||||
}
|
||||
}
|
||||
require("telescope").load_extension("ui-select")
|
||||
end
|
||||
}
|
||||
-- Don't really need it. Nicer than the default but that's it
|
||||
-- {
|
||||
-- 'nvim-tree/nvim-tree.lua',
|
||||
|
||||
@@ -5,20 +5,21 @@ return {
|
||||
vim.opt.guifont = 'Source Code Pro for Powerline'
|
||||
vim.cmd('set termguicolors')
|
||||
vim.opt.syntax = 'on'
|
||||
require('kanagawa').setup({
|
||||
colors = {
|
||||
palette = {
|
||||
lotusGray = "#F8F7F4",
|
||||
lotusWhite0 = "#FBFBF9",
|
||||
lotusWhite1 = "#F2F0E9",
|
||||
lotusWhite2 = "#F8F7F2",
|
||||
lotusWhite3 = "#F6F6F1",
|
||||
lotusWhite4 = "#F4F1E6",
|
||||
lotusWhite5 = "#FcFBF9",
|
||||
}
|
||||
}
|
||||
})
|
||||
vim.cmd('colorscheme kanagawa-lotus')
|
||||
-- require('kanagawa').setup({
|
||||
-- colors = {
|
||||
-- palette = {
|
||||
-- lotusGray = "#F8F7F4",
|
||||
-- lotusWhite0 = "#FBFBF9",
|
||||
-- lotusWhite1 = "#F2F0E9",
|
||||
-- lotusWhite2 = "#F8F7F2",
|
||||
-- lotusWhite3 = "#F6F6F1",
|
||||
-- lotusWhite4 = "#F4F1E6",
|
||||
-- lotusWhite5 = "#FcFBF9",
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
-- vim.cmd('colorscheme kanagawa-lotus')
|
||||
vim.cmd('colorscheme kanagawa')
|
||||
end
|
||||
},
|
||||
{ 'lunarvim/lunar.nvim' },
|
||||
@@ -37,7 +38,39 @@ return {
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = { 'nvim-treesitter/playground' }
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' }
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
}
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
@@ -59,10 +92,4 @@ return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'glepnir/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = true,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
},
|
||||
}
|
||||
|
||||
60
lua/plugins/wk.lua
Normal file
60
lua/plugins/wk.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
-- maps.lua
|
||||
|
||||
local maps = {}
|
||||
|
||||
function maps.term()
|
||||
vim.api.nvim_set_keymap('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i',
|
||||
{ noremap = false, desc = "Open and move to terminal" })
|
||||
vim.api.nvim_set_keymap('t', 'ß<C-N>', '<C-\\><C-N>', { noremap = true, desc = "Enter normal mode in terminal" })
|
||||
end
|
||||
|
||||
function maps.fixIndent()
|
||||
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = true, desc = "Remove identation level" })
|
||||
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, desc = "Add identation level" })
|
||||
end
|
||||
|
||||
function maps.moveByRow()
|
||||
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
|
||||
vim.api.nvim_set_keymap('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'',
|
||||
{ noremap = true, silent = true, expr = true, desc = "Go down 1 line" })
|
||||
vim.api.nvim_set_keymap('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'',
|
||||
{ noremap = true, silent = true, expr = true, desc = "Go up 1 line" })
|
||||
end
|
||||
|
||||
function maps.centeredSearch()
|
||||
vim.api.nvim_set_keymap('n', 'n', 'nzzzv', { noremap = true, desc = "Search next" })
|
||||
vim.api.nvim_set_keymap('n', 'N', 'Nzzzv', { noremap = true, desc = "Search previous" })
|
||||
end
|
||||
|
||||
function maps.init()
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>b', '<cmd>Lexplore | vert res 30<CR>',
|
||||
{ noremap = true, desc = "Open file explorer" })
|
||||
|
||||
maps.term()
|
||||
maps.fixIndent()
|
||||
maps.moveByRow()
|
||||
maps.centeredSearch()
|
||||
end
|
||||
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("which-key").setup({
|
||||
preset = "helix"
|
||||
})
|
||||
local wk = require("which-key")
|
||||
maps.init()
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user