initial commit

This commit is contained in:
THEON-1
2025-10-10 12:19:28 +02:00
commit d2e8cd40f1
23 changed files with 499 additions and 0 deletions

12
.envrc Normal file
View File

@@ -0,0 +1,12 @@
export MAMBA_EXE='/home/maxime/.local/bin/micromamba';
export MAMBA_ROOT_PREFIX='/home/maxime/.micromamba';
__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
alias micromamba="$MAMBA_EXE" # Fallback on help from micromamba activate
fi
unset __mamba_setup
micromamba activate nvim

15
.luarc.json Normal file
View File

@@ -0,0 +1,15 @@
{
"runtime.version": "LuaJIT",
"runtime.path": [
"lua/?.lua",
"lua/?/init.lua"
],
"diagnostics.globals": ["vim"],
"workspace.checkThirdParty": false,
"workspace.library": [
"$VIMRUNTIME",
"$XDG_DATA_HOME/nvim/lazy",
"${3rd}/luv/library"
]
}

1
init.lua Normal file
View File

@@ -0,0 +1 @@
require("config")

22
lazy-lock.json Normal file
View File

@@ -0,0 +1,22 @@
{
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"image.nvim": { "branch": "master", "commit": "446a8a5cc7a3eae3185ee0c697732c32a5547a0b" },
"lazy.nvim": { "branch": "main", "commit": "4ded3ff73bf42e1c657e5deb85d8bbd887d0172e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "6bdb14f230de0904229ec367b410fb817e59b072" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mini.nvim": { "branch": "main", "commit": "ef89bb115244297ed440441faa61759ddcf4a970" },
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
"noice.nvim": { "branch": "main", "commit": "38c702be0d8fea81527ee6a73e1e834e72481193" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-treesitter": { "branch": "main", "commit": "3ab4f2d2d20be55874e2eb575145c6928d7d7d0e" },
"oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"render-markdown.nvim": { "branch": "main", "commit": "d53856423be5ef3c267d26ee261b0981b372f718" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }
}

4
lua/config/init.lua Normal file
View File

@@ -0,0 +1,4 @@
require("config.vars")
require("config.keybinds")
require("config.lazy")

75
lua/config/keybinds.lua Normal file
View File

@@ -0,0 +1,75 @@
-- move selection in visual mode
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- yank to clipboard
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("v", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y")
-- paste without copy
vim.keymap.set("x", "<leader>p", "\"_dP")
-- delete without copy
vim.keymap.set("n", "<leader>d", "\"_d");
vim.keymap.set("v", "<leader>d", "\"_d");
-- search and replace hovered word
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- make file executable
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
-- insert shebang on top of file
vim.keymap.set("n", "<leader>sb", function ()
local filetype = vim.bo.filetype
local mapping = {
jl = "julia",
julia = "julia",
sh = "bash",
zsh = "zsh",
py = "/usr/bin/env python3",
python = "/usr/bin/env python3",
}
local command = mapping[filetype]
if (command == nil) then return end
-- local handle = assert(io.popen(string.format("/bin/zsh -c \"where %s\"", command)))
-- local result = (handle:lines())()
-- handle:close()
local buf = vim.api.nvim_get_current_buf()
-- print(result)
vim.api.nvim_buf_set_lines(buf, 0, 0, true, { "#!" .. command })
vim.api.nvim_command('write')
local filename = vim.api.nvim_buf_get_name(0)
assert(io.popen(string.format("/usr/bin/chmod +x \"%s\"", filename)))
end)
-- window switching
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<CR>")
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<CR>")
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<CR>")
vim.keymap.set("n", "<C-l>", "<cmd>wincmd l<CR>")
-- window movement
vim.keymap.set("n", "<C-Left>", "<cmd>wincmd H<CR>")
vim.keymap.set("n", "<C-Right>", "<cmd>wincmd L<CR>")
vim.keymap.set("n", "<C-Up>", "<cmd>wincmd K<CR>")
vim.keymap.set("n", "<C-Down>", "<cmd>wincmd J<CR>")
vim.keymap.set("n", "<C-r>", "<cmd>wincmd r<CR>")
-- lsp
vim.keymap.set("n", "<F4>", vim.lsp.buf.code_action)
vim.keymap.set("n", "<F3>", vim.lsp.buf.format)
vim.keymap.set("n", "<leader>gD", vim.lsp.buf.declaration)
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition)
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.type_definition)
vim.keymap.set("n", "K", vim.lsp.buf.hover)
vim.keymap.set("n", "<leader>ls", vim.lsp.buf.document_symbol)
vim.keymap.set("n", "<leader>li", vim.lsp.buf.implementation)
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.references)
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename)
vim.keymap.set("n", "<leader>sh", vim.lsp.buf.signature_help)
vim.keymap.set("n", "<leader>do", vim.diagnostic.open_float)
vim.keymap.set("n", "<leader>dn", function() vim.diagnostic.jump({count=1, float=true}) end)
vim.keymap.set("n", "<leader>dp", function() vim.diagnostic.jump({count=-1, float=true}) end)

35
lua/config/lazy.lua Normal file
View File

@@ -0,0 +1,35 @@
-- 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 },
})

40
lua/config/vars.lua Normal file
View File

@@ -0,0 +1,40 @@
vim.opt.nu = true
vim.opt.relativenumber = false
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.local/share/nvim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.conceallevel = 1
vim.g.mapleader = " "
vim.g.maplocalleader = ","
-- set python path
vim.g.python3_host_prog = os.getenv("HOME") .. "/.micromamba/envs/nvim/bin/python"
-- disable mouse
vim.opt.mouse = ""
vim.opt.termguicolors = true

48
lua/plugins/blink.lua Normal file
View File

@@ -0,0 +1,48 @@
return {
"saghen/blink.cmp",
version = '1.*',
---@module 'blink.cmp'
---@type blink.cmp.config
opts = {
keymap = {
preset = 'default',
['<Up>'] = { 'select_prev', 'fallback' },
['<Down>'] = { 'select_next', 'fallback' },
['<C-k>'] = { 'select_prev' },
['<C-j>'] = { 'select_next' },
['<C-Enter>'] = { 'accept' },
['<C-BS>'] = { 'cancel' },
['<C-Up>'] = { 'scroll_documentation_up' },
['<C-Down>'] = { 'scroll_documentation_down' },
},
appearance = {
nerd_font_variant = 'mono',
},
completion = {
documentation = {
auto_show = true,
},
},
sources = {
default = {
'lsp',
'path',
'buffer',
},
},
fuzzy = {
implementation = "prefer_rust_with_warning",
},
},
opts_extend = {
"sources.default",
},
}

7
lua/plugins/fugitive.lua Normal file
View File

@@ -0,0 +1,7 @@
return {
'tpope/vim-fugitive',
cmd = {
"G",
},
}

17
lua/plugins/gruvbox.lua Normal file
View File

@@ -0,0 +1,17 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
vim.cmd([[colorscheme gruvbox]])
end,
opts = {
italic = {
strings = false,
emphasis = true,
comments = true,
operators = false,
folds = true,
},
},
}

38
lua/plugins/harpoon.lua Normal file
View File

@@ -0,0 +1,38 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope.nvim' },
},
keys = {
{ "<leader>a", function() require("harpoon"):list():add() end },
{ "<C-w>", function()
local harpoon = require("harpoon")
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({ results = file_paths }),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
toggle_telescope(harpoon:list())
end, desc = "Open harpoon window" },
{ "<C-1>", function() require("harpoon"):list():select(1) end },
{ "<C-2>", function() require("harpoon"):list():select(2) end },
{ "<C-3>", function() require("harpoon"):list():select(3) end },
{ "<C-4>", function() require("harpoon"):list():select(4) end },
{ "<C-q>", function() require("harpoon"):list():prev() end },
{ "<C-e>", function() require("harpoon"):list():next() end },
},
}

16
lua/plugins/image.lua Normal file
View File

@@ -0,0 +1,16 @@
return {
'3rd/image.nvim',
build = false,
opts = {
processor = 'magick_cli',
backend = 'kitty',
integrations = { markdown = { enabled = true, }, },
max_width = 100,
max_height = 12,
max_height_window_percentage = math.huge,
max_width_window_percentage = math.huge,
window_overlap_clear_enabled = true,
window_overlap_clear_ft_ignore = { 'cmp_menu', 'cmp_docs', '', },
},
}

10
lua/plugins/markdown.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
'MeanderingProgrammer/render-markdown.nvim',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-mini/mini.nvim',
},
---@module 'render-markdown'
---@type render.md.UserConfig
}

23
lua/plugins/mason.lua Normal file
View File

@@ -0,0 +1,23 @@
return {
"mason-org/mason-lspconfig.nvim",
opts = {
automatic_enable = true,
},
dependencies = {
{
"mason-org/mason.nvim",
opts = {
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
},
lazy = false,
},
"neovim/nvim-lspconfig",
},
}

11
lua/plugins/molten.lua Normal file
View File

@@ -0,0 +1,11 @@
return {
'benlubas/molten-nvim',
version = '^1.1.0',
depencies = { '3rd/image.nvim', },
build = ':UpdateRemotePlugins',
init = function()
vim.g.molten_image_provider = 'image.nvim'
vim.g.molten_output_win_max_height = 20
end,
}

25
lua/plugins/noice.lua Normal file
View File

@@ -0,0 +1,25 @@
return {
'folke/noice.nvim',
event = 'VeryLazy',
dependencies = {
'MunifTanjim/nui.nvim',
'rcarriga/nvim-notify',
},
opts = {
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true,
},
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
inc_rename = true,
lsp_doc_border = true,
},
},
}

4
lua/plugins/notify.lua Normal file
View File

@@ -0,0 +1,4 @@
return {
'rcarriga/nvim-notify',
}

View File

@@ -0,0 +1,7 @@
return {
"neovim/nvim-lspconfig",
cmd = { 'LspInfo', 'LspInstall', 'LspStart' },
event = { 'BufReadPre', 'BufNewFile' },
dependencies = { 'saghen/blink.cmp' },
}

49
lua/plugins/oil.lua Normal file
View File

@@ -0,0 +1,49 @@
return {
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {
columns = {
"icon",
"permissions",
},
default_file_explorer = true,
view_options = {
show_hidden = true,
},
win_options = {
wrap = false,
signcolumn = "yes",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "nvic",
},
delete_to_trash = false,
skip_confirm_for_simple_edits = false,
prompt_save_for_select_new_entry = true,
lsp_file_methods = {
enabled = true,
timeout_ms = 1000,
autosave_changes = false,
},
constrain_cursor = "editable",
watch_for_changes = false,
keymaps = {
["g"] = { "actions.show_help", mode = "n" },
["<CR>"] = "actions.select",
["<C-p>"] = "actions.preview",
["-"] = { "actions.open_cwd", mode = "n" },
["+"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
["_"] = "actions.parent",
["*"] = "actions.open_terminal",
},
},
keys = {
{ "_", function() require("oil").open() end, desc = "open files" },
},
lazy = false,
}

26
lua/plugins/telescope.lua Normal file
View File

@@ -0,0 +1,26 @@
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
requires = {
{ 'nvim-lua/plenary.nvim' },
},
config = function()
require('telescope').load_extension("notify")
end,
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>", mode = "n" },
{ "<leader>g", "<cmd>Telescope live_grep<cr>", mode = "n" },
{ "<C-f>", "<cmd>Telescope git_files<cr>", mode = "n" },
},
cmd = {
'Telescope',
},
opts = {
defaults = {
preview = {
treesitter = false,
},
},
},
}

View File

@@ -0,0 +1,7 @@
return {
'nvim-treesitter/nvim-treesitter',
lazy = false,
branch = 'main',
build = ':TSUpdate',
}

7
lua/plugins/undotree.lua Normal file
View File

@@ -0,0 +1,7 @@
return {
'mbbill/undotree',
keys = {
{ "<leader>u", vim.cmd.UndotreeToggle, mode = "n", desc = "Open Undotree" },
},
}