diff options
author | A Farzat <a@farzat.xyz> | 2024-11-06 09:09:37 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2024-11-13 09:13:20 +0900 |
commit | 7ec1fa7385c1b88a2efdad72c805b254c52084bd (patch) | |
tree | 2917de2bbd3552adca5dbe4989460f4b25672595 /.config | |
parent | cb5affa0e11c200f175e26ced4f2866aa916d2c9 (diff) | |
download | dotfiles-7ec1fa7385c1b88a2efdad72c805b254c52084bd.tar.gz dotfiles-7ec1fa7385c1b88a2efdad72c805b254c52084bd.zip |
Remove nvim submodule
Nvim config will be included as bare files instead of a submodule. The
nvim config repo will still exist, but the content will be used by yadm
without the repo itself.
Diffstat (limited to '.config')
42 files changed, 582 insertions, 0 deletions
diff --git a/.config/nvim b/.config/nvim deleted file mode 160000 -Subproject 8e5b57c2cb69e5a6929ad5b12645b0a900eeb07 diff --git a/.config/nvim/.luarc.jsonc b/.config/nvim/.luarc.jsonc new file mode 100644 index 0000000..e976381 --- /dev/null +++ b/.config/nvim/.luarc.jsonc @@ -0,0 +1,15 @@ +// Copied from https://github.com/nvim-tree/nvim-tree.lua/blob/master/.luarc.json +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "runtime.version": "LuaJIT", + "workspace": { + "library": [ + "$VIMRUNTIME/lua/vim", + "${3rd}/luv/library" + ] + }, + "diagnostics": { + "libraryFiles": "Disable", + "globals": [] + } +} diff --git a/.config/nvim/.stylua.toml b/.config/nvim/.stylua.toml new file mode 100644 index 0000000..e4a60f0 --- /dev/null +++ b/.config/nvim/.stylua.toml @@ -0,0 +1,3 @@ +column_width = 80 +indent_type = "Spaces" +indent_width = 2 diff --git a/.config/nvim/LICENSE b/.config/nvim/LICENSE new file mode 100644 index 0000000..b7a83ba --- /dev/null +++ b/.config/nvim/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 A Farzat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.config/nvim/README.md b/.config/nvim/README.md new file mode 100644 index 0000000..cbbefed --- /dev/null +++ b/.config/nvim/README.md @@ -0,0 +1,3 @@ +# Vim config + +My vim configuration files diff --git a/.config/nvim/after/queries/css/folds.scm b/.config/nvim/after/queries/css/folds.scm new file mode 100644 index 0000000..94c23e7 --- /dev/null +++ b/.config/nvim/after/queries/css/folds.scm @@ -0,0 +1,6 @@ +; extends +[ + ;; Use :InspectTree to find the relevant nodes. + (block) + (keyframe_block_list)+ +] @fold diff --git a/.config/nvim/early-settings/nvim-tree.lua b/.config/nvim/early-settings/nvim-tree.lua new file mode 100644 index 0000000..5db19d7 --- /dev/null +++ b/.config/nvim/early-settings/nvim-tree.lua @@ -0,0 +1,2 @@ +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 diff --git a/.config/nvim/ftplugin/c.lua b/.config/nvim/ftplugin/c.lua new file mode 100644 index 0000000..d6e872d --- /dev/null +++ b/.config/nvim/ftplugin/c.lua @@ -0,0 +1,10 @@ +vim.api.nvim_buf_create_user_command(0, "ToggleComment", function() + if + require("Comment.ft").get("c", require("Comment.utils").ctype.linewise) + == "//%s" + then + require("Comment.ft").set("c", "/*%s*/") + else + require("Comment.ft").set("c", "//%s") + end +end, {}) diff --git a/.config/nvim/ftplugin/c.vim b/.config/nvim/ftplugin/c.vim new file mode 100644 index 0000000..1550367 --- /dev/null +++ b/.config/nvim/ftplugin/c.vim @@ -0,0 +1,4 @@ +command-buffer Compile w | make %:r:S +command-buffer CompileM w | !gcc -o %:r:S %:S -lm +command-buffer Make w | !make %:r:S +command-buffer -nargs=* Run split | terminal chmod +x %:p:S; %:p:S <args> diff --git a/.config/nvim/ftplugin/css.vim b/.config/nvim/ftplugin/css.vim new file mode 100644 index 0000000..46cf568 --- /dev/null +++ b/.config/nvim/ftplugin/css.vim @@ -0,0 +1 @@ +setlocal tabstop=2 diff --git a/.config/nvim/ftplugin/html.vim b/.config/nvim/ftplugin/html.vim new file mode 100644 index 0000000..46cf568 --- /dev/null +++ b/.config/nvim/ftplugin/html.vim @@ -0,0 +1 @@ +setlocal tabstop=2 diff --git a/.config/nvim/ftplugin/info.vim b/.config/nvim/ftplugin/info.vim new file mode 100644 index 0000000..f725e8d --- /dev/null +++ b/.config/nvim/ftplugin/info.vim @@ -0,0 +1,5 @@ +if &buftype =~? 'nofile' + nmap <buffer> gu <Plug>(InfoUp) + nmap <buffer> gn <Plug>(InfoNext) + nmap <buffer> gp <Plug>(InfoPrev) +endif diff --git a/.config/nvim/ftplugin/javascript.vim b/.config/nvim/ftplugin/javascript.vim new file mode 100644 index 0000000..0269951 --- /dev/null +++ b/.config/nvim/ftplugin/javascript.vim @@ -0,0 +1,3 @@ +command-buffer -nargs=* Run split | terminal chmod +x %:p:S; %:p:S <args> +command-buffer -nargs=* WRun w | Run <args> +setlocal tabstop=2 diff --git a/.config/nvim/ftplugin/json.vim b/.config/nvim/ftplugin/json.vim new file mode 100644 index 0000000..46cf568 --- /dev/null +++ b/.config/nvim/ftplugin/json.vim @@ -0,0 +1 @@ +setlocal tabstop=2 diff --git a/.config/nvim/ftplugin/lua.vim b/.config/nvim/ftplugin/lua.vim new file mode 100644 index 0000000..0269951 --- /dev/null +++ b/.config/nvim/ftplugin/lua.vim @@ -0,0 +1,3 @@ +command-buffer -nargs=* Run split | terminal chmod +x %:p:S; %:p:S <args> +command-buffer -nargs=* WRun w | Run <args> +setlocal tabstop=2 diff --git a/.config/nvim/ftplugin/markdown.vim b/.config/nvim/ftplugin/markdown.vim new file mode 100644 index 0000000..9994a22 --- /dev/null +++ b/.config/nvim/ftplugin/markdown.vim @@ -0,0 +1,3 @@ +setlocal tabstop=4 +command-buffer Run !linkhandler %:S +command-buffer WRun w | Run diff --git a/.config/nvim/ftplugin/netrw.vim b/.config/nvim/ftplugin/netrw.vim new file mode 100644 index 0000000..2313255 --- /dev/null +++ b/.config/nvim/ftplugin/netrw.vim @@ -0,0 +1 @@ +setlocal textwidth=0 diff --git a/.config/nvim/ftplugin/processing.vim b/.config/nvim/ftplugin/processing.vim new file mode 100644 index 0000000..2550b8e --- /dev/null +++ b/.config/nvim/ftplugin/processing.vim @@ -0,0 +1 @@ +command-buffer WRun w | make diff --git a/.config/nvim/ftplugin/python.vim b/.config/nvim/ftplugin/python.vim new file mode 100644 index 0000000..6dd1221 --- /dev/null +++ b/.config/nvim/ftplugin/python.vim @@ -0,0 +1,3 @@ +command-buffer -nargs=* Run split | terminal chmod +x %:p:S; %:p:S <args> +command-buffer -nargs=* WRun w | Run <args> +setlocal textwidth=79 diff --git a/.config/nvim/ftplugin/sh.vim b/.config/nvim/ftplugin/sh.vim new file mode 100644 index 0000000..9d9e5a4 --- /dev/null +++ b/.config/nvim/ftplugin/sh.vim @@ -0,0 +1,2 @@ +command-buffer -nargs=* Run split | terminal chmod +x %:p:S; %:p:S <args> +command-buffer -nargs=* WRun w | Run <args> diff --git a/.config/nvim/ftplugin/tex.vim b/.config/nvim/ftplugin/tex.vim new file mode 100644 index 0000000..783fab6 --- /dev/null +++ b/.config/nvim/ftplugin/tex.vim @@ -0,0 +1,4 @@ +" Settings for tex files. +setlocal keywordprg=texdoc +setlocal spell spelllang=en +setlocal tabstop=2 diff --git a/.config/nvim/global-mappings.vim b/.config/nvim/global-mappings.vim new file mode 100644 index 0000000..6fddc08 --- /dev/null +++ b/.config/nvim/global-mappings.vim @@ -0,0 +1,23 @@ +" Windows navigation. +nnoremap <C-J> <C-W><C-J> +nnoremap <C-K> <C-W><C-K> +nnoremap <C-L> <C-W><C-L> +nnoremap <C-H> <C-W><C-H> + +" Mkdir for the current file. +command MkCurDir :!mkdir %:h:S -p + +" Copy the last used register to the clipboard. +command Clipboard :call system('cclip', @") + +" Reload settings. +command Source :source $MYVIMRC + +" Automatically starts terminal emulator in insert mode. +autocmd TermOpen * startinsert +tnoremap <C-h> <C-\><C-n><C-w>h +" Workaround since <C-h> isn't working in neovim right now +" tnoremap <C-w>h <C-\><C-n><C-w>h +tnoremap <C-j> <C-\><C-n><C-w>j +tnoremap <C-k> <C-\><C-n><C-w>k +tnoremap <C-l> <C-\><C-n><C-w>l diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..29132c3 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,21 @@ +" Some settings need to be made before loading the plugins. +for fileName in globpath(stdpath("config") .. '/early-settings', '*', 0, 1) + execute 'source ' . fnameescape(fileName) +endfor + +" Install and manage the plugins. +source <sfile>:p:h/plugins.vim + +" Regular settings. +source <sfile>:p:h/regular.vim + +" Global mappings. +source <sfile>:p:h/global-mappings.vim + +" Plugin config. +for fileName in globpath(stdpath("config") .. '/plugin-settings', '*', 0, 1) + execute 'source ' . fnameescape(fileName) +endfor + +" Emmit.vim settings. +let g:user_emmet_expandabbr_key = '<C-y>y' diff --git a/.config/nvim/plugin-settings/Comment.lua b/.config/nvim/plugin-settings/Comment.lua new file mode 100644 index 0000000..d063eac --- /dev/null +++ b/.config/nvim/plugin-settings/Comment.lua @@ -0,0 +1,3 @@ +require('Comment').setup({ + ignore = '^$' +}) diff --git a/.config/nvim/plugin-settings/fzf.vim b/.config/nvim/plugin-settings/fzf.vim new file mode 100644 index 0000000..c8eb64e --- /dev/null +++ b/.config/nvim/plugin-settings/fzf.vim @@ -0,0 +1 @@ +let g:fzf_command_prefix = 'Fzf' diff --git a/.config/nvim/plugin-settings/indent-blankline.lua b/.config/nvim/plugin-settings/indent-blankline.lua new file mode 100644 index 0000000..a0f1096 --- /dev/null +++ b/.config/nvim/plugin-settings/indent-blankline.lua @@ -0,0 +1,35 @@ +vim.api.nvim_set_hl(0, "IblScope", { ctermfg = "Gray" }) +vim.api.nvim_set_hl(0, "IblWhitespace", { ctermfg = "DarkGray" }) +vim.api.nvim_set_hl(0, "RainbowRed", { ctermfg = "Red" }) +vim.api.nvim_set_hl(0, "RainbowYellow", { ctermfg = "Yellow" }) +vim.api.nvim_set_hl(0, "RainbowBlue", { ctermfg = "Blue" }) +vim.api.nvim_set_hl(0, "RainbowGreen", { ctermfg = "Green" }) +vim.api.nvim_set_hl(0, "RainbowMagenta", { ctermfg = "Magenta" }) +vim.api.nvim_set_hl(0, "RainbowCyan", { ctermfg = "Cyan" }) + +local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowGreen", + "RainbowMagenta", + "RainbowCyan", +} + +require("ibl").setup { + indent = { + char = "›", + highlight = highlight, + }, +} + +vim.opt.list = true +vim.opt.listchars = { + tab = "» ⇥", + lead = "·", + trail = "␣", + nbsp = "⍽", + extends = "❯", + precedes = "❮", + eol = "↴", +} diff --git a/.config/nvim/plugin-settings/lspconfig.lua b/.config/nvim/plugin-settings/lspconfig.lua new file mode 100644 index 0000000..150db34 --- /dev/null +++ b/.config/nvim/plugin-settings/lspconfig.lua @@ -0,0 +1,94 @@ +local lspconfig = require("lspconfig") + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +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) +vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts) +-- See `:help vim.lsp.*` for documentation on any of the below functions +vim.keymap.set("n", "<leader>D", vim.lsp.buf.declaration, opts) +vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts) +vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) +vim.keymap.set("n", "<space>sh", vim.lsp.buf.signature_help, opts) +vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts) +vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts) +vim.keymap.set("n", "<space>wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, opts) +vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts) +vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts) +vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts) +vim.keymap.set("n", "<space>gr", vim.lsp.buf.references, opts) +vim.keymap.set("n", "<space>f", function() + vim.lsp.buf.format({ async = true }) +end, opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(_, bufnr) + vim.api.nvim_set_option_value( -- Enable completion triggered by <c-x><c-o> + "omnifunc", + "v:lua.vim.lsp.omnifunc", + { buf = bufnr } + ) +end + +-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local simple_servers = { + "bashls", + "clangd", + "cssls", + "emmet_language_server", + "jedi_language_server", + "jsonls", + "remark_ls", + "texlab", + "vimls", + "yamlls", +} +for _, lsp in ipairs(simple_servers) do + lspconfig[lsp].setup({ capabilities = capabilities, on_attach = on_attach }) +end + +require("lspconfig").lua_ls.setup({ + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + vim.uv.fs_stat(path .. "/.luarc.json") + or vim.uv.fs_stat(path .. "/.luarc.jsonc") + then + return + end + end + + client.config.settings.Lua = + vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + }, + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + }, + }) + end, + settings = { + Lua = {}, + }, +}) diff --git a/.config/nvim/plugin-settings/luasnip.lua b/.config/nvim/plugin-settings/luasnip.lua new file mode 100644 index 0000000..c8cd578 --- /dev/null +++ b/.config/nvim/plugin-settings/luasnip.lua @@ -0,0 +1,32 @@ +local luasnip = require("luasnip") + +require("luasnip.loaders.from_vscode").lazy_load() + +local opts = { noremap = true, silent = true } + +vim.keymap.set("i", "<C-l>", function() + luasnip.expand() +end, opts) +vim.keymap.set("s", "<C-l>", function() + luasnip.expand() +end, opts) +vim.keymap.set("i", "<C-k>", function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end +end, opts) +vim.keymap.set("s", "<C-k>", function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end +end, opts) +vim.keymap.set("i", "<C-j>", function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end +end, opts) +vim.keymap.set("s", "<C-j>", function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end +end, opts) diff --git a/.config/nvim/plugin-settings/netrw.nvim.lua b/.config/nvim/plugin-settings/netrw.nvim.lua new file mode 100644 index 0000000..ff07d03 --- /dev/null +++ b/.config/nvim/plugin-settings/netrw.nvim.lua @@ -0,0 +1 @@ +require("netrw").setup({}) diff --git a/.config/nvim/plugin-settings/nnn.nvim.lua b/.config/nvim/plugin-settings/nnn.nvim.lua new file mode 100644 index 0000000..dbdf7b2 --- /dev/null +++ b/.config/nvim/plugin-settings/nnn.nvim.lua @@ -0,0 +1,18 @@ +local builtin = require("nnn").builtin +require("nnn").setup({ + explorer = { + cmd = "n3", -- command overrride (-F1 flag is implied, -a flag is invalid!) + }, + picker = { + cmd = "n3 -a -Pp", -- command override (-p flag is implied) + }, + mappings = { + { "<C-t>", builtin.open_in_tab }, -- open file(s) in tab + { "<C-s>", builtin.open_in_split }, -- open file(s) in split + { "<C-v>", builtin.open_in_vsplit }, -- open file(s) in vertical split + { "<C-p>", builtin.open_in_preview }, -- open file in preview split keeping nnn focused + { "<C-y>", builtin.copy_to_clipboard }, -- copy file(s) to clipboard + { "<C-w>", builtin.cd_to_path }, -- cd to file directory + { "<C-e>", builtin.populate_cmdline }, -- populate cmdline (:) with file(s) + }, +}) diff --git a/.config/nvim/plugin-settings/null-ls.lua b/.config/nvim/plugin-settings/null-ls.lua new file mode 100644 index 0000000..4895ee3 --- /dev/null +++ b/.config/nvim/plugin-settings/null-ls.lua @@ -0,0 +1,8 @@ +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.diagnostics.markdownlint, + }, +}) diff --git a/.config/nvim/plugin-settings/nvim-cmp.lua b/.config/nvim/plugin-settings/nvim-cmp.lua new file mode 100644 index 0000000..defc39e --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-cmp.lua @@ -0,0 +1,56 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +cmp.setup({ + enabled = true, + snippet = { + expand = function(args) -- REQUIRED - you must specify a snippet engine + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + ["<C-b>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.abort(), + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-l>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ["<C-k>"] = cmp.mapping(function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end + end, { "i", "s" }), + ["<C-j>"] = cmp.mapping(function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "nvim_lua" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) diff --git a/.config/nvim/plugin-settings/nvim-miniyank.vim b/.config/nvim/plugin-settings/nvim-miniyank.vim new file mode 100644 index 0000000..a6469f9 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-miniyank.vim @@ -0,0 +1,10 @@ +nmap <c-n> <plug>(miniyank-cycle) +nmap <c-p> <plug>(miniyank-cycleback) +map p <plug>(miniyank-autoput) +map P <plug>(miniyank-autoPut) +map <leader>p <Plug>(miniyank-startput) +map <leader>P <Plug>(miniyank-startPut) +map <Leader>yc <Plug>(miniyank-tochar) +map <Leader>yl <Plug>(miniyank-toline) +map <Leader>yb <Plug>(miniyank-toblock) +let g:miniyank_filename = stdpath("cache")."/.miniyank.mpack" diff --git a/.config/nvim/plugin-settings/nvim-tree.lua b/.config/nvim/plugin-settings/nvim-tree.lua new file mode 100644 index 0000000..a8dcd46 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-tree.lua @@ -0,0 +1,19 @@ +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up')) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) +end + +-- pass to setup along with your other options +require("nvim-tree").setup { + on_attach = my_on_attach, +} diff --git a/.config/nvim/plugin-settings/nvim-treesitter.lua b/.config/nvim/plugin-settings/nvim-treesitter.lua new file mode 100644 index 0000000..4afe91e --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-treesitter.lua @@ -0,0 +1,13 @@ +require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" (the four listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim" }, + ignore_install = { "org" }, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + }, +}) diff --git a/.config/nvim/plugin-settings/nvim-ts-autotag.lua b/.config/nvim/plugin-settings/nvim-ts-autotag.lua new file mode 100644 index 0000000..92c7ea3 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-ts-autotag.lua @@ -0,0 +1,8 @@ +require('nvim-ts-autotag').setup({ + opts = { + -- Defaults + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false -- Auto close on trailing </ + }, +}) diff --git a/.config/nvim/plugin-settings/orgmode.lua b/.config/nvim/plugin-settings/orgmode.lua new file mode 100644 index 0000000..7f7428e --- /dev/null +++ b/.config/nvim/plugin-settings/orgmode.lua @@ -0,0 +1,7 @@ +local xdg_data = os.getenv("XDG_DATA_HOME") or "~/.local/share" +local orgmode_files = xdg_data .. "/orgmode" + +require('orgmode').setup({ + org_agenda_files = {orgmode_files .. '/**/*'}, + org_default_notes_file = orgmode_files .. 'default.org', +}) diff --git a/.config/nvim/plugin-settings/vim-airline.vim b/.config/nvim/plugin-settings/vim-airline.vim new file mode 100644 index 0000000..b4145dd --- /dev/null +++ b/.config/nvim/plugin-settings/vim-airline.vim @@ -0,0 +1 @@ +let g:airline_powerline_fonts = 1 diff --git a/.config/nvim/plugin-settings/vim-better-whitespace.vim b/.config/nvim/plugin-settings/vim-better-whitespace.vim new file mode 100644 index 0000000..51203ba --- /dev/null +++ b/.config/nvim/plugin-settings/vim-better-whitespace.vim @@ -0,0 +1,4 @@ +let g:better_whitespace_enabled=1 +let g:strip_whitespace_on_save=1 +let g:strip_whitelines_at_eof=1 +let g:strip_only_modified_lines=1 diff --git a/.config/nvim/plugin-settings/vimtex.vim b/.config/nvim/plugin-settings/vimtex.vim new file mode 100644 index 0000000..f90494b --- /dev/null +++ b/.config/nvim/plugin-settings/vimtex.vim @@ -0,0 +1,7 @@ +let g:tex_flavor = 'latex' +let g:vimtex_view_method='zathura' +let g:vimtex_compiler_progname='nvr' +let g:vimtex_quickfix_mode = 0 +"let g:tex_conceal = '' +"let g:tex_syntax_conceal_default = 0 +"let g:vimtex_quickfix_autoclose_after_keystrokes = 1 diff --git a/.config/nvim/plugins.vim b/.config/nvim/plugins.vim new file mode 100644 index 0000000..1ffb143 --- /dev/null +++ b/.config/nvim/plugins.vim @@ -0,0 +1,80 @@ +" Project https://github.com/junegunn/vim-plug. +" Auto-install "vim-plug" if not yet installed. +if empty(glob(stdpath('data') . '/site/autoload/plug.vim')) + silent execute '!curl -fLo '.stdpath('data').'/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +endif + +" Specify a directory for plugins. +call plug#begin() + +" Specifying plugins. +Plug 'https://github.com/nvim-lua/plenary.nvim' " plenary: full; complete; entire; absolute; unqualified. All the lua functions I don't want to write twice. +Plug 'https://gitlab.com/HiPhish/info.vim.git' " Read and browse info files in Vim. +Plug 'https://github.com/ledger/vim-ledger' " Vim plugin for Ledger. +Plug 'https://github.com/nvim-orgmode/orgmode' " Orgmode clone written in Lua for Neovim. +Plug 'https://github.com/fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Go development plugin for Vim. +Plug 'https://github.com/lervag/vimtex' " A modern vim plugin for editing LaTeX files. +Plug 'https://github.com/mrcjkb/rustaceanvim' " Supercharge your Rust experience in Neovim! A heavily modified fork of rust-tools.nvim. +Plug 'https://github.com/rhysd/vim-grammarous' " A powerful grammar checker for Vim using LanguageTool. +Plug 'https://github.com/lukas-reineke/indent-blankline.nvim' " Indent guides for Neovim. +Plug 'https://gitlab.com/HiPhish/rainbow-delimiters.nvim' " Rainbow delimiters for Neovim with Tree-sitter. +Plug 'https://github.com/nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Nvim Treesitter configurations and abstraction layer. +Plug 'https://github.com/nvim-treesitter/nvim-treesitter-context' " Show code context. +Plug 'https://github.com/jose-elias-alvarez/null-ls.nvim' " Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. +Plug 'https://github.com/Vimjas/vim-python-pep8-indent' " A nicer Python indentation style for vim. +Plug 'https://github.com/vim-airline/vim-airline' " Lean & mean status/tabline for vim that's light as air. +Plug 'https://github.com/vim-airline/vim-airline-themes' " A collection of themes for vim-airline. +Plug 'https://github.com/luukvbaal/nnn.nvim.git' " File manager for Neovim powered by nnn. +Plug 'https://github.com/z-shell/zi-vim-syntax' " A Vim syntax definition for ZI commands in any ft=zsh file. +Plug 'https://github.com/junegunn/fzf' " A command-line fuzzy finder. +Plug 'https://github.com/junegunn/fzf.vim' " fzf heart vim. +Plug 'https://github.com/mhinz/vim-signify' " Show a diff using Vim its sign column. +Plug 'https://github.com/tpope/vim-fugitive' " A Git wrapper so awesome, it should be illegal. +Plug 'https://github.com/tpope/vim-obsession' " Continuously updated session files. +Plug 'https://github.com/tpope/vim-scriptease' " A Vim plugin for Vim plugins. +Plug 'https://github.com/tpope/vim-sensible' " Defaults everyone can agree on. +Plug 'https://github.com/tpope/vim-surround' " surround.vim: quoting/parenthesizing made simple +Plug 'https://github.com/tpope/vim-sleuth' +Plug 'https://github.com/numtostr/Comment.nvim' " Smart and powerful comment plugin for neovim. Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more. +Plug 'https://github.com/tpope/vim-abolish' " Easily search for, substitute, and abbreviate multiple variants of a word. +Plug 'https://github.com/bfredl/nvim-miniyank' " Killring-alike plugin for neovim and vim 8 with no default mappings. +Plug 'https://github.com/sophacles/vim-processing' " For processing.org +Plug 'https://github.com/windwp/nvim-ts-autotag' " Use treesitter to auto close and auto rename html tag +Plug 'https://github.com/dylanaraps/wal.vim' " Generate and change colorschemes on the fly. +Plug 'https://github.com/dkprice/vim-easygrep' " Fast and Easy Find and Replace Across Multiple Files. +Plug 'https://github.com/lambdalisue/suda.vim' " An alternative sudo.vim for Vim and Neovim, limited support sudo in Windows. +Plug 'https://github.com/ntpeters/vim-better-whitespace' " Better whitespace highlighting for Vim. +Plug 'https://github.com/neovim/nvim-lspconfig' " Quickstart configs for Nvim LSP +Plug 'https://github.com/hrsh7th/cmp-nvim-lsp' " nvim-cmp source for neovim builtin LSP client +Plug 'https://github.com/hrsh7th/cmp-buffer' " nvim-cmp source for buffer words. +Plug 'https://github.com/hrsh7th/cmp-path' " nvim-cmp source for path. +Plug 'https://github.com/hrsh7th/cmp-cmdline' " nvim-cmp source for vim's cmdline. +Plug 'https://github.com/hrsh7th/cmp-nvim-lua' " nvim-cmp source for nvim lua. +Plug 'https://github.com/hrsh7th/nvim-cmp' " A completion plugin for neovim coded in Lua. +Plug 'https://github.com/L3MON4D3/LuaSnip', {'do': 'make install_jsregexp'} " Snippet Engine for Neovim written in Lua. +Plug 'https://github.com/saadparwaiz1/cmp_luasnip' " luasnip completion source for nvim-cmp. +Plug 'https://github.com/rafamadriz/friendly-snippets' " Set of preconfigured snippets for different languages. + +" Plugins not for vscode. +if !exists('g:vscode') + Plug 'https://github.com/nvim-tree/nvim-tree.lua' " A file explorer tree for neovim written in lua + Plug 'https://github.com/nvim-tree/nvim-web-devicons' " Adds file type icons to Vim plugins + Plug 'https://github.com/prichrd/netrw.nvim' " It's not because we use netrw that we cannot have nice things! +endif + +" Only if started by a browser. +if exists('g:started_by_firenvim') + Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } " Embed Neovim in your browser. +endif + +" Depending on whether vim or nvim is running. +if has('nvim') + "Plug 'https://github.com/Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } " Dark powered asynchronous unite all interfaces for Neovim/Vim8. +else + Plug 'https://github.com/Shougo/denite.nvim' " Dark powered asynchronous unite all interfaces for Neovim/Vim8. + Plug 'https://github.com/roxma/nvim-yarp' " Yet Another Remote Plugin Framework for Neovim. + Plug 'https://github.com/roxma/vim-hug-neovim-rpc' +endif + +" Initialize plugin system. +call plug#end() diff --git a/.config/nvim/regular.vim b/.config/nvim/regular.vim new file mode 100644 index 0000000..9f907df --- /dev/null +++ b/.config/nvim/regular.vim @@ -0,0 +1,49 @@ +" Highlight search results, turned off for a search by :noh. +set hlsearch + +" Leave 5 lines above/below when scrolling. +set scrolloff=5 + +" Turn on line numbering. +set number +set relativenumber + +" Use the wal colorscheme from the plugin if available. +colorscheme wal + +" Add a red column after textwidth limit. +set colorcolumn=+1 + +" Set the indentation +set tabstop=4 +set shiftwidth=0 + +" Format files linux style. +if &modifiable==1 + set fileformat=unix +endif + +" Save swap files in the same directory as the edited file. +"let &directory=".," .. &directory + +" Enable plugins to be loaded based on file type. +filetype plugin on + +" Do not change the shape of the letter based on its position in the word. +" When viewing right-to-left shape change can be very confusing. +set noarabicshape + +" Set keymap to Arabic in case typing in Arabic was desired. +" But set iminsert=0 to have English mapping at first. Switch using i_CTRL-^. +set keymap=arabic +set iminsert=0 + +" Folding based on treesitter +set foldmethod=expr +set foldexpr=nvim_treesitter#foldexpr() + +" Disable mouse. +set mouse= + +" Specify the python3 host program. +let g:python3_host_prog = '/usr/bin/python3' |