├── .ctagsignore ├── .gitignore ├── README.md ├── init.lua ├── lazy-lock.json └── lua ├── commands.lua ├── keymaps.lua ├── lsp └── utils.lua ├── options.lua ├── plugins.lua ├── plugins ├── bufferline.lua ├── cmp.lua ├── copilot.lua ├── gitsigns.lua ├── lspconfig.lua ├── lualine.lua ├── nvimtree.lua ├── poet-v.vim ├── snippets.lua ├── startify.vim ├── telescope.lua └── treesitter.lua ├── themes.lua └── utils.lua /.ctagsignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .git/* 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.ctagsignore 2 | /tags 3 | plugin/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neovim configuration with Lua 2 | 3 | A [Neovim](https://github.com/neovim/neovim) configuration using Lua, with the minimal number of pluggins I need for programming. Different language servers available through the LSP protocol provide code completion and analysis. 4 | 5 | This readme exist so I don't have to remember how to do all these things when setting up a new machine. 6 | 7 | ## Setting up 8 | 9 | Notice that Neovim doesn't have a full release version number yet. This is because it is undergoing rapid development and older versions could be incompatible with some plugins. The latest version can always be installe using the instructions below depending on your operating system. 10 | 11 | ### Linux 12 | 13 | ```bash 14 | # For stable versions 15 | sudo snap install --beta nvim --classic 16 | 17 | # For nightly versions 18 | sudo snap install --edge nvim --classic 19 | ``` 20 | 21 | We also need to install the node package manager `npm` since most language servers are installed that way. 22 | 23 | ```bash 24 | sudo apt install npm 25 | ``` 26 | 27 | ### MacOS 28 | 29 | Assume `brew` is installed, then installing Neovim is straighforward: 30 | 31 | ```bash 32 | # For stable version 33 | brew install neovim 34 | 35 | # for nightly version 36 | brew install --HEAD neovim 37 | 38 | # To update 39 | brew reinstall neovim 40 | ``` 41 | 42 | Additionally, you may need to configure the `Option` key to behave like `Alt`. In **iTerm2**, this can be done in `Preferences -> Profiles -> Keys`. Change the left option behaviour to `Esc+`. For **kitty**, you need to set `macos_option_as_alt left` (defualt is no) in the terminal's config file. Restarting the terminal (`Command + Q`, then restart) is required for this to take effect. 43 | 44 | ## Installing the configuration 45 | 46 | Clone the repo into Neovim's installation folder (usually `/home//.config/nvim`): 47 | ```bash 48 | git clone https://github.com/miltonllera/neovim-lua-config ~/.config/nvim 49 | cd ~/.config/nvim 50 | ``` 51 | 52 | This will create a folder with the configuration with the following structure is as follows: 53 | ``` 54 | |- lua 55 | | |- lsp/ 56 | | |- plugins/ 57 | | |- keymaps.lua 58 | | |- options.lua 59 | | |- plugins.lua 60 | | |- theme.lua 61 | | \- utils.lua 62 | |- plugin/ 63 | \- init.lua 64 | ``` 65 | 66 | This structure is important since Lua will not load files that are not located inside `lua`. The file `init.lua` loads all the modules located inside this folder to set the configuration. Most of the names are self explanatory. The most important file here is `plugins.lua`, which is the module that loads the relevant plugins. Some of the most important plugins are: 67 | 68 | 1. [**`lazy`**](https://github.com/folke/lazy.nvim): Manage the plugins. 69 | 2. [**`lspconfig`**](https://github.com/neovim/nvim-lspconfig): provides a client for the different language servers using the Language Server Protocol (LSP). 70 | 3. [**`cmp`**](https://github.com/hrsh7th/nvim-cmp): Auto-complete functionality. Recommended by the core Neovim team. 71 | 4. [**`treesitter`**](https://github.com/nvim-treesitter/nvim-treesitter): Syntax highlighting and other functionality. 72 | 5. [**`NvimTree`**](https://github.com/kyazdani42/nvim-tree.lua): File explorer written in Lua. 73 | 6. [**`fugitive`**](https://github.com/tpope/vim-fugitive): The best plugin for git. 74 | 7. [**`gitsigns`**](https://github.com/lewis6991/gitsigns.nvim): Git gutter highlighting and hunk management in buffer. 75 | 8. [**`telescope`**](https://github.com/nvim-telescope/telescope.nvim): Fuzzy finder. 76 | 9. [**`lualine`**](https://github.com/nvim-lualine/lualine.nvim): A status line written in Lua which is similar to `vim-airline`. 77 | 78 | There are some more packages that are dependencies of the ones mentioned above, and some for formatting and theming as well. Adding new plugins by adding them inside the `plugins` table: 79 | 80 | ```lua 81 | { 82 | '/', config = function() require('').setup() end, 83 | } 84 | ``` 85 | 86 | This will load a plugin with it's standard configuration. Custom configs for several plugins are in 87 | the `plugin` folder and can be accessed as: 88 | 89 | ```lua 90 | { 91 | '/', config = function() require('plugin/') end, 92 | } 93 | ``` 94 | 95 | Notice that the file type is omitted from this call. See the lazy repo for more options such as forcing plugin loading at startup (i.e. `layz= false` or setting dependencies). 96 | 97 | 98 | ## Auto-completion 99 | 100 | The auto-complete functionality is achieved by using `nvim-cmp` to attach the relevant language servers to the buffers containing code. Most servers only require that the on attach function is specified so that different motions are available. Currently, the common function to attach a server to a buffer is located in `lua/lsp/utils.lua` . It will enable common key mappings for all language servers to display code completion. 101 | 102 | The second part is installing the language servers themselves (described below) and enabling them. This is achieved using `mason.nvim`, `nvim-lspconfig` and `mason-lspconfig.nvim`. 103 | 104 | ### Installing the language servers 105 | 106 | Binaries for each language servers must be installed from their relevant repo. Most servers are installed using `npm install`, but others like `clangd` and `sumneko` for Lua require more involved procedures. Here is a list of servers and installation methods. These should work both on `bash` and `zsh`. 107 | 108 | - **Bash**: bashls 109 | 110 | ```bash 111 | npm i -g bash-language-server 112 | ``` 113 | 114 | - **C/C++**: clangd 115 | May have to try several versions, but 13 is the latest one. I am using 12 and 9 or 8 should be available. 116 | 117 | ```bash 118 | sudo apt-get install clangd-13 119 | ``` 120 | Then we must make it the default clangd (example with clangd-13): 121 | ```bash 122 | sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-13 100 123 | ``` 124 | 125 | **NOTE**: On MacOS `clang` is installed through XCode, and you probably don't need to do anything else. You can check this by running `clang --version` from the terminal. 126 | 127 | - **Docker**: dockerls 128 | 129 | ```bash 130 | npm i -g dockerfile-language-server-nodejs 131 | ``` 132 | 133 | - **Julia**: julials 134 | 135 | ```bash 136 | julia --project=~/.julia/environments/nvim-lspconfig -e 'using Pkg; Pkg.add("LanguageServer")' 137 | ``` 138 | 139 | - **JSON**: jsonls 140 | 141 | ```bash 142 | npm i -g vscode-langservers-extracted 143 | ``` 144 | 145 | - **Lua**: lua_ls 146 | 147 | Notice that the old `sumneko_lua` server is now deprecated. The version available now is `lua_ls` which is much easier to install (and also doesn't seem to funnel telemetry data to a remote server by default). 148 | 149 | ```bash 150 | brew install lua-language-server 151 | ``` 152 | 153 | - **Python**: pyright: 154 | 155 | ```bash 156 | npm i -g pyright 157 | ``` 158 | 159 | - **YAML**: yamlls 160 | 161 | This install requires `yarn` to work 162 | 163 | ```bash 164 | yarn global add yaml-language-server 165 | ``` 166 | 167 | For MacOS use `brew`: 168 | ``` 169 | brew install yaml-language-server 170 | ``` 171 | 172 | If a module complains about the verion of node being too old (pyright will do this), then run the following: 173 | ```bash 174 | sudo npm cache clean -f 175 | sudo npm install -g n 176 | sudo n stable 177 | ``` 178 | Make sure to use the `-g` on all `npm` installs, otherwise the server won't be found. 179 | 180 | ### Some further notes 181 | 182 | Inline error messages are disabled in the current configuration. They create a lot of clutter. To enable them back, comment the code on line 34 of `lua/options.lua`. This is a `nvim` option related to it's `lsp` interface, not something provided by the servers themselves. 183 | 184 | ## Web-dev Icons 185 | 186 | To visualize fancy icons and separators, a patched font must be installed. [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts) has many already patched and offers instructions on how to create new ones (I don't recommend). To install a patched font follow these instructions: 187 | 1. Head to the [repo](https://github.com/ryanoasis/nerd-fonts) and download the font. I use Robot Mono. 188 | 2. Copy the file to the relevant folder: 189 | - Linux: `~/.local/share/fonts/`. 190 | - MacOS: `/Library/Fonts'`. 191 | 3. Change the font in the terminal emulator's settings to the patched font. 192 | 193 | ### Nerd Fonts with Kitty 194 | 195 | If using `kitty` as default terminal, then the procedure above won't work. First, `kitty` does not support non-monospaced fonts due to how it renders text. Second, the fonts cannot be patched. In fact, kitty takes care of patching on it's own which is great. To install the fonts follow the instructions in this [blog](https://erwin.co/kitty-and-nerd-fonts/#symbols), which are straighforward. 196 | 197 | TL;DR for `MacOS`: 198 | 1. Download and install the fonts and put the file `Symbols-2048-em Nerd Font Complete.tff` (or whatever subset you decide to use) in the `Library/Fonts/` folder for system wide use, or the local variant. 199 | 2. If the glyphs aren't displayed by default, then they can be specified manually by following the instructions. 200 | 3. Refresh the fonts cache. 201 | 202 | ## Attributions 203 | 204 | I've stolen code from different sources which means it might be hard to acknowledge all of them explicitly though most of them are from the associated plugin's documentation. 205 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | -- Load all config files 2 | 3 | require('options') 4 | require('keymaps') 5 | require('commands') 6 | require('plugins') 7 | require('themes') -- Theme at the end, to prevent overwrite by other plugins 8 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, 3 | "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, 4 | "cellular-automaton.nvim": { "branch": "main", "commit": "11aea08aa084f9d523b0142c2cd9441b8ede09ed" }, 5 | "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, 6 | "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, 7 | "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, 8 | "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, 9 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, 10 | "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, 11 | "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, 12 | "copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" }, 13 | "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, 14 | "gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" }, 15 | "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" }, 16 | "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, 17 | "lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" }, 18 | "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, 19 | "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, 20 | "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, 21 | "material.nvim": { "branch": "main", "commit": "ac8f02e97e359b7d258c0a00ec0949fe880790ad" }, 22 | "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, 23 | "nvim-lspconfig": { "branch": "master", "commit": "bb682c167a0878338b4313b55538953d1c039085" }, 24 | "nvim-tree.lua": { "branch": "master", "commit": "d41b4ca013ed89e41b9c0ecbdae5f1633e42f7fa" }, 25 | "nvim-treesitter": { "branch": "master", "commit": "e0338f2b74fbad808f2569c7d4eadd8796af2118" }, 26 | "nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" }, 27 | "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, 28 | "python-type-stubs": { "branch": "main", "commit": "d3462bd38d73ccc77d6767bcfb006004853a7f06" }, 29 | "rose-pine": { "branch": "main", "commit": "8b1fd252255a7f2c41b4192a787ab62660b29f72" }, 30 | "tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" }, 31 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, 32 | "telescope.nvim": { "branch": "master", "commit": "927c10f748e49c543b2d544c321a1245302ff324" }, 33 | "tokyonight.nvim": { "branch": "main", "commit": "4b386e66a9599057587c30538d5e6192e3d1c181" }, 34 | "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, 35 | "vim-black": { "branch": "main", "commit": "e9486a54b63939da162cbbd4f9838f7319842910" }, 36 | "vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" }, 37 | "vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" }, 38 | "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, 39 | "vim-kitty": { "branch": "main", "commit": "9cc594a634308aa3bfaf3da5b5e741da1c0144c1" }, 40 | "vim-python-indent-black": { "branch": "main", "commit": "8a08f503f4e501441ad6f478d66fa895bf8cf857" }, 41 | "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, 42 | "vim-startify": { "branch": "master", "commit": "4e089dffdad46f3f5593f34362d530e8fe823dcf" }, 43 | "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, 44 | "vim-toml": { "branch": "main", "commit": "d36caa6b1cf508a4df1c691f915572fc02143258" }, 45 | "vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" }, 46 | "vimtex": { "branch": "master", "commit": "539a203f19531c6b9d2d1b093ee8911fb7050bbc" } 47 | } 48 | -------------------------------------------------------------------------------- /lua/commands.lua: -------------------------------------------------------------------------------- 1 | -- Define commands 2 | 3 | -- Toggle highlight 4 | -- vim.cmd([[command! HiLiToggle (g:hlsearch ? ':nohls' : ':set hls')]]) 5 | 6 | -- Remove trailing whitespaces 7 | -- (if a file requires trailing spaces, exclude its type using the regex) 8 | vim.cmd [[autocmd BufWritePre * %s/\s\+$//e ]] 9 | 10 | -- Swap folder 11 | vim.cmd('command! ListSwap split | enew | r !ls -l ~/.local/share/nvim/swap') 12 | vim.cmd('command! CleanSwap !rm -rf ~/.local/state/nvim/swap/') 13 | 14 | -- Open help tags 15 | vim.cmd("command! HelpTags Telescope help_tags") 16 | 17 | -- Create ctags 18 | vim.cmd('command! MakeCTags !ctags -R --exclude=@.ctagsignore .') 19 | -------------------------------------------------------------------------------- /lua/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- General keymaps that are not pluggin dependant 2 | -- the file "lua/lsp/utils.lua" contains lsp-specific commands. 3 | 4 | local Utils = require('utils') 5 | 6 | -- local exprnnoremap = Utils.exprnnoremap 7 | local nnoremap = Utils.nnoremap 8 | local vnoremap = Utils.vnoremap 9 | local xnoremap = Utils.xnoremap 10 | local inoremap = Utils.inoremap 11 | -- local tnoremap = Utils.tnoremap 12 | -- local nmap = Utils.nmap 13 | -- local xmap = Utils.xmap 14 | 15 | vim.g.mapleader = " " 16 | vim.g.maplocalleader = " " 17 | 18 | 19 | -- kj to normal mode 20 | inoremap("kj", "") 21 | 22 | -- page up/down with recentering 23 | nnoremap("", "zz") 24 | nnoremap("", "zz") 25 | 26 | -- Run omnifunc, mostly used for autocomplete 27 | inoremap("", "") 28 | 29 | -- Save with Ctrl + S 30 | nnoremap("", ":w") 31 | 32 | -- Close buffer 33 | nnoremap("", ":q") 34 | 35 | -- Move around windows (shifted to the right) 36 | nnoremap("", "h") 37 | nnoremap("", "j") 38 | nnoremap("", "k") 39 | nnoremap("", "l") 40 | 41 | -- Switch buffers (needs nvim-bufferline) 42 | nnoremap("", ":BufferLineCycleNext") 43 | nnoremap("", ":BufferLineCyclePrev") 44 | 45 | -- Splits 46 | nnoremap("ws", ":split") 47 | nnoremap("vs", ":vsplit") 48 | 49 | -- Populate substitution 50 | nnoremap("s", ":s//g") 51 | nnoremap("S", ":%s//g") 52 | nnoremap("", ":%s//gc") 53 | 54 | vnoremap("s", ":s//g") 55 | vnoremap("", ":%s//g") 56 | vnoremap("S", ":%s//gc") 57 | 58 | -- Delete buffer 59 | nnoremap("", ":bd") 60 | 61 | -- Yank to end of line 62 | nnoremap("Y", "y$") 63 | 64 | -- Paste into selection without overwriting p register 65 | xnoremap("p", '\"_dP') 66 | 67 | -- Delete without overwriting register 68 | nnoremap("d", '\"_d') 69 | vnoremap("d", '\"_d') 70 | 71 | -- Copy to system clippboard 72 | nnoremap("y", '"+y') 73 | vnoremap("y", '"+y') 74 | 75 | -- Paste from system clippboard 76 | nnoremap("P", '"+p') 77 | vnoremap("P", '"+p') 78 | 79 | -- Clear highlight search 80 | nnoremap("nh", ":nohlsearch") 81 | vnoremap("nh", ":nohlsearch") 82 | 83 | -- Local list 84 | nnoremap("lo", ":lopen") 85 | nnoremap("lc", ":lclose") 86 | nnoremap("", ":lnext") 87 | nnoremap("", ":lprev") 88 | 89 | -- Quickfix list 90 | nnoremap("co", ":copen") 91 | nnoremap("cc", ":cclose") 92 | nnoremap("", ":cnext") 93 | nnoremap("", ":cprev") 94 | 95 | -- Open file in default application 96 | nnoremap("xo", " !xdg-open %") 97 | 98 | -- Fugitive 99 | nnoremap("G", ":G") 100 | nnoremap("gl", ":Gclog") 101 | 102 | -- Show line diagnostics 103 | nnoremap("i", 'lua vim.diagnostic.open_float(0, {scope = "line"})') 104 | 105 | -- Open local diagnostics in local list 106 | nnoremap("I", "Trouble diagnostics toggle focus=false filter.buf=0") 107 | 108 | -- Open all project diagnostics in quickfix list 109 | nnoremap("", "Toggle diagnostics toggle focus=false filter.severity=vim.diagnostic.severity.ERROR") 110 | 111 | -- Telescope 112 | nnoremap("o", "Telescope find_files") 113 | nnoremap("H", "Telescope find_files hidden=true") 114 | nnoremap("b", "Telescope buffers") 115 | nnoremap("lg", "Telescope live_grep") 116 | 117 | -- File explorer 118 | nnoremap("e", "NvimTreeToggle") -- NvimTree 119 | -- nnoremap("e", "RnvimrToggle") 120 | 121 | -- Run Copilot 122 | nnoremap("C", "Copilot panel") 123 | 124 | -- EasyAlign 125 | -- xmap("ga", "EasyAlign") 126 | -- nmap("ga", "EasyAlign") 127 | 128 | -- For when everything else fails 129 | nnoremap("fml", 'CellularAutomaton make_it_rain') 130 | -------------------------------------------------------------------------------- /lua/lsp/utils.lua: -------------------------------------------------------------------------------- 1 | -- LSP helper function 2 | 3 | local cmd = vim.cmd 4 | 5 | local M = {} 6 | 7 | cmd([[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]]) 8 | cmd([[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]]) 9 | 10 | -- This function defines the on_attach function for several languages which share the same key-bidings 11 | function M.common_on_attach(client, bufnr) 12 | -- Set omnifunc 13 | vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") 14 | 15 | -- Helper function 16 | local opts = {noremap = true, silent = true} 17 | local function bufnnoremap(lhs, rhs) 18 | vim.api.nvim_buf_set_keymap(bufnr, 'n', lhs, rhs, opts) 19 | end 20 | 21 | -- Keymaps: we need to define keymaps for each of the LSP functionalities manually 22 | -- Go to definition and declaration (use leader to presever standard use of 'gd') 23 | bufnnoremap("gd", "lua vim.lsp.buf.definition()") 24 | bufnnoremap("gD", "lua vim.lsp.buf.declaration()") 25 | 26 | -- Go to implementation 27 | bufnnoremap("gi", "lua vim.lsp.buf.implementation()") 28 | 29 | -- List symbol uses 30 | -- bufnnoremap("gr", "lua vim.lsp.buf.references()") -- Uses quickfix 31 | bufnnoremap("gr", "Telescope lsp_references") -- Uses Telescope 32 | 33 | -- Inspect function 34 | bufnnoremap("K", "lua vim.lsp.buf.hover()") 35 | 36 | -- Signature help 37 | bufnnoremap("", "lua vim.lsp.buf.signature_help()") 38 | 39 | -- Rename all references of symbol 40 | bufnnoremap("R", "lua vim.lsp.buf.rename()") 41 | 42 | -- Navigate diagnostics 43 | bufnnoremap("", "lua vim.diagnostic.goto_next()") 44 | bufnnoremap("", "lua vim.diagnostic.goto_prev()") 45 | 46 | -- Markdown preview TODO: make this conditional, but I also don't use it all that much 47 | -- bufnnnoremap("P", "Glow") 48 | 49 | if client.server_capabilities.document_formatting then 50 | cmd("autocmd BufWritePre lua vim.lsp.buf.formatting_sync()") 51 | end 52 | end 53 | 54 | return M 55 | -------------------------------------------------------------------------------- /lua/options.lua: -------------------------------------------------------------------------------- 1 | -- Visual 2 | vim.o.conceallevel = 0 -- Don't hide quotes in markdown 3 | vim.o.cmdheight = 1 4 | vim.o.pumheight = 10 5 | vim.o.showmode = false 6 | vim.o.showtabline = 2 -- Always show tabline 7 | vim.o.title = true 8 | vim.o.termguicolors = true -- Use true colors, required for some plugins 9 | -- vim.o.ls = 0 -- Doesn't seem to work 10 | -- vim.o.ch = 0 -- Creates a bug with output messages not appearing correctly 11 | vim.wo.number = true 12 | vim.wo.relativenumber = true 13 | vim.wo.signcolumn = 'yes' 14 | vim.wo.cursorline = true 15 | 16 | -- Behavior 17 | vim.o.hlsearch = false 18 | vim.o.ignorecase = true -- Ignore case when using lowercase in search 19 | vim.o.smartcase = true -- But don't ignore it when using upper case 20 | vim.o.smarttab = true 21 | vim.o.smartindent = true 22 | vim.o.expandtab = true -- Convert tabs to spaces. 23 | vim.o.tabstop = 2 24 | vim.o.softtabstop = 2 25 | vim.o.shiftwidth = 2 26 | vim.o.splitbelow = true 27 | vim.o.splitright = true 28 | vim.o.scrolloff = 12 -- Minimum offset in lines to screen borders 29 | vim.o.sidescrolloff = 8 30 | vim.o.mouse = 'a' 31 | 32 | -- Vim specific 33 | vim.o.hidden = true -- Do not save when switching buffers 34 | vim.o.fileencoding = "utf-8" 35 | vim.o.spell = false -- As of v0.8.0 it only checks comments 36 | vim.o.spelllang = "en_us" 37 | vim.o.completeopt = "menuone,noinsert,noselect" 38 | vim.o.wildmode = "longest,full" -- Display auto-complete in Command Mode 39 | vim.o.updatetime = 300 -- Delay until write to Swap and HoldCommand event 40 | vim.g.do_file_type_lua = 1 41 | 42 | -- Disable default plugins 43 | -- vim.g.loaded_netrwPlugin = false -- I can't remember what the issue was with this option 44 | 45 | -- Python providers 46 | local pynvim_env = os.getenv("HOME").."/.local/bin/pyenv/versions/pynvim/" 47 | vim.g.python3_host_prog = pynvim_env.."/bin/python" 48 | vim.g.black_virtualenv = pynvim_env 49 | 50 | -- Disable unused providers 51 | vim.g.loaded_perl_provider = 0 52 | vim.g.loaded_ruby_provider = 0 53 | 54 | -- Disable inline error messages 55 | vim.diagnostic.config { 56 | virtual_text = false, 57 | underline = false, 58 | signs = true, -- Keep gutter signs 59 | } 60 | -------------------------------------------------------------------------------- /lua/plugins.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | 3 | if not vim.loop.fs_stat(lazypath) then 4 | vim.fn.system({ 5 | "git", 6 | "clone", 7 | "--filter=blob:none", 8 | "https://github.com/folke/lazy.nvim.git", 9 | "--branch=stable", -- latest stable release 10 | lazypath, 11 | }) 12 | end 13 | vim.opt.rtp:prepend(lazypath) 14 | 15 | local plugins = { 16 | -- Themes 17 | { 18 | "folke/tokyonight.nvim", 19 | lazy = false, -- make sure we load this during startup if it is your main colorscheme 20 | priority = 1000, -- make sure to load this before all the other start plugins 21 | }, 22 | { 'marko-cerovac/material.nvim' }, 23 | { "rose-pine/neovim", name = "rose-pine", opts = {styles = {italic = false,},}}, 24 | 25 | -- LSP 26 | { "williamboman/mason.nvim", config = function() require("mason").setup() end }, 27 | { "williamboman/mason-lspconfig.nvim" , config = function() require("mason-lspconfig").setup() end }, 28 | 29 | { "neovim/nvim-lspconfig", config = function() require('plugins.lspconfig') end }, 30 | 31 | -- Signature help 32 | {"ray-x/lsp_signature.nvim", config = function() require("lsp_signature").setup() end }, 33 | 34 | -- Autocomplete 35 | { 36 | "hrsh7th/nvim-cmp", 37 | event = "InsertEnter", 38 | -- Sources for nvim-cmp 39 | dependencies = { 40 | "hrsh7th/cmp-nvim-lsp", 41 | "hrsh7th/cmp-buffer", 42 | "hrsh7th/cmp-path", 43 | "hrsh7th/cmp-nvim-lua", 44 | "hrsh7th/cmp-cmdline", 45 | "saadparwaiz1/cmp_luasnip", 46 | }, 47 | config = function() require('plugins.cmp') end, 48 | }, 49 | 50 | -- Treesitter 51 | { 52 | 'nvim-treesitter/nvim-treesitter', 53 | lazy = false, 54 | config = function() require('plugins.treesitter') end, 55 | build = ':TSUpdate' 56 | }, 57 | 58 | -- Snippets 59 | {"L3MON4D3/LuaSnip", config = function() require('plugins.snippets') end}, 60 | {"rafamadriz/friendly-snippets"}, 61 | 62 | -- Telescope 63 | { 64 | 'nvim-telescope/telescope.nvim', 65 | config = function() require('plugins.telescope') end, 66 | }, 67 | 68 | {'nvim-telescope/telescope-fzf-native.nvim', build ='make'}, 69 | 70 | -- bufferline 71 | { 72 | 'akinsho/bufferline.nvim', 73 | dependencies = 'kyazdani42/nvim-web-devicons', 74 | config = function() require('plugins.bufferline') end, 75 | event = 'BufWinEnter', 76 | }, 77 | 78 | -- statusline 79 | { 80 | 'hoob3rt/lualine.nvim', 81 | config = function() require('plugins.lualine') end, 82 | }, 83 | 84 | -- NvimTree 85 | { 86 | 'kyazdani42/nvim-tree.lua', 87 | dependencies = 'kyazdani42/nvim-web-devicons', 88 | config = function() require('plugins.nvimtree') end, -- Must add this manually 89 | }, 90 | 91 | -- Startify 92 | { 93 | 'mhinz/vim-startify', 94 | config = function() 95 | local path = vim.fn.stdpath('config')..'/lua/plugins/startify.vim' 96 | vim.cmd('source '..path) 97 | end 98 | }, 99 | 100 | {'folke/trouble.nvim', opts={}, cmd='Trouble'}, 101 | 102 | -- git commands 103 | {'tpope/vim-fugitive'}, 104 | 105 | -- Gitsigns 106 | { 107 | 'lewis6991/gitsigns.nvim', 108 | dependencies = {'nvim-lua/plenary.nvim'}, 109 | config = function() require('plugins.gitsigns') end 110 | }, 111 | 112 | -- Formatting 113 | { 'tpope/vim-commentary' }, 114 | { 'tpope/vim-unimpaired' }, 115 | { 'tpope/vim-surround' }, 116 | { 'tpope/vim-repeat' }, 117 | { 'junegunn/vim-easy-align' }, 118 | 119 | -- Copilot 120 | -- { "github/copilot.vim" }, 121 | -- Use zbirenbaum's version since it is written in lua and is much more efficient 122 | { 123 | "zbirenbaum/copilot.lua", 124 | dependencies = { 125 | "nvim-lua/plenary.nvim", 126 | }, 127 | cmd = "Copilot", 128 | event = "InsertEnter", 129 | config = function() require('plugins.copilot') end, 130 | }, 131 | { 132 | "zbirenbaum/copilot-cmp", 133 | config = function () 134 | require("copilot_cmp").setup() 135 | end 136 | }, 137 | 138 | -- Python formatting 139 | { "EgZvor/vim-black" }, 140 | { 'jeetsukumaran/vim-python-indent-black' }, 141 | 142 | -- Python types 143 | { "microsoft/python-type-stubs" }, 144 | 145 | -- Python 146 | -- use 'heavenshell/vim-pydocstring' -- Overwrites a keymap, need to fix. 147 | -- use 'bfredl/nvim-ipy' 148 | 149 | -- Markdown 150 | { 'godlygeek/tabular' }, 151 | { 'ellisonleao/glow.nvim', config = true, cmd = "Glow" }, 152 | 153 | -- LaTex 154 | { 'lervag/vimtex' }, 155 | 156 | -- TOML Files 157 | { 'cespare/vim-toml' }, 158 | 159 | -- Poetry 160 | -- use({'petobens/poet-v', 161 | -- config = function() 162 | -- local path = vim.fn.stdpath('config')..'/lua/plugins/poet-v.vim' 163 | -- vim.cmd('source '..path) 164 | -- end 165 | -- }) 166 | 167 | -- kitty config syntax-highlight 168 | { "fladson/vim-kitty" }, 169 | 170 | -- note taking with zettelkasten 171 | 172 | -- useless plugin 173 | { 'eandrju/cellular-automaton.nvim' } 174 | } 175 | 176 | require('lazy').setup(plugins) 177 | -------------------------------------------------------------------------------- /lua/plugins/bufferline.lua: -------------------------------------------------------------------------------- 1 | require('bufferline') 2 | 3 | -- format as ". " 4 | local tabname_format = function (opts) 5 | return string.format('%s.', opts.ordinal) 6 | end 7 | 8 | require('bufferline').setup({ 9 | options = { 10 | always_show_bufferline = true, 11 | numbers = tabname_format, 12 | show_buffer_icons = true, 13 | show_buffer_close_icons = false, 14 | show_close_icon = false, 15 | separator_style = 'thin', 16 | -- Don't show bufferline over vertical, unmodifiable buffers 17 | offsets = {{ 18 | filetype = 'NvimTree', 19 | text = 'File Explorer', 20 | highlight = 'Directory' 21 | }}, 22 | }, 23 | -- Don't use italic on current buffer 24 | highlights = {buffer_selected = { bold = true },}, 25 | }) 26 | -------------------------------------------------------------------------------- /lua/plugins/cmp.lua: -------------------------------------------------------------------------------- 1 | local fn = vim.fn 2 | 3 | -- local Utils = require('utils') 4 | local luasnip = require('luasnip') 5 | local cmp = require('cmp') 6 | 7 | -- local exprinoremap = Utils.exprinoremap 8 | 9 | local function get_snippets_rtp() 10 | return vim.tbl_map(function(itm) 11 | return fn.fnamemodify(itm, ":h") 12 | end, vim.api.nvim_get_runtime_file( 13 | "package.json", true 14 | )) 15 | end 16 | 17 | local function has_words_before() 18 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 19 | return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil 20 | end 21 | 22 | 23 | local opts = { 24 | paths = { 25 | fn.stdpath('config')..'/snips/', 26 | get_snippets_rtp()[1], 27 | }, 28 | } 29 | 30 | require('luasnip.loaders.from_vscode').lazy_load(opts) 31 | 32 | cmp.setup({ 33 | -- Don't autocomplete, otherwise there is too much clutter 34 | -- completion = {autocomplete = { false },}, 35 | 36 | -- Don't preselect an option 37 | preselect = cmp.PreselectMode.None, 38 | 39 | -- completion = { 40 | -- autocomplete = false, 41 | -- completeopt = vim.o.completeopt, 42 | -- }, 43 | 44 | experimental = { 45 | ghost_text = true, 46 | }, 47 | 48 | -- Snippet engine, required 49 | snippet = { 50 | expand = function(args) 51 | luasnip.lsp_expand(args.body) 52 | end, 53 | }, 54 | 55 | -- Mappings 56 | mapping = { 57 | -- open/close autocomplete 58 | [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), 59 | 60 | [""] = cmp.mapping(function(fallback) 61 | if require("copilot.suggestion").is_visible() then 62 | require("copilot.suggestion").accept() 63 | elseif cmp.visible() then 64 | cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) 65 | elseif luasnip.expandable() then 66 | luasnip.expand() 67 | elseif has_words_before() then 68 | cmp.complete() 69 | else 70 | fallback() 71 | end 72 | end, { 73 | "i", 74 | "s", 75 | }), 76 | 77 | [""] = cmp.mapping(function() 78 | if cmp.visible() then 79 | cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) 80 | end 81 | end, { 82 | "i", 83 | "s", 84 | }), 85 | -- [''] = function(fallback) 86 | -- if cmp.visible() then 87 | -- cmp.close() 88 | -- else 89 | -- cmp.complete() 90 | -- end 91 | -- end, 92 | 93 | -- [''] = function(fallback) 94 | -- if cmp.visible() then 95 | -- cmp.select_next_item() 96 | -- elseif luasnip.expand_or_jumpable() then 97 | -- luasnip.expand_or_jump() 98 | -- else 99 | -- fallback() 100 | -- end 101 | -- end, 102 | 103 | -- [''] = function(fallback) 104 | -- if cmp.visible() then 105 | -- cmp.select_prev_item() 106 | -- elseif luasnip.jumpable(-1) then 107 | -- luasnip.jump(-1) 108 | -- else 109 | -- fallback() 110 | -- end 111 | -- end, 112 | 113 | [''] = cmp.mapping.close(), 114 | 115 | -- select completion 116 | [''] = cmp.mapping.confirm({ 117 | behavior = cmp.ConfirmBehavior.Replace, 118 | select = false, 119 | }), 120 | 121 | -- Scroll documentation 122 | [''] = cmp.mapping.scroll_docs(-4), 123 | [''] = cmp.mapping.scroll_docs(4), 124 | }, 125 | 126 | -- Complete options from the LSP servers and the snippet engine 127 | sources = { 128 | {name = 'nvim_lsp', priority = 3}, 129 | {name = 'luasnip', priority = 1}, 130 | -- {name = "copilot", group_index = 2, priority = 3}, 131 | 132 | {name = 'path' }, 133 | {name = 'buffer' }, 134 | -- {name = 'nvim_lua', group_index = 2}, 135 | -- {name = 'spell', group_index = 2}, 136 | -- {name = 'calc'}, 137 | }, 138 | }) 139 | 140 | -- Disable copilot in cmp popup 141 | cmp.event:on("menu_opened", function() 142 | vim.b.copilot_suggestion_hidden = true 143 | end) 144 | 145 | cmp.event:on("menu_closed", function() 146 | vim.b.copilot_suggestion_hidden = false 147 | end) 148 | 149 | -- Proper sources for buffer and cmdline 150 | cmp.setup.cmdline("/", { 151 | sources = { 152 | { name = "buffer" }, 153 | }, 154 | }) 155 | 156 | cmp.setup.cmdline(":", { 157 | sources = cmp.config.sources({ 158 | { name = "path" }, 159 | }, { 160 | { name = "cmdline" }, 161 | }), 162 | }) 163 | -------------------------------------------------------------------------------- /lua/plugins/copilot.lua: -------------------------------------------------------------------------------- 1 | require("copilot").setup({ 2 | panel = { 3 | auto_refresh = false, 4 | keymap = { 5 | accept = "", 6 | jump_prev = "[[", 7 | jump_next = "]]", 8 | refresh = "gr", 9 | open = "", 10 | }, 11 | }, 12 | suggestion = { 13 | auto_trigger = false, 14 | keymap = { 15 | accept = false, 16 | accept_word = "", 17 | accept_line = "", 18 | prev = "", 19 | next = "", 20 | dismiss = "", 21 | }, 22 | }, 23 | }) 24 | 25 | local suggestion = require("copilot.suggestion") 26 | 27 | vim.keymap.set("i", "", function() 28 | if suggestion.is_visible() then 29 | suggestion.accept() 30 | else 31 | suggestion.next() 32 | end 33 | end, { desc ="[copilot] accept or next suggestion" }) 34 | -------------------------------------------------------------------------------- /lua/plugins/gitsigns.lua: -------------------------------------------------------------------------------- 1 | require('gitsigns').setup{ 2 | on_attach = function(bufnr) 3 | local gs = package.loaded.gitsigns 4 | 5 | local function map(mode, l, r, opts) 6 | opts = opts or {} 7 | opts.buffer = bufnr 8 | vim.keymap.set(mode, l, r, opts) 9 | end 10 | 11 | -- Navigation 12 | map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) 13 | map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) 14 | 15 | -- Actions 16 | map({'n', 'v'}, 'hs', ':Gitsigns stage_hunk') 17 | map({'n', 'v'}, 'hr', ':Gitsigns reset_hunk') 18 | map('n', 'hS', gs.stage_buffer) 19 | map('n', 'hu', gs.undo_stage_hunk) 20 | map('n', 'hR', gs.reset_buffer) 21 | map('n', 'hp', gs.preview_hunk) 22 | map('n', 'hb', function() gs.blame_line{full=true} end) 23 | map('n', 'tb', gs.toggle_current_line_blame) 24 | map('n', 'hd', gs.diffthis) 25 | map('n', 'hD', function() gs.diffthis('~') end) 26 | map('n', 'td', gs.toggle_deleted) 27 | 28 | -- Text object 29 | map({'o', 'x'}, 'ih', ':Gitsigns select_hunk') 30 | end 31 | } 32 | -------------------------------------------------------------------------------- /lua/plugins/lspconfig.lua: -------------------------------------------------------------------------------- 1 | local mason_lspconfig = require("mason-lspconfig") 2 | local lspconfig = require("lspconfig") 3 | local common_on_attach = require("lsp.utils").common_on_attach 4 | local capabilities = vim.lsp.protocol.make_client_capabilities() 5 | 6 | capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) 7 | 8 | local servers = { 9 | "bashls", 10 | "clangd", 11 | "dockerls", 12 | -- "jedi_langauge_server", 13 | -- "hls", 14 | -- "basedpyright", 15 | "julials", 16 | "jsonls", 17 | "lua_ls", 18 | "marksman", 19 | "pyright", 20 | "texlab", 21 | } 22 | 23 | mason_lspconfig.setup({ 24 | ensure_installed = servers, 25 | handlers=function (server_name) 26 | lspconfig[server_name].setup { 27 | on_attach = common_on_attach, 28 | capabilities = capabilities, 29 | } 30 | end 31 | }) 32 | -------------------------------------------------------------------------------- /lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | -- Lualine configuration 2 | 3 | local non_language_ft = {'fugitive', 'startify'} 4 | 5 | require('lualine').setup({ 6 | options = { 7 | theme = "auto", 8 | -- Separators might look weird for certain fonts (eg Cascadia) 9 | component_separators = {left = '', right = ''}, 10 | section_separators = {left = '', right = ''}, 11 | globalstatus = true, 12 | }, 13 | sections = { 14 | lualine_a = {'mode'}, 15 | lualine_b = {'branch', 'diff'}, 16 | lualine_c = { 17 | "filename", 18 | }, 19 | lualine_x = { 20 | { 21 | 'diagnostics', 22 | sources = {'nvim_diagnostic'}, 23 | sections = {'error', 'warn', 'info'}, 24 | }, 25 | }, 26 | lualine_y = { 27 | "filetype", 28 | { 29 | function() 30 | local msg = 'No LSP' 31 | local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') 32 | local clients = vim.lsp.get_clients() 33 | 34 | if next(clients) == nil then 35 | return msg 36 | end 37 | 38 | -- Check for utility buffers 39 | for ft in non_language_ft do 40 | if ft:match(buf_ft) then 41 | return '' 42 | end 43 | end 44 | 45 | for _, client in ipairs(clients) do 46 | local filetypes = client.config.filetypes 47 | 48 | if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then 49 | -- return 'LSP:'..client.name -- Return LSP name 50 | return '' -- Only display if no LSP is found 51 | end 52 | end 53 | 54 | return msg 55 | end, 56 | color = {fg = '#ffffff', gui = 'bold'}, 57 | separator = "", 58 | }, 59 | "encoding", 60 | }, 61 | lualine_z = { 62 | {function () return '' end}, 63 | 'progress', 64 | 'location', 65 | } 66 | }, 67 | }) 68 | -------------------------------------------------------------------------------- /lua/plugins/nvimtree.lua: -------------------------------------------------------------------------------- 1 | -- NVIM tree 2 | 3 | require('nvim-tree').setup({ 4 | -- Allow using gx 5 | disable_netrw = false, 6 | hijack_netrw = false, 7 | update_cwd = true, 8 | }) 9 | -------------------------------------------------------------------------------- /lua/plugins/poet-v.vim: -------------------------------------------------------------------------------- 1 | " Poet-v 2 | " 3 | let g:poetv_executables = ['poetry', 'pipenv'] 4 | let g:poetv_auto_activate = 1 5 | let g:poetv_statusline_symbol = '' 6 | let g:poetv_set_environment = 1 7 | 8 | augroup poetv_autocmd 9 | au! 10 | au WinEnter,BufWinEnter *.py 11 | \ if &previewwindow != 1 && expand('%:p') !~# "/\\.git/" | 12 | \ call poetv#activate() | call ale#lsp#reset#StopAllLSPs() | 13 | \ endif 14 | augroup END 15 | -------------------------------------------------------------------------------- /lua/plugins/snippets.lua: -------------------------------------------------------------------------------- 1 | -- LuaSnip 2 | 3 | require('luasnip.loaders.from_vscode').lazy_load() 4 | require('luasnip').filetype_extend("python", {'pytorch'}) 5 | -------------------------------------------------------------------------------- /lua/plugins/startify.vim: -------------------------------------------------------------------------------- 1 | " Startify 2 | 3 | " Don't show [e] and [q] options 4 | let g:startify_enable_special = 0 5 | 6 | " Change directory when opening file using Startify 7 | let g:startify_change_to_dir = 1 " This is the default value 8 | 9 | " Add bashrc and nvim config files 10 | let g:startify_bookmarks = [ 11 | \ {'c': '~/.config/zsh/.zshrc'}, 12 | \ {'a': '~/.config/zsh/.zsh_aliases'}, 13 | \ {'d': '~/.config/dotfiles/README.md'}, 14 | \ {'n': '~/.config/nvim/init.lua'} 15 | \ ] 16 | 17 | " Change list order 18 | let g:startify_lists = [ 19 | \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, 20 | \ { 'type': 'sessions', 'header': [' Sessions'] }, 21 | \ { 'type': 'files', 'header': [' Recent Files'] }, 22 | \ { 'type': 'dir', 'header': [' Current Directory '. getcwd()] }, 23 | \ { 'type': 'commands', 'header': [' Commands'] }, 24 | \ ] 25 | -------------------------------------------------------------------------------- /lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | local actions = require('telescope.actions') 2 | -- local utils = require('telescope.utils') 3 | -- local trouble = require('telescope.providers.telescope') 4 | 5 | require('telescope').setup({ 6 | defaults = { 7 | sorting_strategy = "ascending", 8 | mappings = { 9 | i = { 10 | [''] = actions.move_selection_next, 11 | [''] = actions.move_selection_previous, 12 | [''] = actions.close, 13 | }, 14 | n = { 15 | [''] = actions.close, 16 | }, 17 | }, 18 | layout_config = { 19 | horizontal ={ 20 | height = 47, 21 | prompt_position = "top", 22 | } 23 | } 24 | }, 25 | extensions ={ 26 | fzf = { 27 | fuzzy = true, -- false will only do exact matching 28 | override_generic_sorter = true, -- override the generic sorter 29 | override_file_sorter = true, -- override the file sorter 30 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" 31 | -- the default case_mode is "smart_case" 32 | }, 33 | }, 34 | }) 35 | 36 | require('telescope').load_extension('fzf') 37 | -------------------------------------------------------------------------------- /lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | -- Treesitter configuration 2 | 3 | require('nvim-treesitter.configs').setup({ 4 | highlight = { 5 | enable = true, 6 | additional_vim_regex_highlighting = false 7 | }, 8 | -- We must manually specify which parsers to install 9 | ensure_installed = { 10 | "bash", 11 | "c", 12 | "cpp", 13 | "cuda", 14 | "json", 15 | "julia", 16 | "lua", 17 | "markdown", 18 | "python", 19 | "yaml", 20 | "vim", 21 | "latex", 22 | }, 23 | }) 24 | -------------------------------------------------------------------------------- /lua/themes.lua: -------------------------------------------------------------------------------- 1 | -- Themes 2 | 3 | -- TokioNight 4 | -- vim.g.tokyonight_style = 'night' 5 | -- vim.g.tokyonight_italic_comments = false 6 | -- vim.cmd [[colorscheme tokyonight]] 7 | 8 | -- Material 9 | -- vim.g.material_style = 'oceanic' 10 | -- vim.cmd [[colorscheme material]] 11 | 12 | 13 | -- Rose Pine 14 | -- vim.cmd("colorscheme rose-pine") 15 | vim.cmd("colorscheme rose-pine-moon") 16 | -- vim.cmd("colorscheme rose-pine-dawn") 17 | -------------------------------------------------------------------------------- /lua/utils.lua: -------------------------------------------------------------------------------- 1 | -- Keymap functions 2 | 3 | local M = {} 4 | 5 | function M.map(mode, lhs, rhs) 6 | vim.api.nvim_set_keymap(mode, lhs, rhs, {silent = true}) 7 | end 8 | 9 | function M.noremap(mode, lhs, rhs) 10 | vim.api.nvim_set_keymap(mode, lhs, rhs, {noremap = true, silent = true}) 11 | end 12 | 13 | function M.exprnoremap(mode, lhs, rhs) 14 | vim.api.nvim_set_keymap(mode, lhs, rhs, {noremap = true, silent = true, expr = true}) 15 | end 16 | 17 | -- Useful mode-specific shortcuts 18 | -- nomenclature: "map(lhs, rhs)" where: 19 | -- "expr?" optional expr option 20 | -- "nore?" optional no-remap option 21 | -- modes -> 'n' = NORMAL, 'i' = INSERT, 'x' = 'VISUAL', 'v' = VISUAL + SELECT, 't' = TERMINAL 22 | 23 | function M.nmap(lhs, rhs) M.map('n', lhs, rhs) end 24 | 25 | function M.xmap(lhs, rhs) M.map('x', lhs, rhs) end 26 | 27 | function M.nnoremap(lhs, rhs) M.noremap('n', lhs, rhs) end 28 | 29 | function M.vnoremap(lhs, rhs) M.noremap('v', lhs, rhs) end 30 | 31 | function M.xnoremap(lhs, rhs) M.noremap('x', lhs, rhs) end 32 | 33 | function M.inoremap(lhs, rhs) M.noremap('i', lhs, rhs) end 34 | 35 | function M.tnoremap(lhs, rhs) M.noremap('t', lhs, rhs) end 36 | 37 | function M.exprnnoremap(lhs, rhs) M.exprnoremap('n', lhs, rhs) end 38 | 39 | function M.exprinoremap(lhs, rhs) M.exprnoremap('i', lhs, rhs) end 40 | 41 | return M 42 | --------------------------------------------------------------------------------