.
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | StarVim
2 |
3 |
4 |
5 | [Install](#installation) • [Why StarVim?](#why-starvim-) • [Screenshots](https://github.com/ashincoder/StarVim/tree/screenshots) • [Contribute](#contributions)
6 |
7 |
8 |
9 | A IDE wrapper which is beyond the moon 🌚 and above the stars ⭐ :O!
10 |
11 |
32 |
33 | ## Logo
34 |
35 | - Thank you all for trying to work on the creation of the logo.
36 | - The logo was made by [im-yuria](https://github.com/im-yuria)
37 | - Thank you [Thomashighbaugh](https://github.com/Thomashighbaugh) for creating a such a beautiful creation [Logo here](https://github.com/ashincoder/StarVim/issues/25)
38 |
39 | # Installation
40 |
41 | Dependencies :
42 | - neovim (+0.5)
43 | - pip3
44 | - nodejs (for lsp)
45 | - npm (for lsp)
46 | - yarn (for lsp)
47 |
48 | `bash <(curl -s https://raw.githubusercontent.com/ashincoder/StarVim/main/bin/installer)`
49 |
50 | ## Update Config
51 |
52 | To keep the config up to date :
53 |
54 | ```
55 | git pull
56 | nvim +PackerCompile
57 | ```
58 |
59 | > ! This will not affect your 'sv-config.lua'. So don't worry.
60 |
61 | # Why StarVim ?
62 |
63 | The answer everyone is waiting for.
64 |
65 | Here you go :
66 |
67 | ## Lazy loading
68 | StarVim is lazy loaded so hard that your machine does'nt feel the force of the arrival of StarVim.
69 | - Almost 25+ plugins are installed. All of them are lazyloaded.
70 |
71 | ## Colors
72 | StarVim will have more colorschemes with colorfulness.
73 | - When colorschemes are loaded normally it takes a lot of time. But StarVim has also lazied the colorschemes
74 |
75 | ## Extensibility
76 | StarVim can be configured within 1 file. Which makes everything simple for the user.
77 |
78 | - While doing a git pull it does'nt affect the user config file. 'sv-config.lua'
79 |
80 | + If you still aren't convinced read the [Features](https://github.com/ashincoder/StarVim#features)
81 |
82 | # Features
83 |
84 | - Autosave functionality.
85 | - Gitsigns for colors git signs
86 | - Minimal status line (lualine)
87 | - File navigation with Nvimtree
88 | - Nvim-compe for autocompletion
89 | - Packer.nvim as package manager
90 | - Smooth scrolling with Neoscroll
91 | - Indent-blankline.Nvim for indentlines
92 | - Managing tabs, buffers with Bufferline
93 | - Nvim-treesitter for syntax highlighting
94 | - Nvim-lspconfig for nvim-lps configuration
95 | - LspInstall for installing lsp servers easily.
96 | - Telescope for file finding, picking, previewing
97 | - Nvim-autopairs, for autolosing braces and stuffs
98 | - Formatter.nvim for prettifying / formatting code
99 | - Lspkind to show pictograms on autocompletion items
100 | - Using Nvim-lsp for language perfection and intellisense
101 | - Using plugins that are mouse friendly (Keyboard is better!)
102 | - Icons on nvimtree, telescope, bufferline/statusline and almost everywhere! with nvim-web-devicons
103 | - Snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
104 |
105 | - And the Killer Feature ! []()
106 | - Lua makes it faster and smoother. More extensible
107 |
108 | ## Screenshots
109 |
110 | 
111 | Other screenshots are displayed [here](https://github.com/ashincoder/StarVim/tree/screenshots)
112 |
113 | ## Contributions
114 | - PR's are always welcome , no matter what **So start today** . [](http://makeapullrequest.com)
115 | - While making a PR, try to be more descriptive. :)
116 |
117 | ## Error Handling
118 | Check star.log located in `~/.local/share/nvim/star.log` for any errors
119 | More will be added in the wiki
120 |
121 | ## Questions
122 | If you have any doubts you can freely ask on these following sites:
123 | - [Gitter](https://gitter.im/starvim-conf/community)
124 | - [Reddit](https://www.reddit.com/r/StarVim/)
125 | - [Discord](https://discord.gg/7jVFbwnY)
126 | - [Youtube](https://www.youtube.com/channel/UCZqKL3vIdyHUiLuR1vYwVgw)
127 |
128 | ## Contributions
129 | - PR's are always welcome , no matter what **So start today** . [](http://makeapullrequest.com)
130 | - While making a PR, try to be more descriptive. :)
131 |
132 | ## Credits
133 |
134 | The following repositories helped me in improving StarVim
135 | - ChristianChiarulli's [LunarVim](https://github.com/ChristianChiarulli/LunarVim)
136 | - Siduck's [NvChad](https://github.com/siduck76/NvChad)
137 |
138 | ## TODO
139 |
140 | - [ ] Logo
141 | - [X] Readme
142 | - [X] Clean code [](https://www.codefactor.io/repository/github/ashincoder/starvim)
143 | - [X] More Custom Colorschemes
144 | - [X] Easily Installable plugins
145 | - [ ] Documentation, Wiki and stuff
146 |
--------------------------------------------------------------------------------
/bin/install-latest-neovim:
--------------------------------------------------------------------------------
1 | !#/bin/bash
2 | git clone --branch master --depth 1 https://github.com/neovim/neovim
3 | cd neovim
4 | sudo make CMAKE_BUILD_TYPE=Release install
5 | cd ~
6 | sudo rm -r neovim
7 |
--------------------------------------------------------------------------------
/bin/installer:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -o nounset # error when referencing undefined variable
4 | set -o errexit # exit when command fails
5 |
6 | moveoldnvim() {
7 | echo "Moving your ~/.config/nvim folder to ~/.config/nvim.bak"
8 | mv "$HOME/.config/nvim" "$HOME/.config/nvim.bak"
9 | }
10 |
11 | installpacker() {
12 | git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
13 | }
14 |
15 | cloneconfig() {
16 | echo "Cloning StarVim configuration"
17 | git clone --branch main https://github.com/ashincoder/StarVim.git ~/.config/nvim
18 | cp "$HOME"/.config/nvim/bin/sv-config.example.lua "$HOME"/.config/nvim/sv-config.lua
19 | cp "$HOME"/.config/nvim/bin/starplug.example.lua "$HOME"/.config/nvim/starplug.lua
20 | cd "$HOME"/.config/nvim/
21 |
22 | nvim +PackerInstall
23 | nvim +PackerCompile
24 |
25 | echo -e "\nCompile Complete"
26 | }
27 |
28 | # Welcome
29 | echo 'Installing StarVim'
30 |
31 | # move old nvim directory if it exists
32 | [ -d "$HOME/.config/nvim" ] && moveoldnvim
33 |
34 | if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
35 | echo 'packer already installed'
36 | else
37 | rm -rf ~/.local/share/nvim/site/pack/packer
38 | installpacker
39 | fi
40 |
41 | if [ -e "$HOME/.config/nvim/init.lua" ]; then
42 | echo 'StarVim already installed'
43 | else
44 | # clone config down
45 | cloneconfig
46 | fi
47 |
48 | echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
49 |
--------------------------------------------------------------------------------
/bin/starplug.example.lua:
--------------------------------------------------------------------------------
1 | local star = {
2 | ui = {
3 | "dashboard", -- Start screen
4 | "statusline", -- Statusline
5 | "tabline", -- Tabline, shows your buffers list at top
6 | "which-key", -- Keybindings popup menu like Emacs' guide-key
7 | -- 'zen', -- Distraction free environment
8 | -- 'indentlines', -- Show indent lines
9 | },
10 | star = {
11 | -- 'orgmode', -- Life Organization Tool
12 | -- 'runner', -- Code runner for your language
13 | },
14 | colors = {
15 | "stardark", -- The shiny theme
16 | -- "gruvbox", -- The almighty
17 | -- "icy", -- Shiver to death!
18 | -- "neon", -- Welcome to the light
19 | },
20 | editor = {
21 | "lsp", -- Language Server Protocols
22 | "lint", -- A beauty teacher for your language
23 | "completion", -- The ultimate completion
24 | "nvim-tree", -- Tree explorer
25 | "symbols", -- LSP symbols and tags
26 | "gitsigns", -- Git signs
27 | "telescope", -- Highly extendable fuzzy finder over lists
28 | "formatter", -- File formatting
29 | "autopairs", -- Autopairs
30 | "commentary", -- Commentary plugin
31 | -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler)
32 | -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap
33 | },
34 | utilities = {
35 | "colorizer", -- Fastets colorizer for Neovim
36 | -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit
37 | -- 'suda', -- Write and read files without sudo permissions
38 | -- 'range-highlight', -- hightlights ranges you have entered in commandline
39 | },
40 | }
41 |
42 | return star
43 |
--------------------------------------------------------------------------------
/bin/starvim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashincoder/StarVim/24d1f2077885415b2c4dd816d997834af1b3b884/bin/starvim.png
--------------------------------------------------------------------------------
/bin/sv-config.example.lua:
--------------------------------------------------------------------------------
1 | -- This is a example config.
2 | -- 'Sv' is the global options object
3 | -- General Settings
4 | Sv.pumheight = 20
5 | Sv.timeoutlen = 100
6 |
7 | Sv.shell = "zsh"
8 |
9 | Sv.undofile = true
10 |
11 | Sv.leader_key = "space"
12 | Sv.colorscheme = "stardark"
13 |
14 | Sv.format_on_save = true
15 |
16 | -- TreeSitter parsers config
17 | Sv.treesitter.ensure_installed = {
18 | "lua",
19 | -- "bash",
20 | -- "json",
21 | -- "python",
22 | -- "c",
23 | -- "c_sharp",
24 | -- "clojure",
25 | -- "comment",
26 | -- "cpp",
27 | -- "commonlisp",
28 | -- "cuda",
29 | -- "dart",
30 | -- "devicetree",
31 | -- "dockerfile",
32 | -- "elixir",
33 | -- "erlang",
34 | -- "go",
35 | -- "fish",
36 | -- "haskell",
37 | -- "java",
38 | -- "jsdoc",
39 | -- "graphql",
40 | -- "julia",
41 | -- "kotlin",
42 | -- "ledger",
43 | -- "latex",
44 | -- "php",
45 | -- "nix",
46 | -- "ocamel",
47 | -- "ql",
48 | -- "regex",
49 | -- "ruby",
50 | -- "rust",
51 | -- "rst",
52 | -- "scss",
53 | -- "sparql",
54 | -- "teal",
55 | -- "toml",
56 | -- "typescript",
57 | -- "vue",
58 | -- "yaml",
59 | -- "zig"
60 | }
61 | Sv.treesitter.ignore_install = { "haskell" }
62 | Sv.treesitter.highlight.enabled = true
63 |
64 | -- lua
65 | -- Sv.lang.lua.formatter.exe = "stylua"
66 |
67 | -- python
68 | -- Sv.lang.python.isort = true
69 | -- Sv.lang.python.diagnostics.virtual_text = true
70 | -- Sv.lang.python.analysis.use_library_code_types = true
71 | -- to change default formatter from yapf to black
72 | -- Sv.lang.python.formatter.exe = "black"
73 | -- Sv.lang.python.formatter.args = {"-"}
74 |
75 | -- go
76 | -- to change default formatter from gofmt to goimports
77 | -- Sv.lang.go.formatter.exe = "goimports"
78 |
79 | -- javascript formatter is prettier
80 |
81 | -- rust
82 | -- Sv.lang.rust.formatter = {
83 | -- exe = "rustfmt",
84 | -- args = { "--emit=stdout" },
85 | -- }
86 |
87 | -- Additional Plugins
88 | -- Sv.user_plugins = {
89 | -- {"kyazdani42/blue-moon"},
90 | -- }
91 |
92 | -- Additional Leader bindings for WhichKey
93 | -- Sv.user_which_key = {
94 |
95 | -- A = {
96 | -- name = "+Custom Leader Keys",
97 | -- a = { "'Command for a key'", "Description for a" },
98 | -- b = { "'Command for b key'", "Description for b" },
99 | -- },
100 |
101 | -- }
102 |
103 | -- Additional Autocommands
104 | -- Sv.user_autocommands = { }
105 |
--------------------------------------------------------------------------------
/init.lua:
--------------------------------------------------------------------------------
1 | -- Store startup time in seconds
2 | vim.g.start_time = vim.fn.reltime()
3 |
4 | -- Temporarily disable shada file to improve performance
5 | vim.opt.shadafile = "NONE"
6 |
7 | -- Disable some unused built-in Neovim plugins
8 | local disabled_built_ins = {
9 | "netrw",
10 | "gzip",
11 | "zip",
12 | "netrwPlugin",
13 | "netrwSettings",
14 | "tar",
15 | "tarPlugin",
16 | "netrwFileHandlers",
17 | "zipPlugin",
18 | "getscript",
19 | "getscriptPlugin",
20 | "vimball",
21 | "vimballPlugin",
22 | "2html_plugin",
23 | "logipat",
24 | "spellfile_plugin",
25 | "matchit",
26 | }
27 |
28 | for _, plugin in pairs(disabled_built_ins) do
29 | vim.g["loaded_" .. plugin] = 1
30 | end
31 |
32 | -- Disable these for very fast startup time
33 | vim.cmd [[
34 | filetype off
35 | filetype plugin indent off
36 | ]]
37 |
38 | require "core"
39 |
40 | local async
41 | async = vim.loop.new_async(vim.schedule_wrap(function()
42 | local status_ok, _ = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/sv-config.lua")
43 | if not status_ok then
44 | print "Error in sv-config"
45 | end
46 | local compiled_plugins_path = vim.fn.expand "$HOME/.config/nvim/plugin/packer_compiled.lua"
47 | if vim.fn.filereadable(compiled_plugins_path) > 0 then
48 | -- If the current buffer name is empty then trigger Dashboard
49 | if vim.api.nvim_buf_get_name(0):len() == 0 then
50 | vim.cmd "Dashboard"
51 | end
52 | end
53 | vim.opt.shadafile = ""
54 | vim.defer_fn(function()
55 | vim.cmd [[
56 | rshada!
57 | doautocmd BufRead
58 | filetype on
59 | filetype plugin indent on
60 | silent! bufdo e
61 | ]]
62 | end, 15)
63 | async:close()
64 | end))
65 | async:send()
66 |
--------------------------------------------------------------------------------
/lua/core/README.md:
--------------------------------------------------------------------------------
1 | # The Core of StarVim
2 |
3 | Here lies the hot core of StarVim.
4 |
5 | - Keybindings - The keys to control the Star ship
6 | - Configs - The control center of Star Ship
7 | - Functions - Where all the functions of Ship are defined
8 | - Autocmds - Commands to trigger during specific situations
9 |
--------------------------------------------------------------------------------
/lua/core/autocmds/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | function M.define_augroups(definitions) -- {{{1
4 | for group_name, definition in pairs(definitions) do
5 | vim.cmd("augroup " .. group_name)
6 | vim.cmd("autocmd!")
7 |
8 | for _, def in pairs(definition) do
9 | local command = table.concat(vim.tbl_flatten({ "autocmd", def }), " ")
10 | vim.cmd(command)
11 | end
12 |
13 | vim.cmd("augroup END")
14 | end
15 | end
16 |
17 | M.define_augroups({
18 |
19 | _user_autocommands = Sv.user_autocommands,
20 | _general_settings = {
21 | {
22 | "TextYankPost",
23 | "*",
24 | "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
25 | },
26 | {
27 | "BufWinEnter",
28 | "*",
29 | "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
30 | },
31 | {
32 | "BufRead",
33 | "*",
34 | "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
35 | },
36 | {
37 | "BufNewFile",
38 | "*",
39 | "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
40 | },
41 | {
42 | "BufWritePost",
43 | "sv-config.lua",
44 | "lua require('core.functions').reload_config()",
45 | },
46 | {
47 | "BufWritePost",
48 | "starplug.lua",
49 | "lua require('core.functions').reload_config()",
50 | },
51 | {
52 | "TextChanged,InsertLeave",
53 | "",
54 | "silent! write",
55 | },
56 | },
57 | _autolint = {
58 | {
59 | "BufWritePost",
60 | "",
61 | ":silent lua require('lint').try_lint()",
62 | },
63 | {
64 | "BufEnter",
65 | "",
66 | ":silent lua require('lint').try_lint()",
67 | },
68 | },
69 | })
70 |
71 | return M
72 |
--------------------------------------------------------------------------------
/lua/core/config/init.lua:
--------------------------------------------------------------------------------
1 | CONFIG_PATH = vim.fn.stdpath("config")
2 | DATA_PATH = vim.fn.stdpath("data")
3 | CACHE_PATH = vim.fn.stdpath("cache")
4 | TERMINAL = vim.fn.expand("$TERMINAL")
5 | USER = vim.fn.expand("$USER")
6 |
7 | Sv = {
8 | number = true,
9 | relative_number = false,
10 | number_width = 4,
11 | spell = false,
12 | spelllang = "en",
13 |
14 | shiftwidth = 2,
15 | tab_stop = 4,
16 | expandtab = true,
17 | smartindent = true,
18 |
19 | termguicolors = true,
20 | background = "dark",
21 | colorscheme = "stardark",
22 | guifont = "JetBrains Mono:11",
23 |
24 | shell = "zsh",
25 | cmdheight = 1,
26 |
27 | undofile = true,
28 | swapfile = false,
29 |
30 | pumheight = 20,
31 | timeoutlen = 200,
32 | scrolloff = 5,
33 |
34 | ignorecase = true,
35 | hl_search = true,
36 |
37 | leader_key = " ",
38 | format_on_save = true,
39 | lint_on_save = true,
40 |
41 | terminal_width = 70,
42 | terminal_height = 20,
43 | terminal_direction = "horizontal",
44 |
45 | treesitter = {
46 | ensure_installed = "lua",
47 | ignore_install = { "haskell" },
48 | highlight = {
49 | enabled = true,
50 | use_languagetree = true,
51 | },
52 | },
53 |
54 | user_which_key = {},
55 | user_plugins = {
56 | -- Put plugins in sv-config.lua
57 | },
58 | user_autocommands = {
59 | { "FileType", "qf", "set nobuflisted" },
60 | },
61 |
62 | lang = {
63 | cmake = {
64 | formatter = {
65 | exe = "clang-format",
66 | args = {},
67 | },
68 | },
69 | clang = {
70 | diagnostics = {
71 | virtual_text = { spacing = 0, prefix = "" },
72 | signs = true,
73 | underline = true,
74 | },
75 | cross_file_rename = true,
76 | header_insertion = "never",
77 | filetypes = { "c", "cpp", "objc" },
78 | formatter = {
79 | exe = "clang-format",
80 | args = {},
81 | },
82 | },
83 | css = {
84 | virtual_text = true,
85 | },
86 | dart = {
87 | sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot",
88 | formatter = {
89 | exe = "dart",
90 | args = { "format" },
91 | },
92 | },
93 | docker = {},
94 | efm = {},
95 | elm = {},
96 | emmet = { active = true },
97 | elixir = {},
98 | graphql = {},
99 | go = {
100 | formatter = {
101 | exe = "gofmt",
102 | args = {},
103 | },
104 | },
105 | html = {},
106 | java = {
107 | java_tools = {
108 | active = false,
109 | },
110 | },
111 | json = {
112 | diagnostics = {
113 | virtual_text = { spacing = 0, prefix = "" },
114 | signs = true,
115 | underline = true,
116 | },
117 | formatter = {
118 | exe = "python",
119 | args = { "-m", "json.tool" },
120 | },
121 | },
122 | kotlin = {},
123 | latex = {
124 | auto_save = false,
125 | ignore_errors = {},
126 | },
127 | lua = {
128 | diagnostics = {
129 | virtual_text = { spacing = 0, prefix = "" },
130 | signs = true,
131 | underline = true,
132 | },
133 | formatter = {
134 | exe = "stylua",
135 | args = {},
136 | stdin = false,
137 | },
138 | },
139 | php = {
140 | format = {
141 | format = {
142 | default = "psr12",
143 | },
144 | },
145 | environment = {
146 | php_version = "7.4",
147 | },
148 | diagnostics = {
149 | virtual_text = { spacing = 0, prefix = "" },
150 | signs = true,
151 | underline = true,
152 | },
153 | filetypes = { "php", "phtml" },
154 | formatter = {
155 | exe = "phpcbf",
156 | args = { "--standard=PSR12", vim.api.nvim_buf_get_name(0) },
157 | stdin = false,
158 | },
159 | },
160 | python = {
161 | -- @usage can be flake8 or yapf
162 | isort = false,
163 | diagnostics = {
164 | virtual_text = { spacing = 0, prefix = "" },
165 | signs = true,
166 | underline = true,
167 | },
168 | analysis = {
169 | type_checking = "basic",
170 | auto_search_paths = true,
171 | use_library_code_types = true,
172 | },
173 | formatter = {
174 | exe = "yapf",
175 | args = {},
176 | },
177 | },
178 | ruby = {
179 | diagnostics = {
180 | virtualtext = { spacing = 0, prefix = "" },
181 | signs = true,
182 | underline = true,
183 | },
184 | filetypes = { "rb", "erb", "rakefile", "ruby" },
185 | formatter = {
186 | exe = "rufo",
187 | args = { "-x" },
188 | },
189 | },
190 | rust = {
191 | rust_tools = {
192 | active = false,
193 | parameter_hints_prefix = "<-",
194 | other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)
195 | },
196 | -- @usage can be clippy
197 | formatter = {
198 | exe = "rustfmt",
199 | args = { "--emit=stdout", "--edition=2018" },
200 | },
201 | diagnostics = {
202 | virtual_text = { spacing = 0, prefix = "" },
203 | signs = true,
204 | underline = true,
205 | },
206 | },
207 | sh = {
208 | -- @usage can be 'shellcheck'
209 | -- @usage can be 'shfmt'
210 | diagnostics = {
211 | virtual_text = { spacing = 0, prefix = "" },
212 | signs = true,
213 | underline = true,
214 | },
215 | formatter = {
216 | exe = "shfmt",
217 | args = { "-w" },
218 | stdin = false,
219 | },
220 | },
221 | svelte = {},
222 | tailwindcss = {
223 | active = false,
224 | filetypes = {
225 | "html",
226 | "css",
227 | "scss",
228 | "javascript",
229 | "javascriptreact",
230 | "typescript",
231 | "typescriptreact",
232 | },
233 | formatter = {
234 | exe = "prettier",
235 | args = { "--write", "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
236 | stdin = false,
237 | },
238 | },
239 | terraform = {},
240 | tsserver = {
241 | -- @usage can be 'eslint' or 'eslint_d'
242 | diagnostics = {
243 | virtual_text = { spacing = 0, prefix = "" },
244 | signs = true,
245 | underline = true,
246 | },
247 | formatter = {
248 | exe = "prettier",
249 | args = { "--write", "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
250 | stdin = false,
251 | },
252 | },
253 | vim = {},
254 | yaml = {
255 | formatter = {
256 | exe = "prettier",
257 | args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
258 | },
259 | },
260 | },
261 | }
262 |
263 | require("core.config.settings")
264 |
--------------------------------------------------------------------------------
/lua/core/config/settings.lua:
--------------------------------------------------------------------------------
1 | local opt = vim.opt
2 |
3 | opt.number = Sv.number
4 | opt.numberwidth = Sv.number_width
5 | opt.relativenumber = Sv.relative_number
6 | opt.hlsearch = Sv.hl_search
7 | opt.ignorecase = Sv.ignorecase
8 | opt.termguicolors = Sv.termguicolors -- set term gui colors (most terminals support this)
9 | opt.scrolloff = Sv.scrolloff
10 | opt.timeoutlen = Sv.timeoutlen -- set time out intervel
11 | opt.cmdheight = Sv.cmdheight
12 | opt.guifont = Sv.guifont -- the font used in graphical neovim applications
13 | opt.spell = Sv.spell
14 | opt.spelllang = Sv.spelllang
15 | opt.pumheight = Sv.pumheight -- pop up menu height
16 | opt.undofile = Sv.undofile -- enable persisten undo
17 | opt.swapfile = Sv.swapfile -- creates a swapfile
18 | opt.ruler = false
19 | opt.hidden = true
20 | opt.splitbelow = true
21 | opt.splitright = true
22 | opt.cul = true
23 | opt.updatetime = 250 -- update interval for gitsigns
24 | opt.mouse = "a" -- enable mouse in neovim
25 | opt.signcolumn = "yes"
26 | opt.clipboard = "unnamedplus"
27 | opt.background = Sv.background
28 |
29 | opt.undodir = CACHE_PATH .. "/undo" -- set an undo directory
30 | opt.shortmess:append("sI") -- Disable nvim intro
31 | vim.cmd("let &fcs='eob: '")
32 |
33 | opt.whichwrap:append("<>hl") -- Able to move through a setence with 'h' and 'l'
34 |
35 | -- for indentline
36 | opt.expandtab = Sv.expandtab
37 | opt.shiftwidth = Sv.shiftwidth
38 | opt.smartindent = Sv.smartindent
39 | opt.tabstop = Sv.tab_stop -- insert 4 spaces for a tab
40 |
41 | if Sv.leader_key == " " or Sv.leader_key == "space" then
42 | vim.g.mapleader = " "
43 | else
44 | vim.g.mapleader = Sv.leader_key
45 | end
46 |
--------------------------------------------------------------------------------
/lua/core/config/starrc.lua:
--------------------------------------------------------------------------------
1 | local utils = require("utils")
2 | local log = require("core.logging")
3 |
4 | local M = {}
5 |
6 | log.debug("Loading starplug module ...")
7 |
8 | -- default_starrc_values loads the default starrc values
9 | -- @return table
10 | local function default_starrc_values()
11 | return {
12 | ui = {
13 | "dashboard", -- Start screen
14 | "statusline", -- Statusline
15 | "tabline", -- Tabline, shows your buffers list at top
16 | "which-key", -- Keybindings popup menu like Emacs' guide-key
17 | -- 'zen', -- Distraction free environment
18 | -- 'indentlines', -- Show indent lines
19 | },
20 | star = {
21 | -- 'orgmode', -- Life Organization Tool
22 | -- 'runner', -- Code runner for your language
23 | },
24 | colors = {
25 | "stardark", -- The shiny theme
26 | -- "gruvbox", -- The almighty
27 | -- "icy", -- Shiver to death!
28 | -- "neon", -- Welcome to the light
29 | },
30 | editor = {
31 | -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler)
32 | "nvim-tree", -- Tree explorer
33 | "symbols", -- LSP symbols and tags
34 | -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap
35 | "gitsigns", -- Git signs
36 | "telescope", -- Highly extendable fuzzy finder over lists
37 | "formatter", -- File formatting
38 | "autopairs", -- Autopairs
39 | "commentary", -- Comments plugin
40 | "lsp", -- Language Server Protocols
41 | "lint", -- A beauty teacher for your language
42 | },
43 | utilities = {
44 | -- 'suda', -- Write and read files without sudo permissions
45 | -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit
46 | -- 'colorizer', -- Fastets colorizer for Neovim
47 | },
48 | }
49 | end
50 |
51 | -- load_starrc Loads the doomrc if it exists, otherwise it'll fallback to doom
52 | -- default configs.
53 | M.load_starrc = function()
54 | local config
55 |
56 | -- /home/user/.config/doom-nvim/starrc
57 | if vim.fn.filereadable(utils.star_root .. "/starplug.lua") == 1 then
58 | local loaded_starrc, err = pcall(function()
59 | log.debug("Loading the starplug file ...")
60 | config = dofile(utils.star_root .. "/starplug.lua")
61 | end)
62 |
63 | if not loaded_starrc then
64 | log.debug("Error while loading the starplug. Traceback:\n" .. err)
65 | end
66 | else
67 | log.debug("No starplug.lua file found, falling to defaults")
68 | config = default_starrc_values()
69 | end
70 |
71 | return config
72 | end
73 |
74 | return M
75 |
--------------------------------------------------------------------------------
/lua/core/functions/init.lua:
--------------------------------------------------------------------------------
1 | local utils = require("utils")
2 |
3 | local M = {}
4 |
5 | function M.reload_config()
6 | vim.cmd("source ~/.config/nvim/lua/core/config/init.lua")
7 | vim.cmd("source ~/.config/nvim/sv-config.lua")
8 | vim.cmd("source ~/.config/nvim/starplug.lua")
9 | vim.cmd("source ~/.config/nvim/lua/modules/init.lua")
10 | vim.cmd(":PackerInstall")
11 | vim.cmd(":PackerCompile")
12 | end
13 |
14 | function M.search_dotfiles()
15 | require("telescope.builtin").find_files({
16 | prompt_title = "< Neovim Dotfiles >",
17 | cwd = "~/.config/nvim",
18 | })
19 | end
20 |
21 | -- check_plugin checks if the given plugin exists
22 | -- @tparam string plugin_name The plugin name, e.g. nvim-tree.lua
23 | -- @tparam string path Where should be searched the plugin in packer's path, defaults to `start`
24 | -- @return bool
25 | M.check_plugin = function(plugin_name, path)
26 | if not path then
27 | path = "start"
28 | end
29 |
30 | return vim.fn.isdirectory(vim.fn.stdpath("data") .. "/site/pack/packer/" .. path .. "/" .. plugin_name) == 1
31 | end
32 |
33 | -- is_plugin_disabled checks if the given plugin is disabled in doomrc
34 | -- @tparam string plugin The plugin identifier, e.g. statusline
35 | -- @return bool
36 | M.is_plugin_disabled = function(plugin)
37 | local starrc = require("core.config.starrc").load_starrc()
38 |
39 | -- Iterate over all starrc sections (e.g. ui) and their plugins
40 | for _, section in pairs(starrc) do
41 | if utils.has_value(section, plugin) then
42 | return false
43 | end
44 | end
45 |
46 | return true
47 | end
48 |
49 | -- hide line numbers , statusline in specific buffers!
50 | function M.hideStuff()
51 | vim.api.nvim_exec(
52 | false,
53 | [[
54 | au TermOpen term://* setlocal nonumber
55 | au TermClose term://* bd!
56 | au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
57 | ]]
58 | )
59 | end
60 |
61 | return M
62 |
--------------------------------------------------------------------------------
/lua/core/init.lua:
--------------------------------------------------------------------------------
1 | require("core.config")
2 | require("core.config.settings")
3 | require("modules")
4 | require("core.keybindings")
5 | require("core.autocmds")
6 | require("core.functions")
7 |
--------------------------------------------------------------------------------
/lua/core/keybindings/init.lua:
--------------------------------------------------------------------------------
1 | local utils = require("utils")
2 |
3 | local opts = { silent = true, noremap = true }
4 |
5 | -- compe mappings
6 | utils.map("i", "", "v:lua.tab_complete()", { expr = true })
7 | utils.map("s", "", "v:lua.tab_complete()", { expr = true })
8 | utils.map("i", "", "v:lua.s_tab_complete()", { expr = true })
9 | utils.map("s", "", "v:lua.s_tab_complete()", { expr = true })
10 | utils.map("i", "", "v:lua.completions()", { expr = true })
11 |
12 | -- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them
13 | --[[ remove this line
14 |
15 | utils.map("n", "dd", [=[ "_dd ]=], opt)
16 | utils.map("v", "dd", [=[ "_dd ]=], opt)
17 | utils.map("v", "x", [=[ "_x ]=], opt)
18 |
19 | this line too ]]
20 |
21 | -- Disable accidentally pressing ctrl-z and suspending
22 | utils.map("n", "", "", opts)
23 |
24 | -- Copy whole file content with Ctrl-a
25 | utils.map("n", "", "%y+", opts)
26 |
27 | -- Save with Ctrl-s
28 | utils.map("n", "", "w ", opts)
29 |
30 | -- better indenting
31 | utils.map("v", "<", "", ">gv", opts)
33 |
34 | -- use ESC to turn off search highlighting
35 | utils.map("n", "", "noh", opts)
36 |
37 | -- use ESC to turn off search highlighting
38 | utils.map("t", "", "", opts)
39 |
40 | -- Move selected line / block of text in visual mode
41 | utils.map("x", "K", ":move '<-2gv-gv", opts)
42 | utils.map("x", "J", ":move '>+1gv-gv", opts)
43 |
44 | -- Don't copy the replaced text after pasting in visual mode
45 | utils.map("v", "p", '"_dP', opts)
46 |
47 | -- Commentary
48 | utils.map("n", "/", ":CommentToggle", opts)
49 | utils.map("v", "/", ":CommentToggle", opts)
50 |
51 | -- better window movement
52 | utils.map("n", "", "h", opts)
53 | utils.map("n", "", "j", opts)
54 | utils.map("n", "", "k", opts)
55 | utils.map("n", "", "l", opts)
56 |
57 | -- Windows and Splits
58 | utils.map("n", "wc", "c", opts) -- Close Split
59 | utils.map("n", "ws", "s", opts) -- Horizontal Split
60 | utils.map("n", "wv", "v", opts) -- Vertical Split
61 | utils.map("n", "wl", "5>", opts) -- Expand Split Right
62 | utils.map("n", "wh", "5<", opts) -- Expand Split left
63 | utils.map("n", "wb", "=", opts) -- Balance Splits
64 | utils.map("n", "wj", "resize -5", opts) -- Expand Split above
65 | utils.map("n", "wk", "resize +5", opts) -- Expand Split below
66 |
67 | -- Buffers or Tabs
68 | utils.map("n", "bn", "enew", opts) -- New tab
69 | utils.map("n", "bd", "bd!", opts) -- Close tab
70 | utils.map("n", "bp", "BufferLinePick", opts) -- Pick a buffer or tab
71 | utils.map("n", "", "BufferLineCycleNext", opts) -- Next Tab
72 | utils.map("n", "", "BufferLineCyclePrev", opts) -- Prev Tab
73 |
74 | -- Git
75 | utils.map("n", "gg", "LazyGit", opts) -- Open LazyGit
76 | utils.map("n", "gc", "Telescope git_commits", opts) -- Commits List
77 | utils.map("n", "gC", "Telescope git_bcommits", opts) -- Commits List for current file
78 | utils.map("n", "gb", "Telescope git_branches", opts) -- Branches List
79 | utils.map("n", "gt", "Telescope git_status", opts) -- Git status
80 |
81 | -- Help Telescope
82 | utils.map("n", "hh", "Telescope help_tags", opts) -- help_tags
83 | utils.map("n", "ht", "Telescope builitn", opts) -- builtins
84 | utils.map("n", "hc", "Telescope commands", opts) -- commands
85 | utils.map("n", "hk", "Telescope keymaps", opts) -- keymaps
86 | utils.map("n", "ho", "Telescope vim_options", opts) -- vim options
87 | utils.map("n", "ha", "Telescope autocommands", opts) -- autocommands
88 |
89 | -- Code and LSP --
90 | -- Lsp Saga
91 | utils.map("n", "cr", "Lspsaga rename", opts) -- Rename function
92 | utils.map("n", "cf", "Lspsaga lsp_finder", opts) -- Find references
93 | utils.map("n", "ca", "Lspsaga code_action", opts) -- Code actions
94 | utils.map("n", "cgn", "Lspsaga diagnostic_jump_next", opts)
95 | utils.map("n", "cgp", "Lspsaga diagnostic_jump_prev", opts)
96 | -- Code
97 | utils.map("n", "cs", "SymbolsOutline", opts) -- Code tree with symbols
98 | utils.map("n", "cd", "Lspsaga preview_definition", opts) -- Preview definition
99 | utils.map("n", "cF", "Format", opts) -- Format buffer
100 |
101 | utils.map("n", "K", "lua vim.lsp.buf.hover()", opts)
102 | utils.map("n", "", "lnext", opts) -- error navigation list
103 | utils.map("n", "", "lprev", opts) -- error navigation list
104 | utils.map("n", "cl", "lua vim.lsp.diagnostic.set_loclist()", opts) -- error list
105 | utils.map("n", "cgD", "lua vim.lsp.buf.definition()", opts) -- jump to definition
106 | utils.map("n", "cgr", "lua vim.lsp.buf.references()", opts) -- go to reference
107 | utils.map("n", "cgi", "lua vim.lsp.buf.implementation()", opts) -- buf implementation
108 |
109 | -- Runner
110 | utils.map("n", "ci", 'lua require("modules.runner").start_repl()', opts)
111 |
112 | -- Plugins
113 | utils.map("n", "pi", "PackerInstall", opts)
114 | utils.map("n", "ps", "PackerSync", opts)
115 | utils.map("n", "pc", "PackerClean", opts)
116 | utils.map("n", "pC", "PackerCompile", opts)
117 | utils.map("n", "pt", "PackerStatus", opts)
118 | utils.map("n", "pr", "lua require('core.functions').reload_config()", opts)
119 |
120 | -- Search
121 | utils.map("n", "sg", "Telescope live_grep", opts)
122 | utils.map("n", "sb", "Telescope current_buffer_fuzzy_find", opts)
123 | utils.map("n", "ss", "Telescope lsp_document_symbols", opts)
124 | utils.map("n", "sh", "Telescope command_history", opts)
125 | utils.map("n", "sm", "Telescope marks", opts)
126 | utils.map("n", "sc", "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})")
127 |
128 | -- Files
129 | utils.map("n", "ff", "Telescope find_files", opts)
130 | utils.map("n", "fm", "Telescope media_files", opts)
131 | utils.map("n", "fc", "lua require('core.functions').search_dotfiles()", opts)
132 | utils.map("n", "fr", "Telescope oldfiles", opts)
133 | utils.map("n", "fb", "Telescope file_browser", opts)
134 | utils.map("n", "fn", "enew", opts)
135 | utils.map("n", "ft", "Format", opts)
136 | utils.map("n", ":", "Telescope command_history", opts)
137 |
138 | -- Sessions
139 | utils.map("n", "qq", "wqa", opts)
140 | utils.map("n", "q!", "qa!", opts)
141 | utils.map("n", "qs", "SessionSave", opts)
142 | utils.map("n", "ql", "SessionLoad", opts)
143 |
144 | -- Terminal
145 | utils.map("n", "tt", "ToggleTerm", opts)
146 | utils.map("n", "ts", "10new +terminal | setlocal nobuflisted ", opts)
147 | utils.map("n", "tv", "vnew +terminal | setlocal nobuflisted", opts)
148 |
149 | -- Nvim Tree
150 | utils.map("n", "e", "NvimTreeToggle", opts)
151 |
152 | -- Zen Mode
153 | utils.map("n", "zz", "TZAtaraxis", opts)
154 | utils.map("n", "zm", "TZMinimalist", opts)
155 | utils.map("n", "zf", "TZFocus