From 3fa491d7a40304b27040cbd650ff23cca293e8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Tue, 12 Aug 2025 15:25:31 +0200 Subject: [PATCH] feat(config): nvim --- config/nvim/init.lua | 3 + config/nvim/init.vim.bp | 118 ++++++++++++++++++++++++ config/nvim/lazy-lock.json | 11 +++ config/nvim/lua/colorscheme.lua | 7 ++ config/nvim/lua/options.lua | 22 +++++ config/nvim/lua/plugin.lua | 18 ++++ config/nvim/lua/plugins/blink.lua | 84 +++++++++++++++++ config/nvim/lua/plugins/colorscheme.lua | 3 + config/nvim/lua/plugins/elixir.lua | 4 + config/nvim/lua/plugins/lsp.lua | 21 +++++ 10 files changed, 291 insertions(+) create mode 100644 config/nvim/init.lua create mode 100644 config/nvim/init.vim.bp create mode 100644 config/nvim/lazy-lock.json create mode 100644 config/nvim/lua/colorscheme.lua create mode 100644 config/nvim/lua/options.lua create mode 100644 config/nvim/lua/plugin.lua create mode 100644 config/nvim/lua/plugins/blink.lua create mode 100644 config/nvim/lua/plugins/colorscheme.lua create mode 100644 config/nvim/lua/plugins/elixir.lua create mode 100644 config/nvim/lua/plugins/lsp.lua diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..94faf14 --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,3 @@ +require('options') +require('plugin') +require('colorscheme') diff --git a/config/nvim/init.vim.bp b/config/nvim/init.vim.bp new file mode 100644 index 0000000..1861949 --- /dev/null +++ b/config/nvim/init.vim.bp @@ -0,0 +1,118 @@ +set nocompatible " be iMproved, required +filetype off " required + +syntax on + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' + +" Plugins +Plugin 'godlygeek/tabular' +" Plugin 'preservim/vim-markdown' +Plugin 'vim-pandoc/vim-pandoc' +Plugin 'vim-pandoc/vim-pandoc-syntax' +Plugin 'WolfgangMehner/latex-support' +Plugin 'http://github.com/tpope/vim-surround' " Surrounding ysw) +Plugin 'https://github.com/preservim/nerdtree' " NerdTree +Plugin 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc +Plugin 'https://github.com/vim-airline/vim-airline' " Status bar +Plugin 'https://github.com/ap/vim-css-color' " CSS Color Preview +Plugin 'https://github.com/rafi/awesome-vim-colorschemes' " Retro Scheme +Plugin 'https://github.com/ryanoasis/vim-devicons' " Developer Icons +Plugin 'https://github.com/tc50cal/vim-terminal' " Vim Terminal +Plugin 'https://github.com/preservim/tagbar' " Tagbar for code navigation +Plugin 'https://github.com/neoclide/coc.nvim' " Autocompletions +" Plugin 'https://github.com/terryma/vim-multiple-cursors' " CTRL + N for multiple cursors +Plugin 'https://github.com/mattn/emmet-vim' " Emmet support +Plugin 'rubixninja314/vim-mcfunction' " mcfunction +" Plugin 'sirver/ultisnips' +" let g:UltiSnipsExpandTrigger = '' +" let g:UltiSnipsJumpForwardTrigger = '' +" let g:UltiSnipsJumpBackwardTrigger = '' +"Plugin 'lervag/vimtex' +" let g:tex_flavor='latex' +" let g:vimtex_view_method='zathura' +" let g:vimtex_quickfix_mode=0 +" set conceallevel=1 +" let g:tex_conceal='abdmg' +Plugin 'catppuccin/vim' " theme +Plugin 'vimpostor/vim-prism' " theme +Plugin 'elixir-editors/vim-elixir' " elixir +Plugin 'mhinz/vim-mix-format' " elixir format +Plugin 'neovim/nvim-lspconfig' " elixir language server + +call vundle#end() " required +filetype plugin indent on " required + +:colorscheme prism + +:set number relativenumber +:set autoindent +:set tabstop=4 +:set shiftwidth=4 +:set smarttab +:set softtabstop=4 +:set mouse=a + +nnoremap :tabprevious +nnoremap :tabnext +nnoremap :tabprevious +nnoremap :tabnext +nnoremap :tabclose + +nnoremap :NERDTreeFocus +nnoremap :NERDTree +nnoremap :NERDTreeToggle + +nmap :TagbarToggle + +:set completeopt-=preview " For No Previews + +let g:NERDTreeDirArrowExpandable="+" +let g:NERDTreeDirArrowCollapsible="~" + +let g:airline_powerline_fonts = 1 + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif + +" airline symbols +let g:airline_left_sep = '' +let g:airline_left_alt_sep = '' +let g:airline_right_sep = '' +let g:airline_right_alt_sep = '' +let g:airline_symbols.branch = '' +let g:airline_symbols.readonly = '' +let g:airline_symbols.linenr = '' + +" Custom Commands +"" LateX +:command Ttp !pdflatex %:t + +"" JS/TS/Node +:command NpmInstall !npm install +:command TscWatch !npm run ts-watch +:command NodemonStart !npm run start + +"" Git +:command -nargs=1 -bar GitignoreCreate !curl https://www.toptal.com/developers/gitignore/api/ | tee -a .gitignore +:command -nargs=* GitCommit !git commit -m "" +:command -nargs=* GitCommitAll !git commit -am "" +:command GitAddAll !git add * && git add .* +:command GitStatus !git status +:command GitPush !git push + +inoremap pumvisible() ? coc#_select_confirm() : "" + +set shell=/bin/bash + +" Highlight +augroup twig_ft + au! + autocmd BufNewFile,BufRead *.mcfunction set syntax=mcfunction +augroup END diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 0000000..1f1406c --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,11 @@ +{ + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7f0bf635082bb9b7d2b37766054526a6ccafdb85" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, + "nvim-lspconfig": { "branch": "master", "commit": "f0c6ccf43997a1c7e9ec4aea36ffbf2ddd9f15ef" }, + "vim-elixir": { "branch": "master", "commit": "6dff29176eb35e025bc94b262bf6d4e517e11f7d" }, + "vim-mix-format": { "branch": "master", "commit": "01a31ef82aa52697d589574da50723980eeae456" } +} diff --git a/config/nvim/lua/colorscheme.lua b/config/nvim/lua/colorscheme.lua new file mode 100644 index 0000000..f9f6ce6 --- /dev/null +++ b/config/nvim/lua/colorscheme.lua @@ -0,0 +1,7 @@ +local colorscheme = 'monokai_pro' + +local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not is_ok then + vim.notify('colorscheme ' .. colorscheme .. ' not found!') + return +end diff --git a/config/nvim/lua/options.lua b/config/nvim/lua/options.lua new file mode 100644 index 0000000..a937c38 --- /dev/null +++ b/config/nvim/lua/options.lua @@ -0,0 +1,22 @@ +vim.opt.completeopt = {'menu', 'menuone', 'noselect'} + +vim.opt.tabstop = 4 -- number of visual spaces per TAB +vim.opt.softtabstop = 4 -- number of spacesin tab when editing +vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab +vim.opt.expandtab = true -- tabs are spaces, mainly because of python + +vim.opt.number = true -- show absolute number +vim.opt.relativenumber = true -- add numbers to each line on the left side +vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally +vim.opt.splitbelow = true -- open new vertical split bottom +vim.opt.splitright = true -- open new horizontal splits right + +vim.opt.incsearch = true -- search as characters are entered +vim.opt.ignorecase = true -- ignore case in searches by default +vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered + +vim.filetype.add({ + extension = { + heex = 'eelixir' + } +}) diff --git a/config/nvim/lua/plugin.lua b/config/nvim/lua/plugin.lua new file mode 100644 index 0000000..d88d9ac --- /dev/null +++ b/config/nvim/lua/plugin.lua @@ -0,0 +1,18 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or 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) + +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +require("lazy").setup("plugins") diff --git a/config/nvim/lua/plugins/blink.lua b/config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..b69b537 --- /dev/null +++ b/config/nvim/lua/plugins/blink.lua @@ -0,0 +1,84 @@ +return { + { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- Use a release tag to download pre-built binaries + version = "*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using the latest nightly rust with: + -- build = 'nix run .#build-plugin', + + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to VSCode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + -- Each keymap may be a list of commands and/or functions + preset = "enter", + -- Select completions + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + -- Scroll documentation + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + -- Show/hide signature + [""] = { "show_signature", "hide_signature", "fallback" }, + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + sources = { + -- `lsp`, `buffer`, `snippets`, `path`, and `omni` are built-in + -- so you don't need to define them in `sources.providers` + default = { "lsp", "path", "snippets", "buffer" }, + + -- Sources are configured via the sources.providers table + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + completion = { + -- The keyword should only match against the text before + keyword = { range = "prefix" }, + menu = { + -- Use treesitter to highlight the label text for the given list of sources + draw = { + treesitter = { "lsp" }, + }, + }, + -- Show completions after typing a trigger character, defined by the source + trigger = { show_on_trigger_character = true }, + documentation = { + -- Show documentation automatically + auto_show = true, + }, + }, + + -- Signature help when tying + signature = { enabled = true }, + }, + opts_extend = { "sources.default" }, + } +} diff --git a/config/nvim/lua/plugins/colorscheme.lua b/config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..457a3ec --- /dev/null +++ b/config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,3 @@ +return { + "tanvirtin/monokai.nvim" +} diff --git a/config/nvim/lua/plugins/elixir.lua b/config/nvim/lua/plugins/elixir.lua new file mode 100644 index 0000000..5ab5662 --- /dev/null +++ b/config/nvim/lua/plugins/elixir.lua @@ -0,0 +1,4 @@ +return { + "elixir-editors/vim-elixir", + "mhinz/vim-mix-format" +} diff --git a/config/nvim/lua/plugins/lsp.lua b/config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..1a3a64a --- /dev/null +++ b/config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,21 @@ +return { + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + + lspconfig.pylsp.setup({}) + end, + }, + { "mason-org/mason.nvim", opts = {} }, + { + "mason-org/mason-lspconfig.nvim", + dependencies = { + "mason-org/mason.nvim", + "neovim/nvim-lspconfig", + }, + opts = { + ensure_installed = { "pylsp", "elixirls" }, + }, + }, +}