From 5571a91d2874a48bb05432766717d8923628c7d6 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Thu, 15 Feb 2024 16:43:37 +0530 Subject: [PATCH] initial v2 configs --- .gitignore | 47 +++++ .stylua.toml | 6 + LICENSE | 201 ++++++++++++++++++++++ filetype.lua | 6 + init.lua | 38 +++++ lua/basic.lua | 85 +++++++++ lua/core.lua | 152 +++++++++++++++++ lua/custom_keys.lua | 70 ++++++++ lua/custom_opts.lua | 44 +++++ lua/languages/go.lua | 23 +++ lua/languages/luau.lua | 37 ++++ lua/languages/markdown.lua | 8 + lua/languages/rust.lua | 184 ++++++++++++++++++++ lua/my_plugins/example.lua | 30 ++++ lua/plugins/autocmp/config.lua | 78 +++++++++ lua/plugins/bufferline/config.lua | 34 ++++ lua/plugins/coding.lua | 85 +++++++++ lua/plugins/colorschemes.lua | 29 ++++ lua/plugins/find.lua | 18 ++ lua/plugins/git.lua | 16 ++ lua/plugins/highlight.lua | 46 +++++ lua/plugins/lsp.lua | 103 +++++++++++ lua/plugins/lspconfig/config.lua | 42 +++++ lua/plugins/lualine/config.lua | 135 +++++++++++++++ lua/plugins/neo-tree/config.lua | 208 +++++++++++++++++++++++ lua/plugins/noice/config.lua | 97 +++++++++++ lua/plugins/nvim-web-devicons/config.lua | 44 +++++ lua/plugins/smart-split/config.lua | 19 +++ lua/plugins/start_screen.lua | 57 +++++++ lua/plugins/terminal.lua | 53 ++++++ lua/plugins/utils.lua | 104 ++++++++++++ lua/plugins/view.lua | 101 +++++++++++ 32 files changed, 2200 insertions(+) create mode 100644 .gitignore create mode 100644 .stylua.toml create mode 100644 LICENSE create mode 100644 filetype.lua create mode 100644 init.lua create mode 100644 lua/basic.lua create mode 100644 lua/core.lua create mode 100644 lua/custom_keys.lua create mode 100644 lua/custom_opts.lua create mode 100644 lua/languages/go.lua create mode 100644 lua/languages/luau.lua create mode 100644 lua/languages/markdown.lua create mode 100644 lua/languages/rust.lua create mode 100644 lua/my_plugins/example.lua create mode 100644 lua/plugins/autocmp/config.lua create mode 100644 lua/plugins/bufferline/config.lua create mode 100644 lua/plugins/coding.lua create mode 100644 lua/plugins/colorschemes.lua create mode 100644 lua/plugins/find.lua create mode 100644 lua/plugins/git.lua create mode 100644 lua/plugins/highlight.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/lspconfig/config.lua create mode 100644 lua/plugins/lualine/config.lua create mode 100644 lua/plugins/neo-tree/config.lua create mode 100644 lua/plugins/noice/config.lua create mode 100644 lua/plugins/nvim-web-devicons/config.lua create mode 100644 lua/plugins/smart-split/config.lua create mode 100644 lua/plugins/start_screen.lua create mode 100644 lua/plugins/terminal.lua create mode 100644 lua/plugins/utils.lua create mode 100644 lua/plugins/view.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6c3335 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +lazy-lock.json +lua/custom.lua +lua/my_plugins/* +!lua/my_plugins/example.lua +package-lock.json + diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/filetype.lua b/filetype.lua new file mode 100644 index 0000000..ad594e1 --- /dev/null +++ b/filetype.lua @@ -0,0 +1,6 @@ +vim.filetype.add({ + extension = { + mdx = "mdx", + luau = "luau" + }, +}) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2c31fab --- /dev/null +++ b/init.lua @@ -0,0 +1,38 @@ +-- Basic settings +require("basic") + +-- Load plugins +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not 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) + +vim.g.mapleader = require("custom_keys").leader +vim.g.maplocalleader = "\\" + +require("lazy").setup({ + spec = { + { import = "plugins" }, + { import = "languages" }, + { import = "my_plugins" }, + }, + ui = { + border = "rounded", + }, + change_detection = { + enabled = true, + notify = false, -- get a notification when changes are found + }, +}) + +-- Final settings +require("core") +pcall(require, "custom") diff --git a/lua/basic.lua b/lua/basic.lua new file mode 100644 index 0000000..7704f52 --- /dev/null +++ b/lua/basic.lua @@ -0,0 +1,85 @@ +HOME = os.getenv("HOME") + +vim.opt.termguicolors = true +vim.opt.cursorline = true +vim.opt.updatetime = 200 + +-- Basic settings +vim.opt.encoding = "utf-8" +vim.opt.backspace = "indent,eol,start" -- backspace works on every char in insert mode +vim.opt.completeopt = "menuone,noselect" +vim.opt.history = 1000 +vim.opt.startofline = true + +-- Mapping waiting time +vim.opt.timeout = false +vim.opt.ttimeout = true +vim.opt.ttimeoutlen = 100 + +-- Display +vim.opt.scrolloff = 3 +vim.opt.showmatch = true +vim.opt.synmaxcol = 300 +vim.opt.laststatus = 3 + +-- vim.opt.list = false -- do not display white characters +-- vim.opt.foldenable = false +-- vim.opt.foldlevel = 4 -- limit folding to 4 levels +-- vim.opt.foldmethod = "syntax" -- use language syntax to generate folds +vim.opt.wrap = false --do not wrap lines even if very long +vim.opt.eol = false -- show if there's no eol char +vim.opt.showbreak = "↪" -- character to show when line is broken + +-- Sidebar +vim.opt.number = true -- line number on the left +vim.opt.numberwidth = 3 -- always reserve 3 spaces for line number +vim.opt.signcolumn = "yes" -- keep 1 column for coc.vim check +vim.opt.modelines = 0 +vim.opt.showcmd = true -- display command in bottom bar + +-- Search +vim.opt.incsearch = true -- starts searching as soon as typing, without enter needed +vim.opt.ignorecase = true -- ignore letter case when searching +vim.opt.smartcase = true -- case insentive unless capitals used in search + +vim.opt.matchtime = 2 -- delay before showing matching paren +vim.opt.mps = vim.o.mps .. ",<:>" + +-- White characters +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 -- indentation rule +vim.opt.formatoptions = "qnj1" -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word +vim.opt.expandtab = true -- expand tab to spaces + +-- Backup files +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.swapfile = false -- do not use swap file + +-- Commands mode +vim.opt.wildmenu = true -- on TAB, complete options for system command +vim.opt.wildignore = + "deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc" + +-- Only show cursorline in the current window and in normal mode. +-- vim.cmd([[ +-- augroup cline +-- au! +-- au WinLeave * set nocursorline +-- au WinEnter * set cursorline +-- au InsertEnter * set nocursorline +-- au InsertLeave * set cursorline +-- augroup END +-- ]]) + +vim.cmd([[ + set noeb + set t_Co=256 + filetype plugin indent on + exec "nohlsearch" + syntax enable + syntax on +]]) diff --git a/lua/core.lua b/lua/core.lua new file mode 100644 index 0000000..9ecebcc --- /dev/null +++ b/lua/core.lua @@ -0,0 +1,152 @@ +local keys = require("custom_keys") +local opts = require("custom_opts") + +-- Setup keymapping +local function set_keymap() + local map = vim.keymap.set + local option = { noremap = true, silent = true } + + map("n", keys.jump_left_window, "h", option) + map("n", keys.jump_down_window, "j", option) + map("n", keys.jump_up_window, "k", option) + map("n", keys.jump_right_window, "l", option) + + vim.cmd([[ + " press esc to cancel search highlight + nnoremap :nohlsearch:echo + ]]) + + -- for markdown file + vim.cmd([[ + " optimized up and down move when set wrap for markdown file + autocmd FileType markdown noremap j gj + autocmd FileType markdown noremap k gk + autocmd FileType markdown setlocal wrap + ]]) + + -- Supported by bufdelete + vim.cmd([[ + cnoreabbrev bdelete Bdelete + cnoreabbrev bdelete! Bdelete! + cnoreabbrev bwipeout Bwipeout + cnoreabbrev bwipeout! Bwipeout! + ]]) + + -- Supported by bufferline + map("n", keys.pick_tab, ":BufferLinePick", option) + + -- Supported by nvim-tree + map("n", keys.file_explorer, ":Neotree position=left source=filesystem action=show toggle=true", option) + map("n", keys.git_status, ":Neotree position=float source=git_status action=show toggle=true", option) + + -- Supported by aerial + map("n", keys.outline, ":AerialToggle! right", option) + + -- Supported by diffview + map("n", keys.diff_open, ":DiffviewOpen", option) + map("n", keys.diff_close, ":DiffviewClose", option) + + -- Supported by toggleterm + -- float terminal + local float_terminal_default = require("toggleterm.terminal").Terminal:new({ + direction = "float", + on_open = function(term) + -- forced to change the working dir for terminal + -- This will solve the problem of not updating the directory when switching sessions. + local cwd = vim.fn.getcwd() + if cwd ~= term.dir then + term:change_dir(cwd) + end + -- when float term opened, disable bottom terminal + vim.api.nvim_del_keymap("t", keys.terminal_bottom) + vim.cmd("startinsert!") + end, + on_close = function(t, job, exit_code, name) + -- when float term closed, enable bottom terminal + map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + end, + }) + function _float_term_toggle() + float_terminal_default:toggle() + end + + -- bottom terminal + local bottom_terminal_default = require("toggleterm.terminal").Terminal:new({ + direction = "horizontal", + on_open = function(term) + -- forced to change the working dir for terminal + -- This will solve the problem of not updating the directory when switching sessions. + local cwd = vim.fn.getcwd() + if cwd ~= term.dir then + term:change_dir(cwd) + end + + -- set keymapping + local opts = { buffer = 0 } + vim.api.nvim_buf_set_keymap( + term.bufnr, + "t", + "", + [[wincmd h]], + { noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + term.bufnr, + "t", + "", + [[wincmd j]], + { noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + term.bufnr, + "t", + "", + [[wincmd k]], + { noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + term.bufnr, + "t", + "", + [[wincmd l]], + { noremap = true, silent = true } + ) + vim.cmd("startinsert!") + end, + on_exit = function(t, job, exit_code, name) + vim.cmd("quit!") + end, + }) + function _bottom_term_toggle() + bottom_terminal_default:toggle() + end + + map("n", keys.terminal_float, ":lua _float_term_toggle()", option) + map("t", keys.terminal_float, ":lua _float_term_toggle()", option) + map("n", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + + vim.cmd([[ + command! Termfloat :lua _float_term_toggle() + ]]) + vim.cmd([[cnoreabbrev terminal Termfloat]]) + + -- Supported by nvim-session-manager + map("n", keys.switch_session, ":SessionManager load_session", option) +end + +-- Set up transparency +local function set_transparency() + local transparency = opts.window_transparency + -- Setup global transparency for float window. + vim.api.nvim_command(string.format("autocmd FileType * set winblend=%d", transparency)) + -- Setup global transparency for popup menu. + vim.o.pumblend = transparency +end + +-- Set up auto command +local function set_autocmd() end + +set_keymap() +set_transparency() +set_autocmd() diff --git a/lua/custom_keys.lua b/lua/custom_keys.lua new file mode 100644 index 0000000..69eefc5 --- /dev/null +++ b/lua/custom_keys.lua @@ -0,0 +1,70 @@ +-- +-- You can edit the default settings of the shortcut keys here +-- +return { + -- The default '' is the space. + leader = " ", + + -- Use the shortcut to switch/jump window. + jump_left_window = "", + jump_right_window = "", + jump_up_window = "", + jump_down_window = "", + + -- View other usage of the plugin: https://github.com/akinsho/bufferline.nvim + -- Use the shortcut to pick a buffer tab. + pick_tab = "tt", + + -- View other usage of the plugin: https://github.com/nvim-neo-tree/neo-tree.nvim + -- Use the shortcut to open or close file explorer. + file_explorer = "", + -- Use the shortcut to open or close git status on a float window. + git_status = "", + + -- View other usage of the plugin: https://github.com/stevearc/aerial.nvim + -- Use the shortcut to open or close the outline, it need to call the lsp server. + outline = "", + + -- View other usage of the plugin: https://github.com/akinsho/toggleterm.nvim + -- Use the shortcut to open or close the terminal. + terminal_float = "", -- open terminal in a float window + terminal_bottom = "", -- open terminal at the bottom + + -- View other usage of the plugin: https://github.com/Shatur/neovim-session-manager + -- Use the shortcut to switch a session. + switch_session = "ss", + + -- View other usage of the plugin: https://github.com/nvim-telescope/telescope.nvim + -- Use the shortcut to find, search files and find buffers. + find_files = "ff", + live_grep = "gg", + search_cursor = "cc", + find_buffer = "bb", + -- Use the to close telescope window. is the default setting, can't edit it here. + -- close_telescope = "", + + -- View other usage of the plugin: https://github.com/sindrets/diffview.nvim + -- Use the shortcut to open 'git diff'. + diff_open = "df", + -- Use the shortcut to close 'git diff'. + diff_close = "dc", + + -- View other usage of the plugin: https://github.com/mrjones2014/smart-splits.nvim + -- Use the shortcut to resize the window, + resize_left = "", + resize_down = "", + resize_up = "", + resize_right = "", + + -- View other usage of the plugin: https://github.com/neovim/nvim-lspconfig + -- Goto + goto_definition = "gd", + goto_references = "gr", + goto_declaration = "gD", + goto_impl = "gi", + -- goto_back = "", + -- Use the shortcut to rename the code symbols. + lsp_rename = "re", + -- Use the shortcut to format your codes. + format = "ft", +} diff --git a/lua/custom_opts.lua b/lua/custom_opts.lua new file mode 100644 index 0000000..7de1c3f --- /dev/null +++ b/lua/custom_opts.lua @@ -0,0 +1,44 @@ +local function strsplit(inputstr, sep) + if sep == nil then + sep = "%s" + end + local t={} + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + table.insert(t, str) + end + return t +end + +return { + file_explorer_title = "🥷 File Explorer", + tab_style = "thin", -- options: thin, thick, slope, slant + terminal_size = 0.7, -- control the float terminal only + window_transparency = 0, + auto_open_outline = false, -- options: true, false + cmdline_view = "cmdline", -- options: cmdline, cmdline_popup + close_message_notify = false, + + -- Starting screen header. + home_header = + strsplit([[ + ⢀⠀⢀⣀⣠⣤⣤⣤⣤⣤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣠⣠⣤⣤⣤⣤⣀⠲⢦⣄⡀⠀⠀ + ⡶⢟⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠰⣷⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣬⡛⢷⣔ + ⣾⡿⠟⠋⠉⠁⠀⡀⠀⠀⠀⠀⠈⠉⠉⠙⠛⢻⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠈⠙⢛⣛⣛⣛⣛⣉⢉⣉⡀⠀⠀⠀⠀⠀⠈⠉⠛⢿⣷⣝ + ⠃⠀⠀⠀⠀⠀⠀⣛⣛⣛⣛⣛⣛⢛⡛⠛⠛⠛⣰⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣌⠛⠛⢛⣛⣛⣛⣛⣛⣛⣛⣓⣀⠀⠀⠀⠀⠀⠈⢻ + ⠀⠀⠀⢀⣤⡾⠛⢻⣿⣿⣿⡿⣿⡟⢻⣿⠳⠆⠘⣿⣦⠀⠀⠀⠀⠀⠀⠀⣰⣿⠁⠐⠛⣿⡟⢻⣿⣿⣿⣿⢿⣟⠛⠻⣦⣀⠀⠀⠀⠀ + ⠀⠀⢴⠿⣧⣄⣀⣘⣿⣿⣿⣿⣿⡿⣀⡙⢷⠀⢀⡿⠁⠀⠀⠀⠀⠀⠀⠀⠈⢻⡖⠀⣾⣋⣀⣺⣿⣿⣿⣿⣿⣏⣀⣤⣴⠿⢷⠀⠀⠀ + ⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠙⠉⠉⠉⠉⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠋⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠆⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠉⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠆⠀⠀⢀⣿⠁⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣶⠟⠁⠀⠀⠀⣾⠇⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣤⣤⣴⣶⣾⠿⠛⠋⠀⠀⠀⠀⠀⢸⡟⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠛⠛⠛⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⠀⠀⠀⠀⠀⠀ + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⠀⠀⠀⠀⠀⠀⠀ + ]], "\n") +} diff --git a/lua/languages/go.lua b/lua/languages/go.lua new file mode 100644 index 0000000..92dd425 --- /dev/null +++ b/lua/languages/go.lua @@ -0,0 +1,23 @@ +return { + { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("go").setup({ + run_in_floaterm = true, + floaterm = { + posititon = "center", -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`} + width = 0.45, -- width of float window if not auto + height = 0.98, -- height of float window if not auto + }, + }) + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries + }, +} diff --git a/lua/languages/luau.lua b/lua/languages/luau.lua new file mode 100644 index 0000000..06971c4 --- /dev/null +++ b/lua/languages/luau.lua @@ -0,0 +1,37 @@ +return { + "lopi-py/luau-lsp.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + + config = function() + require("luau-lsp").setup({ + fflags = { + sync = true, -- sync currently enabled fflags with roblox's published fflags + override = { + DebugLuauDeferredConstraintResolution = true, + }, + }, + + server = { + settings = { + -- https://github.com/folke/neoconf.nvim/blob/main/schemas/luau_lsp.json + ["luau-lsp"] = { + require = { + mode = "relativeToFile", + directoryAliases = { ["@lune"] = "~/.lune/.typedefs/0.8.0/" }, + }, + completion = { + imports = { + enabled = true, -- enable auto imports + }, + }, + }, + }, + }, + types = { + roblox = false, + }, + }) + end, +} diff --git a/lua/languages/markdown.lua b/lua/languages/markdown.lua new file mode 100644 index 0000000..d542024 --- /dev/null +++ b/lua/languages/markdown.lua @@ -0,0 +1,8 @@ +return { + { + "iamcco/markdown-preview.nvim", + build = function() + vim.fn["mkdp#util#install"]() + end, + }, +} diff --git a/lua/languages/rust.lua b/lua/languages/rust.lua new file mode 100644 index 0000000..6069fba --- /dev/null +++ b/lua/languages/rust.lua @@ -0,0 +1,184 @@ +return { + { 'rust-lang/rust.vim' }, + { + "simrat39/rust-tools.nvim", + lazy = true, + config = function() + local rt = require("rust-tools") + rt.setup({ + tools = { -- rust-tools options + + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools.executors").quickfix, + + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = nil, + + -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. + reload_workspace_from_cargo_toml = true, + + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = true, + + -- Only show inlay hints for the current line + only_current_line = false, + + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", + + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", + + -- whether to align to the length of the longest line in the file + max_len_align = false, + + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + + -- whether to align to the extreme right or not + right_align = false, + + -- padding from the right if right_align is true + right_align_padding = 7, + + -- The color of the hints + highlight = "Comment", + }, + + -- options same as lsp hover / vim.lsp.util.open_floating_preview() + hover_actions = { + + -- the border that is used for the hover window + -- see vim.api.nvim_open_win() + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, + + -- Maximal width of the hover window. Nil means no max. + max_width = nil, + + -- Maximal height of the hover window. Nil means no max. + max_height = nil, + + -- whether the hover action window gets automatically focused + -- default: false + auto_focus = false, + }, + + -- settings for showing the crate graph based on graphviz and the dot + -- command + crate_graph = { + -- Backend used for displaying the graph + -- see: https://graphviz.org/docs/outputs/ + -- default: x11 + backend = "x11", + -- where to store the output, nil for no output stored (relative + -- path from pwd) + -- default: nil + output = nil, + -- true for all crates.io and external crates, false only the local + -- crates + -- default: true + full = true, + + -- List of backends found on: https://graphviz.org/docs/outputs/ + -- Is used for input validation and autocompletion + -- Last updated: 2021-08-26 + enabled_graphviz_backends = { + "bmp", + "cgimage", + "canon", + "dot", + "gv", + "xdot", + "xdot1.2", + "xdot1.4", + "eps", + "exr", + "fig", + "gd", + "gd2", + "gif", + "gtk", + "ico", + "cmap", + "ismap", + "imap", + "cmapx", + "imap_np", + "cmapx_np", + "jpg", + "jpeg", + "jpe", + "jp2", + "json", + "json0", + "dot_json", + "xdot_json", + "pdf", + "pic", + "pct", + "pict", + "plain", + "plain-ext", + "png", + "pov", + "ps", + "ps2", + "psd", + "sgi", + "svg", + "svgz", + "tga", + "tiff", + "tif", + "tk", + "vml", + "vmlz", + "wbmp", + "webp", + "xlib", + "x11", + }, + }, + }, + + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer + server = { + -- standalone file support + -- setting it to false may improve startup time + standalone = true, + }, -- rust-analyzer options + + -- debugging stuff + dap = { + adapter = { + type = "executable", + command = "lldb-vscode", + name = "rt_lldb", + }, + }, + }) + end, + }, +} diff --git a/lua/my_plugins/example.lua b/lua/my_plugins/example.lua new file mode 100644 index 0000000..0dda829 --- /dev/null +++ b/lua/my_plugins/example.lua @@ -0,0 +1,30 @@ +return { + { + "andweeb/presence.nvim", + config = function() + -- The setup config table shows all available config options with their default values: + require("presence").setup({ + -- General options + auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) + neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image + main_image = "neovim", -- Main image display (either "neovim" or "file") + log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") + debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(, true)`) + enable_line_number = false, -- Displays the current line number instead of the current project + blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches + buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "