zshrc
This commit is contained in:
parent
c7d1799397
commit
b712518abb
@ -1,15 +0,0 @@
|
||||
{
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"plugins": true
|
||||
}
|
||||
},
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
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.
|
@ -1,4 +0,0 @@
|
||||
# 💤 LazyVim
|
||||
|
||||
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
||||
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
@ -1,2 +1,24 @@
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
if vim.fn.has('nvim-0.8') == 0 then
|
||||
error('Need Neovim 0.8+ in order to use this config')
|
||||
end
|
||||
|
||||
for _, cmd in ipairs({"git", "rg", {"fd", "fdfind"}}) do
|
||||
local name = type(cmd) == "string" and cmd or vim.inspect(cmd)
|
||||
local commands = type(cmd) == "string" and {cmd} or cmd
|
||||
---@cast commands string[]
|
||||
local found = false
|
||||
|
||||
for _, c in ipairs(commands) do
|
||||
if vim.fn.executable(c) == 1 then
|
||||
name = c
|
||||
found = true
|
||||
end
|
||||
end
|
||||
|
||||
if not found then
|
||||
error(("`%s` is not installed"):format(name))
|
||||
end
|
||||
end
|
||||
|
||||
-- Load main config
|
||||
require("config")
|
@ -1,3 +1,52 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group
|
||||
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
|
||||
|
||||
-- General settings
|
||||
|
||||
-- Highlight on yank
|
||||
autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank({
|
||||
higroup = "IncSearch",
|
||||
timeout = "1000"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
-- Remove whitespace on save
|
||||
autocmd("BufWritePre", {
|
||||
pattern = "",
|
||||
command = ":%s/\\s\\+$//e"
|
||||
})
|
||||
|
||||
-- Auto format on save using the attached (optionally filtered) language servere clients
|
||||
-- https://neovim.io/doc/user/lsp.html#vim.lsp.buf.format()
|
||||
autocmd("BufWritePre", {
|
||||
pattern = "",
|
||||
command = ":silent lua vim.lsp.buf.format()"
|
||||
})
|
||||
|
||||
-- Don"t auto commenting new lines
|
||||
autocmd("BufEnter", {
|
||||
pattern = "",
|
||||
command = "set fo-=c fo-=r fo-=o"
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = {"xml", "html", "xhtml", "css", "scss", "javascript", "typescript", "yaml", "lua"},
|
||||
command = "setlocal shiftwidth=2 tabstop=2"
|
||||
})
|
||||
|
||||
-- Set colorcolumn
|
||||
autocmd("Filetype", {
|
||||
pattern = {"python", "rst", "c", "cpp"},
|
||||
command = "set colorcolumn=80"
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = {"gitcommit", "markdown", "text"},
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end
|
||||
})
|
76
neovim/.config/nvim/lua/config/init.lua
Normal file
76
neovim/.config/nvim/lua/config/init.lua
Normal file
@ -0,0 +1,76 @@
|
||||
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 = " "
|
||||
vim.opt.termguicolors = true -- enable 24-bit RGB colors
|
||||
|
||||
-- build spec
|
||||
local spec = {{
|
||||
import = "plugins"
|
||||
}}
|
||||
|
||||
local ok, err = pcall(require, "plugins.custom")
|
||||
if ok then
|
||||
spec = {{
|
||||
import = "plugins"
|
||||
}, {
|
||||
import = "plugins.custom"
|
||||
}}
|
||||
end
|
||||
|
||||
require("lazy").setup({
|
||||
root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed
|
||||
spec = spec,
|
||||
lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update.
|
||||
defaults = {
|
||||
lazy = false, -- should plugins be lazy-loaded?
|
||||
version = nil
|
||||
-- version = "*", -- enable this to try installing the latest stable versions of plugins
|
||||
},
|
||||
install = {
|
||||
-- install missing plugins on startup
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = {"rose-pine", "habamax"}
|
||||
},
|
||||
checker = {
|
||||
-- automatically check for plugin updates
|
||||
enabled = true,
|
||||
-- get a notification when new updates are found
|
||||
-- disable it as it's too annoying
|
||||
notify = false,
|
||||
-- check for updates every day
|
||||
frequency = 86400
|
||||
},
|
||||
change_detection = {
|
||||
-- automatically check for config file changes and reload the ui
|
||||
enabled = true,
|
||||
-- get a notification when changes are found
|
||||
-- disable it as it's too annoying
|
||||
notify = false
|
||||
},
|
||||
performance = {
|
||||
cache = {
|
||||
enabled = true
|
||||
}
|
||||
},
|
||||
state = vim.fn.stdpath("state") .. "/lazy/state.json" -- state info for checker and other things
|
||||
})
|
||||
|
||||
local modules = {"config.autocmds", "config.options", "config.keymaps", "config.custom"}
|
||||
|
||||
for _, mod in ipairs(modules) do
|
||||
local ok, err = pcall(require, mod)
|
||||
-- config.custom may be empty. It's a optional module
|
||||
if not ok and not mod == "config/custom" then
|
||||
error(("Error loading %s...\n\n%s"):format(mod, err))
|
||||
end
|
||||
end
|
||||
|
||||
-- Disable annoying deprecated message
|
||||
vim.deprecate = function() end
|
@ -1,4 +1,28 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
--
|
||||
vim.keymap.set("n", "<leader>q", ":qa!<CR>", {})
|
||||
-- Fast saving with <leader> and s
|
||||
vim.keymap.set("n", "<leader>s", ":w<CR>", {})
|
||||
-- Move around splits
|
||||
vim.keymap.set("n", "<leader>wh", "<C-w>h", {})
|
||||
vim.keymap.set("n", "<leader>wj", "<C-w>j", {})
|
||||
vim.keymap.set("n", "<leader>wk", "<C-w>k", {})
|
||||
vim.keymap.set("n", "<leader>wl", "<C-w>l", {})
|
||||
|
||||
-- Reload configuration without restart nvim
|
||||
vim.keymap.set("n", "<leader>r", ":so %<CR>", {})
|
||||
|
||||
-- Telescope
|
||||
-- <leader> is a space now
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||
|
||||
-- NvimTree
|
||||
vim.keymap.set("n", "<leader>n", ":NvimTreeToggle<CR>", {}) -- open/close
|
||||
vim.keymap.set("n", "<leader>nr", ":NvimTreeRefresh<CR>", {}) -- refresh
|
||||
vim.keymap.set("n", "<leader>nf", ":NvimTreeFindFile<CR>", {}) -- search file
|
||||
|
||||
-- Terminal
|
||||
vim.keymap.set("n", "<leader>tt", ":NeotermToggle<CR>", {})
|
||||
-- vim.keymap.set("n", "<leader>tx", ":NeotermExit<CR>", {})
|
@ -1,47 +0,0 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.json" },
|
||||
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -1,3 +1,111 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
local cmd = vim.cmd
|
||||
-- Set options (global/buffer/windows-scoped)
|
||||
local opt = vim.opt
|
||||
-- Global variables
|
||||
local g = vim.g
|
||||
local s = vim.s
|
||||
local indent = 4
|
||||
|
||||
cmd([[
|
||||
filetype plugin indent on
|
||||
]])
|
||||
|
||||
opt.backspace = {"eol", "start", "indent"} -- allow backspacing over everything in insert mode
|
||||
opt.clipboard = "unnamedplus" -- allow neovim to access the system clipboard
|
||||
vim.opt.fileencoding = "utf-8" -- the encoding written to a file
|
||||
opt.encoding = "utf-8" -- the encoding
|
||||
opt.matchpairs = {"(:)", "{:}", "[:]", "<:>"}
|
||||
opt.syntax = "enable"
|
||||
|
||||
-- indention
|
||||
opt.autoindent = true -- auto indentation
|
||||
opt.expandtab = true -- convert tabs to spaces
|
||||
opt.shiftwidth = indent -- the number of spaces inserted for each indentation
|
||||
opt.smartindent = true -- make indenting smarter
|
||||
opt.softtabstop = indent -- when hitting <BS>, pretend like a tab is removed, even if spaces
|
||||
opt.tabstop = indent -- insert 2 spaces for a tab
|
||||
opt.shiftround = true -- use multiple of shiftwidth when indenting with "<" and ">"
|
||||
|
||||
-- search
|
||||
opt.hlsearch = true -- highlight all matches on previous search pattern
|
||||
opt.ignorecase = true -- ignore case in search patterns
|
||||
opt.smartcase = true -- smart case
|
||||
opt.wildignore = opt.wildignore + {"*/node_modules/*", "*/.git/*", "*/vendor/*"}
|
||||
opt.wildmenu = true -- make tab completion for files/buffers act like bash
|
||||
|
||||
-- ui
|
||||
opt.cursorline = true -- highlight the current line
|
||||
opt.laststatus = 2 -- only the last window will always have a status line
|
||||
opt.lazyredraw = true -- don"t update the display while executing macros
|
||||
opt.list = true
|
||||
-- You can also add "space" or "eol", but I feel it"s quite annoying
|
||||
opt.listchars = {
|
||||
tab = "┊ ",
|
||||
trail = "·",
|
||||
extends = "»",
|
||||
precedes = "«",
|
||||
nbsp = "×"
|
||||
}
|
||||
|
||||
-- Hide cmd line
|
||||
opt.cmdheight = 0 -- more space in the neovim command line for displaying messages
|
||||
|
||||
opt.mouse = "a" -- allow the mouse to be used in neovim
|
||||
opt.number = true -- set numbered lines
|
||||
opt.scrolloff = 18 -- minimal number of screen lines to keep above and below the cursor
|
||||
opt.sidescrolloff = 3 -- minimal number of screen columns to keep to the left and right (horizontal) of the cursor if wrap is `false`
|
||||
opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
|
||||
opt.splitbelow = true -- open new split below
|
||||
opt.splitright = true -- open new split to the right
|
||||
opt.wrap = false -- display a long line
|
||||
|
||||
-- backups
|
||||
opt.backup = false -- create a backup file
|
||||
opt.swapfile = false -- creates a swapfile
|
||||
opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
|
||||
-- autocomplete
|
||||
opt.completeopt = {"menu", "menuone", "noselect"} -- mostly just for cmp
|
||||
opt.shortmess = opt.shortmess + {
|
||||
c = true
|
||||
} -- hide all the completion messages, e.g. "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found"
|
||||
|
||||
-- By the way, -- INSERT -- is unnecessary anymore because the mode information is displayed in the statusline.
|
||||
opt.showmode = false
|
||||
|
||||
-- perfomance
|
||||
-- remember N lines in history
|
||||
opt.history = 10000 -- keep 100 lines of history
|
||||
opt.redrawtime = 1500
|
||||
opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
opt.ttimeoutlen = 10
|
||||
opt.updatetime = 100 -- signify default updatetime 4000ms is not good for async update
|
||||
|
||||
-- theme
|
||||
opt.termguicolors = true -- enable 24-bit RGB colors
|
||||
|
||||
-- persistent undo
|
||||
-- Don"t forget to create folder $HOME/.local/share/nvim/undo
|
||||
local undodir = vim.fn.stdpath("data") .. "/undo"
|
||||
opt.undofile = true -- enable persistent undo
|
||||
opt.undodir = undodir
|
||||
opt.undolevels = 1000
|
||||
opt.undoreload = 10000
|
||||
|
||||
-- fold
|
||||
opt.foldmethod = "marker"
|
||||
opt.foldlevel = 99
|
||||
|
||||
-- Disable builtin plugins
|
||||
local disabled_built_ins = {"2html_plugin", "getscript", "getscriptPlugin", "gzip", "logipat", "netrw", "netrwPlugin",
|
||||
"netrwSettings", "netrwFileHandlers", "matchit", "tar", "tarPlugin", "rrhelper",
|
||||
"spellfile_plugin", "vimball", "vimballPlugin", "zip", "zipPlugin", "tutor", "rplugin",
|
||||
"synmenu", "optwin", "compiler", "bugreport", "ftplugin"}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
-- Colorscheme
|
||||
-- By default, use rose-pine
|
||||
cmd.colorscheme("rose-pine")
|
31
neovim/.config/nvim/lua/plugins/colorizer.lua
Normal file
31
neovim/.config/nvim/lua/plugins/colorizer.lua
Normal file
@ -0,0 +1,31 @@
|
||||
return {{
|
||||
-- Autopairs
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = {"string"}, -- it will not add a pair on that treesitter node
|
||||
javascript = {"template_string"},
|
||||
java = false -- don"t check treesitter on java
|
||||
},
|
||||
|
||||
-- Don"t add pairs if it already has a close pair in the same line
|
||||
enable_check_bracket_line = false,
|
||||
|
||||
-- Don"t add pairs if the next char is alphanumeric
|
||||
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
|
||||
fast_wrap = {},
|
||||
disable_filetype = {"TelescopePrompt", "vim"}
|
||||
},
|
||||
config = function(_, opts)
|
||||
local npairs = require("nvim-autopairs")
|
||||
npairs.setup(opts)
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({
|
||||
map_char = {
|
||||
tex = ""
|
||||
}
|
||||
}))
|
||||
end
|
||||
}}
|
17
neovim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
17
neovim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
@ -0,0 +1,17 @@
|
||||
return {{
|
||||
-- Rose-pine - Soho vibes for Neovim
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
opts = {
|
||||
dark_variant = "main"
|
||||
}
|
||||
}, {
|
||||
-- Github - Github"s Neovim themes
|
||||
"projekt0n/github-nvim-theme",
|
||||
lazy = true
|
||||
}, {
|
||||
-- Tokyonight- A clean, dark Neovim theme written in Lua, with support for lsp,
|
||||
-- treesitter and lots of plugins. Includes additional themes for Kitty, Alacritty, iTerm and Fish.
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = true
|
||||
}}
|
75
neovim/.config/nvim/lua/plugins/comment.lua
Normal file
75
neovim/.config/nvim/lua/plugins/comment.lua
Normal file
@ -0,0 +1,75 @@
|
||||
return {{
|
||||
-- Smart and powerful comment plugin for neovim.
|
||||
-- Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
|
||||
"numToStr/Comment.nvim",
|
||||
opts = {
|
||||
active = true,
|
||||
on_config_done = nil,
|
||||
-- Add a space b/w comment and the line
|
||||
-- @type boolean
|
||||
padding = true,
|
||||
|
||||
-- Whether cursor should stay at the
|
||||
-- same position. Only works in NORMAL
|
||||
-- mode mappings
|
||||
sticky = true,
|
||||
|
||||
-- Lines to be ignored while comment/uncomment.
|
||||
-- Could be a regex string or a function that returns a regex string.
|
||||
-- Example: Use "^$" to ignore empty lines
|
||||
-- @type string|function
|
||||
ignore = "^$",
|
||||
|
||||
-- Whether to create basic (operator-pending) and extra mappings for NORMAL/VISUAL mode
|
||||
-- @type table
|
||||
mappings = {
|
||||
-- operator-pending mapping
|
||||
-- Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
|
||||
basic = true,
|
||||
-- Extra mapping
|
||||
-- Includes `gco`, `gcO`, `gcA`
|
||||
extra = true
|
||||
},
|
||||
|
||||
-- LHS of line and block comment toggle mapping in NORMAL/VISUAL mode
|
||||
-- @type table
|
||||
toggler = {
|
||||
-- line-comment toggle
|
||||
line = "mm",
|
||||
-- block-comment toggle
|
||||
block = "mbm"
|
||||
},
|
||||
|
||||
-- LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode
|
||||
-- @type table
|
||||
opleader = {
|
||||
-- line-comment opfunc mapping
|
||||
line = "m",
|
||||
-- block-comment opfunc mapping
|
||||
block = "mb"
|
||||
},
|
||||
|
||||
-- LHS of extra mappings
|
||||
-- @type table
|
||||
extra = {
|
||||
-- Add comment on the line above
|
||||
above = "mO",
|
||||
-- Add comment on the line below
|
||||
below = "mo",
|
||||
-- Add comment at the end of line
|
||||
eol = "mA"
|
||||
},
|
||||
|
||||
-- Pre-hook, called before commenting the line
|
||||
-- @type function|nil
|
||||
pre_hook = pre_hook,
|
||||
|
||||
-- Post-hook, called after commenting is done
|
||||
-- @type function|nil
|
||||
post_hook = nil
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end
|
||||
}}
|
99
neovim/.config/nvim/lua/plugins/formatter.lua
Normal file
99
neovim/.config/nvim/lua/plugins/formatter.lua
Normal file
@ -0,0 +1,99 @@
|
||||
return {{
|
||||
"mhartington/formatter.nvim",
|
||||
config = function()
|
||||
local vim = vim
|
||||
local formatter = require("formatter")
|
||||
local prettierConfig = function()
|
||||
return {
|
||||
exe = "prettier",
|
||||
args = {"--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote"},
|
||||
stdin = true
|
||||
}
|
||||
end
|
||||
|
||||
local formatterConfig = {
|
||||
lua = {
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "stylua",
|
||||
-- args = { "-" },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "luafmt",
|
||||
-- args = {"--indent-count", 2, "--stdin"},
|
||||
-- stdin = true
|
||||
-- }
|
||||
-- end
|
||||
},
|
||||
vue = {function()
|
||||
return {
|
||||
exe = "prettier",
|
||||
args = {"--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)), "--single-quote",
|
||||
"--parser", "vue"},
|
||||
stdin = true
|
||||
}
|
||||
end},
|
||||
rust = { -- Rustfmt
|
||||
function()
|
||||
return {
|
||||
exe = "rustfmt",
|
||||
args = {"--emit=stdout"},
|
||||
stdin = true
|
||||
}
|
||||
end},
|
||||
swift = { -- Swiftlint
|
||||
function()
|
||||
return {
|
||||
exe = "swift-format",
|
||||
args = {vim.api.nvim_buf_get_name(0)},
|
||||
stdin = true
|
||||
}
|
||||
end},
|
||||
r = {function()
|
||||
return {
|
||||
exe = "R",
|
||||
args = {"--slave", "--no-restore", "--no-save", "-e",
|
||||
'\'con <- file("stdin"); styler::style_text(readLines(con)); close(con)\'', "2>/dev/null"},
|
||||
stdin = true
|
||||
}
|
||||
end},
|
||||
dart = {function()
|
||||
return {
|
||||
exe = "dart",
|
||||
args = {'format'},
|
||||
stdin = true
|
||||
}
|
||||
end},
|
||||
['*'] = {
|
||||
-- require("formatter.filetypes.any").lsp_format,
|
||||
-- require('formatter.filetypes.any').remove_trailing_whitespace
|
||||
}
|
||||
}
|
||||
local commonFT = {"css", "scss", "html", "java", "javascript", "javascriptreact", "typescript",
|
||||
"typescriptreact", "markdown", "markdown.mdx", "json", "yaml", "xml", "svg", "svelte"}
|
||||
for _, ft in ipairs(commonFT) do
|
||||
formatterConfig[ft] = {prettierConfig}
|
||||
end
|
||||
-- Setup functions
|
||||
formatter.setup({
|
||||
logging = true,
|
||||
filetype = formatterConfig,
|
||||
log_level = 2
|
||||
})
|
||||
end
|
||||
}, {
|
||||
"mfussenegger/nvim-lint",
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = {
|
||||
javascript = {"eslint_d"},
|
||||
typescript = {"eslint_d"},
|
||||
javascriptreact = {"eslint_d"},
|
||||
typescriptreact = {"eslint_d"},
|
||||
markdown = {"vale"}
|
||||
}
|
||||
end
|
||||
}}
|
@ -1,11 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"ibhagwan/fzf-lua",
|
||||
-- optional for icon support
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
-- calling `setup` is optional for customization
|
||||
require("fzf-lua").setup({})
|
||||
end,
|
||||
},
|
||||
}
|
82
neovim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
82
neovim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,82 @@
|
||||
return {{
|
||||
-- Git integration for buffers
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = {
|
||||
hl = "GitSignsAdd",
|
||||
text = "│",
|
||||
numhl = "GitSignsAddNr",
|
||||
linehl = "GitSignsAddLn"
|
||||
},
|
||||
change = {
|
||||
hl = "GitSignsChange",
|
||||
text = "│",
|
||||
numhl = "GitSignsChangeNr",
|
||||
linehl = "GitSignsChangeLn"
|
||||
},
|
||||
delete = {
|
||||
hl = "GitSignsDelete",
|
||||
text = "_",
|
||||
numhl = "GitSignsDeleteNr",
|
||||
linehl = "GitSignsDeleteLn"
|
||||
},
|
||||
topdelete = {
|
||||
hl = "GitSignsDelete",
|
||||
text = "‾",
|
||||
numhl = "GitSignsDeleteNr",
|
||||
linehl = "GitSignsDeleteLn"
|
||||
},
|
||||
changedelete = {
|
||||
hl = "GitSignsChange",
|
||||
text = "~",
|
||||
numhl = "GitSignsChangeNr",
|
||||
linehl = "GitSignsChangeLn"
|
||||
},
|
||||
untracked = {
|
||||
hl = "GitSignsAdd",
|
||||
text = "┆",
|
||||
numhl = "GitSignsAddNr",
|
||||
linehl = "GitSignsAddLn"
|
||||
}
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol", -- "eol" | "overlay" | "right_align"
|
||||
delay = 1000,
|
||||
ignore_whitespace = false
|
||||
},
|
||||
current_line_blame_formatter_opts = {
|
||||
relative_time = false
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "single",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
yadm = {
|
||||
enable = false
|
||||
}
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
require("gitsigns").setup(opts)
|
||||
end
|
||||
}}
|
@ -1,20 +0,0 @@
|
||||
return {
|
||||
-- nvim v0.8.0
|
||||
"kdheepak/lazygit.nvim",
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
}
|
272
neovim/.config/nvim/lua/plugins/lsp.lua
Normal file
272
neovim/.config/nvim/lua/plugins/lsp.lua
Normal file
@ -0,0 +1,272 @@
|
||||
return {{
|
||||
-- Mason
|
||||
"williamboman/mason.nvim",
|
||||
cmd = {"Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog"},
|
||||
opts = {
|
||||
PATH = "prepend",
|
||||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " "
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>"
|
||||
}
|
||||
},
|
||||
|
||||
max_concurrent_installers = 10
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
end
|
||||
}, {
|
||||
-- LSP - Quickstart configs for Nvim LSP
|
||||
"neovim/nvim-lspconfig",
|
||||
event = {"BufReadPre", "BufNewFile"},
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{"williamboman/mason.nvim"}, {"williamboman/mason-lspconfig.nvim"}, -- Autocomplete
|
||||
-- A completion plugin for neovim coded in Lua.
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {"L3MON4D3/LuaSnip", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-path", "hrsh7th/cmp-buffer",
|
||||
"saadparwaiz1/cmp_luasnip"}
|
||||
}},
|
||||
opts = {
|
||||
-- Automatically format on save
|
||||
autoformat = true,
|
||||
-- options for vim.lsp.buf.format
|
||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||
-- but can be also overridden when specified
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
timeout_ms = nil
|
||||
},
|
||||
-- LSP Server Settings
|
||||
servers = {
|
||||
jsonls = {},
|
||||
dockerls = {},
|
||||
bashls = {},
|
||||
gopls = {},
|
||||
ruff_lsp = {},
|
||||
vimls = {},
|
||||
yamlls = {}
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don"t want this server to be setup with lspconfig
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
-- tsserver = function(_, opts)
|
||||
-- require("typescript").setup({ server = opts })
|
||||
-- return true
|
||||
-- end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
local servers = opts.servers
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
-- local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities)
|
||||
}, servers[server] or {})
|
||||
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then
|
||||
return
|
||||
end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then
|
||||
return
|
||||
end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
|
||||
-- temp fix for lspconfig rename
|
||||
-- https://github.com/neovim/nvim-lspconfig/pull/2439
|
||||
local mappings = require("mason-lspconfig.mappings.server")
|
||||
if not mappings.lspconfig_to_package.lua_ls then
|
||||
mappings.lspconfig_to_package.lua_ls = "lua-language-server"
|
||||
mappings.package_to_lspconfig["lua-language-server"] = "lua_ls"
|
||||
end
|
||||
|
||||
|
||||
|
||||
local mlsp = require("mason-lspconfig")
|
||||
local available = mlsp.get_available_servers()
|
||||
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(available, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = ensure_installed,
|
||||
automatic_installation = true
|
||||
})
|
||||
require("mason-lspconfig").setup_handlers({setup})
|
||||
end
|
||||
}, {
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI"
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load {
|
||||
paths = vim.g.vscode_snippets_path or ""
|
||||
}
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load {
|
||||
paths = vim.g.snipmate_snippets_path or ""
|
||||
}
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load {
|
||||
paths = vim.g.lua_snippets_path or ""
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] and
|
||||
not require("luasnip").session.jump_active then
|
||||
require("luasnip").unlink_current()
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
},
|
||||
{"saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path"}}, -- cmp sources plugins
|
||||
opts = function()
|
||||
local cmp = require "cmp"
|
||||
|
||||
local function border(hl_name)
|
||||
return {{"╭", hl_name}, {"─", hl_name}, {"╮", hl_name}, {"│", hl_name}, {"╯", hl_name},
|
||||
{"─", hl_name}, {"╰", hl_name}, {"│", hl_name}}
|
||||
end
|
||||
|
||||
local options = {
|
||||
completion = {
|
||||
completeopt = "menu,menuone"
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
|
||||
scrollbar = false
|
||||
},
|
||||
documentation = {
|
||||
border = border "CmpDocBorder",
|
||||
winhighlight = "Normal:CmpDoc"
|
||||
}
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(
|
||||
vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"})
|
||||
},
|
||||
sources = {{
|
||||
name = "nvim_lsp"
|
||||
}, {
|
||||
name = "luasnip"
|
||||
}, {
|
||||
name = "buffer",
|
||||
option = {
|
||||
-- Avoid accidentally running on big files
|
||||
get_bufnrs = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
|
||||
if byte_size > 1024 * 1024 then -- 1 Megabyte max
|
||||
return {}
|
||||
end
|
||||
return {buf}
|
||||
end
|
||||
}
|
||||
}, {
|
||||
name = "nvim_lua"
|
||||
}, {
|
||||
name = "path"
|
||||
}}
|
||||
}
|
||||
|
||||
return options
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("cmp").setup(opts)
|
||||
end
|
||||
}}
|
@ -1,8 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
config = function()
|
||||
require("lsp_lines").setup()
|
||||
end,
|
||||
},
|
||||
}
|
317
neovim/.config/nvim/lua/plugins/lualine.lua
Normal file
317
neovim/.config/nvim/lua/plugins/lualine.lua
Normal file
@ -0,0 +1,317 @@
|
||||
return {{
|
||||
-- Statusline
|
||||
-- A blazing fast and easy to configure neovim statusline plugin written in pure lua.
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function(_)
|
||||
local lualine = require("lualine")
|
||||
local lualine_require = require("lualine_require")
|
||||
|
||||
function loadcolors()
|
||||
-- Rose-pine palette
|
||||
local rosepine = require("rose-pine.palette")
|
||||
local colors = {
|
||||
bg = rosepine.base,
|
||||
fg = rosepine.text,
|
||||
yellow = rosepine.gold,
|
||||
cyan = rosepine.foam,
|
||||
black = rosepine.subtled,
|
||||
green = rosepine.pine,
|
||||
white = rosepine.text,
|
||||
magenta = rosepine.iris,
|
||||
blue = rosepine.rose,
|
||||
red = rosepine.love
|
||||
}
|
||||
|
||||
-- Try to load pywal colors
|
||||
local modules = lualine_require.lazy_require {
|
||||
utils_notices = "lualine.utils.notices"
|
||||
}
|
||||
local sep = package.config:sub(1, 1)
|
||||
local wal_colors_path = table.concat({os.getenv("HOME"), ".cache", "wal", "colors.sh"}, sep)
|
||||
local wal_colors_file = io.open(wal_colors_path, "r")
|
||||
|
||||
if wal_colors_file == nil then
|
||||
modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " not found")
|
||||
return colors
|
||||
end
|
||||
|
||||
local ok, wal_colors_text = pcall(wal_colors_file.read, wal_colors_file, "*a")
|
||||
wal_colors_file:close()
|
||||
|
||||
if not ok then
|
||||
modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " could not be read: " ..
|
||||
wal_colors_text)
|
||||
return colors
|
||||
end
|
||||
|
||||
local wal = {}
|
||||
|
||||
for line in vim.gsplit(wal_colors_text, "\n") do
|
||||
if line:match("^[a-z0-9]+='#[a-fA-F0-9]+'$") ~= nil then
|
||||
local i = line:find("=")
|
||||
local key = line:sub(0, i - 1)
|
||||
local value = line:sub(i + 2, #line - 1)
|
||||
wal[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
-- Color table for highlights
|
||||
colors = {
|
||||
bg = wal.background,
|
||||
fg = wal.foreground,
|
||||
yellow = wal.color3,
|
||||
cyan = wal.color4,
|
||||
black = wal.color0,
|
||||
green = wal.color2,
|
||||
white = wal.color7,
|
||||
magenta = wal.color5,
|
||||
blue = wal.color6,
|
||||
red = wal.color1
|
||||
}
|
||||
|
||||
return colors
|
||||
end
|
||||
|
||||
local colors = loadcolors()
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand("%:p:h")
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
disabled_filetypes = {"Lazy", "NvimTree"},
|
||||
theme = {
|
||||
-- We are going to use lualine_c an lualine_x as left and
|
||||
-- right section. Both are highlighted by c theme . So we
|
||||
-- are just setting default looks o statusline
|
||||
normal = {
|
||||
c = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg
|
||||
}
|
||||
},
|
||||
inactive = {
|
||||
c = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {}
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {}
|
||||
}
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x ot right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
ins_left {
|
||||
-- mode component
|
||||
function()
|
||||
return "▶"
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[""] = colors.blue,
|
||||
V = colors.blue,
|
||||
c = colors.magenta,
|
||||
no = colors.red,
|
||||
s = colors.yellow,
|
||||
S = colors.yellow,
|
||||
[""] = colors.yellow,
|
||||
ic = colors.yellow,
|
||||
R = colors.white,
|
||||
Rv = colors.white,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.red,
|
||||
t = colors.red
|
||||
}
|
||||
return {
|
||||
fg = mode_color[vim.fn.mode()]
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
ins_left {
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = {
|
||||
fg = colors.magenta,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_left {
|
||||
"branch",
|
||||
icon = " ",
|
||||
color = {
|
||||
fg = colors.blue,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_left {
|
||||
"diff",
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " "
|
||||
},
|
||||
diff_color = {
|
||||
added = {
|
||||
fg = colors.green
|
||||
},
|
||||
modified = {
|
||||
fg = colors.yellow
|
||||
},
|
||||
removed = {
|
||||
fg = colors.red
|
||||
}
|
||||
},
|
||||
cond = conditions.hide_in_width
|
||||
}
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it"s any number greater then 2
|
||||
ins_left {function()
|
||||
return "%="
|
||||
end}
|
||||
|
||||
ins_right {
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = "null"
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
icon = " LSP:",
|
||||
color = {
|
||||
fg = colors.cyan,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"diagnostics",
|
||||
sources = {"nvim_diagnostic"},
|
||||
symbols = {
|
||||
error = " ",
|
||||
warn = " ",
|
||||
info = " ",
|
||||
hints = " ",
|
||||
},
|
||||
diagnostics_color = {
|
||||
color_error = {
|
||||
fg = colors.red
|
||||
},
|
||||
color_warn = {
|
||||
fg = colors.yellow
|
||||
},
|
||||
color_info = {
|
||||
fg = colors.cyan
|
||||
},
|
||||
color_hints = {
|
||||
fg = colors.magenta
|
||||
}
|
||||
},
|
||||
always_visible = true
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"o:encoding", -- option component same as &encoding in viml
|
||||
fmt = string.upper,
|
||||
cond = conditions.hide_in_width,
|
||||
color = {
|
||||
fg = colors.green,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"fileformat",
|
||||
fmt = string.upper,
|
||||
icons_enabled = true,
|
||||
color = {
|
||||
fg = colors.green,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"location",
|
||||
color = {
|
||||
fg = colors.fg,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"progress",
|
||||
color = {
|
||||
fg = colors.fg,
|
||||
gui = "bold"
|
||||
}
|
||||
}
|
||||
|
||||
-- Now don"t forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
end
|
||||
}}
|
12
neovim/.config/nvim/lua/plugins/neoterm.lua
Normal file
12
neovim/.config/nvim/lua/plugins/neoterm.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {{
|
||||
-- Floating terminal
|
||||
"itmecho/neoterm.nvim",
|
||||
opts = {
|
||||
clear_on_run = true, -- run clear command before user specified commands
|
||||
mode = "horizontal", -- vertical/horizontal/fullscreen
|
||||
noinsert = false -- disable entering insert mode when opening the neoterm window
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("neoterm").setup(opts)
|
||||
end
|
||||
}}
|
15
neovim/.config/nvim/lua/plugins/telescope.lua
Normal file
15
neovim/.config/nvim/lua/plugins/telescope.lua
Normal file
@ -0,0 +1,15 @@
|
||||
return {{
|
||||
-- Telescope
|
||||
-- Find, Filter, Preview, Pick. All lua, all the time.
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {"nvim-lua/plenary.nvim", {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make"
|
||||
}},
|
||||
config = function(_)
|
||||
require("telescope").setup()
|
||||
-- To get fzf loaded and working with telescope, you need to call
|
||||
-- load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension("fzf")
|
||||
end
|
||||
}}
|
87
neovim/.config/nvim/lua/plugins/tree.lua
Normal file
87
neovim/.config/nvim/lua/plugins/tree.lua
Normal file
@ -0,0 +1,87 @@
|
||||
return {{
|
||||
-- File explore
|
||||
-- nvim-tree.lua - A file explorer tree for neovim written in lua
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
lazy = true,
|
||||
opt = true
|
||||
},
|
||||
opts = {
|
||||
filters = {
|
||||
dotfiles = false
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
sync_root_with_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = false
|
||||
},
|
||||
view = {
|
||||
adaptive_size = false,
|
||||
side = "left",
|
||||
width = 30,
|
||||
preserve_window_proportions = true
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
ignore = true
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true
|
||||
}
|
||||
},
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
highlight_git = false,
|
||||
highlight_opened_files = "none",
|
||||
|
||||
indent_markers = {
|
||||
enable = false
|
||||
},
|
||||
|
||||
icons = {
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = false
|
||||
},
|
||||
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
arrow_open = "",
|
||||
arrow_closed = ""
|
||||
},
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
ignored = "◌"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-tree").setup(opts)
|
||||
end
|
||||
}}
|
56
neovim/.config/nvim/lua/plugins/treesitter.lua
Normal file
56
neovim/.config/nvim/lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,56 @@
|
||||
return {{
|
||||
-- Treesitter interface
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn"t work on Windows
|
||||
build = ":TSUpdate",
|
||||
dependencies = {{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||
local enabled = false
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({"move", "select", "swap", "lsp_interop"}) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
enabled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not enabled then
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end
|
||||
end
|
||||
}},
|
||||
opts = {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {"go", "python", "dockerfile", "json", "yaml", "markdown", "html", "scss", "css", "vim"},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
autotag = {
|
||||
enable = true
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = {
|
||||
enable = true
|
||||
},
|
||||
highlight_current_scope = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end
|
||||
}}
|
@ -1,3 +0,0 @@
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
Loading…
Reference in New Issue
Block a user