LazyVIM and some updated configurations
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
-- set colorscheme to nightfly with protected call
|
||||
-- in case it isn't installed
|
||||
local status, _ = pcall(vim.cmd, "colorscheme nightfly")
|
||||
if not status then
|
||||
print("Colorscheme not found!") -- print error if colorscheme not installed
|
||||
return
|
||||
end
|
||||
@@ -1,55 +0,0 @@
|
||||
-- set leader key to space
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
---------------------
|
||||
-- General Keymaps
|
||||
---------------------
|
||||
|
||||
-- use jk to exit insert mode
|
||||
keymap.set("i", "jk", "<ESC>")
|
||||
|
||||
-- clear search highlights
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>")
|
||||
|
||||
-- delete single character without copying into register
|
||||
keymap.set("n", "x", '"_x')
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>") -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>") -- decrement
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v") -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s") -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=") -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", ":close<CR>") -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", ":tabnew<CR>") -- open new tab
|
||||
keymap.set("n", "<leader>tx", ":tabclose<CR>") -- close current tab
|
||||
keymap.set("n", "<leader>tn", ":tabn<CR>") -- go to next tab
|
||||
keymap.set("n", "<leader>tp", ":tabp<CR>") -- go to previous tab
|
||||
|
||||
----------------------
|
||||
-- Plugin Keybinds
|
||||
----------------------
|
||||
|
||||
-- vim-maximizer
|
||||
keymap.set("n", "<leader>sm", ":MaximizerToggle<CR>") -- toggle split window maximization
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>") -- toggle file explorer
|
||||
|
||||
-- telescope
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance
|
||||
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags
|
||||
|
||||
-- telescope git commands
|
||||
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>") -- list all git commits (use <cr> to checkout) ["gc" for git commits]
|
||||
keymap.set("n", "<leader>gfc", "<cmd>Telescope git_bcommits<cr>") -- list git commits for current file/buffer (use <cr> to checkout) ["gfc" for git file commits]
|
||||
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>") -- list git branches (use <cr> to checkout) ["gb" for git branch]
|
||||
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>") -- list current changes per file with diff preview ["gs" for git status]
|
||||
@@ -1,41 +0,0 @@
|
||||
local opt = vim.opt -- for conciseness
|
||||
|
||||
-- line numbers
|
||||
opt.relativenumber = true -- show relative line numbers
|
||||
opt.number = true -- shows absolute line number on cursor line (when relative number is on)
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||
opt.shiftwidth = 2 -- 2 spaces for indent width
|
||||
opt.expandtab = true -- expand tab to spaces
|
||||
opt.autoindent = true -- copy indent from current line when starting new one
|
||||
|
||||
-- line wrapping
|
||||
opt.wrap = false -- disable line wrapping
|
||||
|
||||
-- search settings
|
||||
opt.ignorecase = true -- ignore case when searching
|
||||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
||||
|
||||
-- cursor line
|
||||
opt.cursorline = true -- highlight the current cursor line
|
||||
|
||||
-- appearance
|
||||
|
||||
-- turn on termguicolors for nightfly colorscheme to work
|
||||
-- (have to use iterm2 or any other true color terminal)
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||
opt.signcolumn = "yes" -- show sign column so that text doesn't shift
|
||||
|
||||
-- backspace
|
||||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
|
||||
|
||||
-- clipboard
|
||||
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
||||
|
||||
-- split windows
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
opt.iskeyword:append("-") -- consider string-string as whole word
|
||||
@@ -1,109 +0,0 @@
|
||||
-- auto install packer if not installed
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer() -- true if packer was just installed
|
||||
|
||||
-- autocommand that reloads neovim and installs/updates/removes plugins
|
||||
-- when file is saved
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- import packer safely
|
||||
local status, packer = pcall(require, "packer")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- add list of plugins to install
|
||||
return packer.startup(function(use)
|
||||
-- packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
use("nvim-lua/plenary.nvim") -- lua functions that many plugins use
|
||||
|
||||
use("bluz71/vim-nightfly-guicolors") -- preferred colorscheme
|
||||
|
||||
use("christoomey/vim-tmux-navigator") -- tmux & split window navigation
|
||||
|
||||
use("szw/vim-maximizer") -- maximizes and restores current window
|
||||
|
||||
-- essential plugins
|
||||
use("tpope/vim-surround") -- add, delete, change surroundings (it's awesome)
|
||||
use("inkarkat/vim-ReplaceWithRegister") -- replace with register contents using motion (gr + motion)
|
||||
|
||||
-- commenting with gc
|
||||
use("numToStr/Comment.nvim")
|
||||
|
||||
-- file explorer
|
||||
use("nvim-tree/nvim-tree.lua")
|
||||
|
||||
-- vs-code like icons
|
||||
use("nvim-tree/nvim-web-devicons")
|
||||
|
||||
-- statusline
|
||||
use("nvim-lualine/lualine.nvim")
|
||||
|
||||
-- fuzzy finding w/ telescope
|
||||
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) -- dependency for better sorting performance
|
||||
use({ "nvim-telescope/telescope.nvim", tag = "0.1.0" }) -- fuzzy finder
|
||||
|
||||
-- autocompletion
|
||||
use("hrsh7th/nvim-cmp") -- completion plugin
|
||||
use("hrsh7th/cmp-buffer") -- source for text in buffer
|
||||
use("hrsh7th/cmp-path") -- source for file system paths
|
||||
|
||||
-- snippets
|
||||
use("L3MON4D3/LuaSnip") -- snippet engine
|
||||
use("saadparwaiz1/cmp_luasnip") -- for autocompletion
|
||||
use("rafamadriz/friendly-snippets") -- useful snippets
|
||||
|
||||
-- managing & installing lsp servers, linters & formatters
|
||||
use("williamboman/mason.nvim") -- in charge of managing lsp servers, linters & formatters
|
||||
use("williamboman/mason-lspconfig.nvim") -- bridges gap b/w mason & lspconfig
|
||||
|
||||
-- configuring lsp servers
|
||||
use("neovim/nvim-lspconfig") -- easily configure language servers
|
||||
use("hrsh7th/cmp-nvim-lsp") -- for autocompletion
|
||||
use({ "glepnir/lspsaga.nvim", branch = "main" }) -- enhanced lsp uis
|
||||
use("jose-elias-alvarez/typescript.nvim") -- additional functionality for typescript server (e.g. rename file & update imports)
|
||||
use("onsails/lspkind.nvim") -- vs-code like icons for autocompletion
|
||||
|
||||
-- formatting & linting
|
||||
use("jose-elias-alvarez/null-ls.nvim") -- configure formatters & linters
|
||||
use("jayp0521/mason-null-ls.nvim") -- bridges gap b/w mason & null-ls
|
||||
|
||||
-- treesitter configuration
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = function()
|
||||
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
|
||||
ts_update()
|
||||
end,
|
||||
})
|
||||
|
||||
-- auto closing
|
||||
use("windwp/nvim-autopairs") -- autoclose parens, brackets, quotes, etc...
|
||||
use({ "windwp/nvim-ts-autotag", after = "nvim-treesitter" }) -- autoclose tags
|
||||
|
||||
-- git integration
|
||||
use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side
|
||||
|
||||
-- discord rpc
|
||||
use("andweeb/presence.nvim")
|
||||
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
@@ -1,29 +0,0 @@
|
||||
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not autopairs_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure autopairs
|
||||
autopairs.setup({
|
||||
check_ts = true, -- enable treesitter
|
||||
ts_config = {
|
||||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
})
|
||||
|
||||
-- import nvim-autopairs completion functionality safely
|
||||
local cmp_autopairs_setup, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not cmp_autopairs_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- import nvim-cmp plugin safely (completions plugin)
|
||||
local cmp_setup, cmp = pcall(require, "cmp")
|
||||
if not cmp_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
@@ -1,8 +0,0 @@
|
||||
-- import comment
|
||||
local setup, comment = pcall(require, "Comment")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- enable comment
|
||||
comment.setup()
|
||||
@@ -1,23 +0,0 @@
|
||||
require("presence"):setup({
|
||||
-- General options
|
||||
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
|
||||
neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
|
||||
main_image = "neovim", -- Main image display (either "neovim" or "file")
|
||||
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
|
||||
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
||||
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||
enable_line_number = false, -- Displays the current line number instead of the current project
|
||||
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
|
||||
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
||||
show_time = true, -- Show the timer
|
||||
|
||||
-- Rich Presence text options
|
||||
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
|
||||
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
|
||||
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
|
||||
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
|
||||
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
-- import gitsigns plugin safely
|
||||
local setup, gitsigns = pcall(require, "gitsigns")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure/enable gitsigns
|
||||
gitsigns.setup()
|
||||
@@ -1,111 +0,0 @@
|
||||
-- import lspconfig plugin safely
|
||||
local lspconfig_status, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import cmp-nvim-lsp plugin safely
|
||||
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not cmp_nvim_lsp_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import typescript plugin safely
|
||||
local typescript_setup, typescript = pcall(require, "typescript")
|
||||
if not typescript_setup then
|
||||
return
|
||||
end
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- enable keybinds only for when lsp server available
|
||||
local on_attach = function(client, bufnr)
|
||||
-- keybind options
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
-- set keybinds
|
||||
keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references
|
||||
keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration
|
||||
keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
|
||||
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
|
||||
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
|
||||
keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
|
||||
keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
|
||||
keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor
|
||||
keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer
|
||||
keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer
|
||||
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
|
||||
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
|
||||
|
||||
-- typescript specific keymaps (e.g. rename file and update imports)
|
||||
if client.name == "tsserver" then
|
||||
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports
|
||||
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video)
|
||||
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video)
|
||||
end
|
||||
end
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
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
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
typescript.setup({
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
},
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = { -- custom settings for lua
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,44 +0,0 @@
|
||||
-- import mason plugin safely
|
||||
local mason_status, mason = pcall(require, "mason")
|
||||
if not mason_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import mason-lspconfig plugin safely
|
||||
local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not mason_lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import mason-null-ls plugin safely
|
||||
local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not mason_null_ls_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- enable mason
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"emmet_ls",
|
||||
},
|
||||
-- auto-install configured servers (with lspconfig)
|
||||
automatic_installation = true, -- not the same as ensure_installed
|
||||
})
|
||||
|
||||
mason_null_ls.setup({
|
||||
-- list of formatters & linters for mason to install
|
||||
ensure_installed = {
|
||||
"prettier", -- ts/js formatter
|
||||
"stylua", -- lua formatter
|
||||
"eslint_d", -- ts/js linter
|
||||
},
|
||||
-- auto-install configured formatters & linters (with null-ls)
|
||||
automatic_installation = true,
|
||||
})
|
||||
@@ -1,48 +0,0 @@
|
||||
-- import null-ls plugin safely
|
||||
local setup, null_ls = pcall(require, "null-ls")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- for conciseness
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
|
||||
-- to setup format on save
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
-- configure null_ls
|
||||
null_ls.setup({
|
||||
-- setup formatters & linters
|
||||
sources = {
|
||||
-- to disable file types use
|
||||
-- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs)
|
||||
formatting.prettier, -- js/ts formatter
|
||||
formatting.stylua, -- lua formatter
|
||||
diagnostics.eslint_d.with({ -- js/ts linter
|
||||
-- only enable eslint if root has .eslintrc.js (not in youtube nvim video)
|
||||
condition = function(utils)
|
||||
return utils.root_has_file(".eslintrc.js") -- change file extension if you use something else
|
||||
end,
|
||||
}),
|
||||
},
|
||||
-- configure format on save
|
||||
on_attach = function(current_client, bufnr)
|
||||
if current_client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
-- only use null-ls for formatting instead of lsp server
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
-- import lualine plugin safely
|
||||
local status, lualine = pcall(require, "lualine")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- get lualine nightfly theme
|
||||
local lualine_nightfly = require("lualine.themes.nightfly")
|
||||
|
||||
-- new colors for theme
|
||||
local new_colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
black = "#000000",
|
||||
}
|
||||
|
||||
-- change nightlfy theme colors
|
||||
lualine_nightfly.normal.a.bg = new_colors.blue
|
||||
lualine_nightfly.insert.a.bg = new_colors.green
|
||||
lualine_nightfly.visual.a.bg = new_colors.violet
|
||||
lualine_nightfly.command = {
|
||||
a = {
|
||||
gui = "bold",
|
||||
bg = new_colors.yellow,
|
||||
fg = new_colors.black, -- black
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = lualine_nightfly,
|
||||
},
|
||||
})
|
||||
@@ -1,53 +0,0 @@
|
||||
-- import nvim-cmp plugin safely
|
||||
local cmp_status, cmp = pcall(require, "cmp")
|
||||
if not cmp_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import luasnip plugin safely
|
||||
local luasnip_status, luasnip = pcall(require, "luasnip")
|
||||
if not luasnip_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import lspkind plugin safely
|
||||
local lspkind_status, lspkind = pcall(require, "lspkind")
|
||||
if not lspkind_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- lsp
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
-- configure lspkind for vs-code like icons
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
@@ -1,35 +0,0 @@
|
||||
-- import nvim-tree plugin safely
|
||||
local setup, nvimtree = pcall(require, "nvim-tree")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- settings passed of nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- colorscheme for arrows in tree to a light blue
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
|
||||
-- config nvim-tree
|
||||
nvimtree.setup({
|
||||
-- folder arrow icons
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = " ",
|
||||
arrow_open = " ",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- no window_picker for explorer
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,26 +0,0 @@
|
||||
-- import telescope
|
||||
local telescope_setup, telescope = pcall(require, "telescope")
|
||||
if not telescope_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- import teleport actions
|
||||
local actions_setup, actions = pcall(require, "telescope.actions")
|
||||
if not actions_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- config
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
@@ -1,37 +0,0 @@
|
||||
-- import nvim-treesitter plugin safely
|
||||
local status, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure treesitter
|
||||
treesitter.setup({
|
||||
-- enable syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
-- enable indentation
|
||||
indent = { enable = true },
|
||||
-- enable autotagging (w/ nvim-ts-autotag plugin)
|
||||
autotag = { enable = true },
|
||||
-- ensure these language parsers are installed
|
||||
ensure_installed = {
|
||||
"json",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"yaml",
|
||||
"html",
|
||||
"css",
|
||||
"markdown",
|
||||
"svelte",
|
||||
"graphql",
|
||||
"bash",
|
||||
"lua",
|
||||
"vim",
|
||||
"dockerfile",
|
||||
"gitignore",
|
||||
},
|
||||
-- auto install above language parsers
|
||||
auto_install = true,
|
||||
})
|
||||
18
nvim/lua/config/autocmds.lua
Normal file
18
nvim/lua/config/autocmds.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- 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
|
||||
|
||||
-- turn off paste mode when leaving insert
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = "*",
|
||||
command = "set nopaste",
|
||||
})
|
||||
|
||||
-- fix conceallevel for json files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "json", "jsonc" },
|
||||
callback = function()
|
||||
vim.wo.spell = false
|
||||
vim.wo.conceallevel = 0
|
||||
end,
|
||||
})
|
||||
162
nvim/lua/config/keymaps.lua
Normal file
162
nvim/lua/config/keymaps.lua
Normal file
@@ -0,0 +1,162 @@
|
||||
-- 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
|
||||
|
||||
-- local discipline = require("jeremydwayne.discipline")
|
||||
-- discipline.cowboy()
|
||||
|
||||
local keymap = vim.keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Increment/Decrement
|
||||
keymap.set("n", "+", "<C-a")
|
||||
keymap.set("n", "-", "<C-x")
|
||||
|
||||
-- delete word backwards
|
||||
keymap.set("n", "dw", "vb_d")
|
||||
|
||||
-- select all
|
||||
keymap.set("n", "<C-a>", "gg<S-v>G")
|
||||
|
||||
-- jumplist
|
||||
keymap.set("n", "<C-m>", "<C-i>", opts)
|
||||
|
||||
-- New Tab
|
||||
keymap.set("n", "te", ":tabedit<Return>", opts)
|
||||
-- keymap.set("n", "<tab>", ":tabnext<Return>", opts)
|
||||
-- keymap.set("n", "<s-tab>", ":tabprev<Return>", opts)
|
||||
-- keymap.set("n", "<leader>bd", ":bd<Return>", opts)
|
||||
|
||||
-- Split window
|
||||
keymap.set("n", "<leader>ss", ":split<Return>", opts)
|
||||
keymap.set("n", "<leader>sv", ":vsplit<Return>", opts)
|
||||
|
||||
-- Move window
|
||||
keymap.set("n", "<leader>sh", "<C-w>h")
|
||||
keymap.set("n", "<leader>sk", "<C-w>k")
|
||||
keymap.set("n", "<leader>sj", "<C-w>j")
|
||||
keymap.set("n", "<leader>sl", "<C-w>l")
|
||||
|
||||
-- Resize window
|
||||
keymap.set("n", "<C-w><left>", "<C-w><")
|
||||
keymap.set("n", "<C-w><right>", "<C-w>>")
|
||||
keymap.set("n", "<C-w><up>", "<C-w>+")
|
||||
keymap.set("n", "<C-w><down>", "<C-w>-")
|
||||
|
||||
-- Diagnostics
|
||||
keymap.set("n", "<C-j>", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end, opts)
|
||||
keymap.set("n", "<C-f>", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end, opts)
|
||||
|
||||
keymap.set("n", ":W", vim.cmd.w)
|
||||
keymap.set("n", ":Wq", vim.cmd.wq)
|
||||
keymap.set("n", ":Q", vim.cmd.q)
|
||||
keymap.set("n", "<leader>so", vim.cmd.so)
|
||||
keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
keymap.set("n", "<leader>bd", "<cmd>bd!<cr>")
|
||||
|
||||
-- option key movement on macos
|
||||
keymap.set("n", "∆", ":m .+1<CR>==")
|
||||
keymap.set("n", "˚", ":m .-2<CR>==")
|
||||
keymap.set("i", "∆", "<Esc>:m .+1<CR>==gi")
|
||||
keymap.set("i", "˚", "<Esc>:m .-2<CR>==gi")
|
||||
keymap.set("v", "∆", ":m '>+1<CR>gv=gv")
|
||||
keymap.set("v", "˚", ":m '<-2<CR>gv=gv")
|
||||
-- alt key movement
|
||||
keymap.set("n", "<A-j>", ":m .+1<CR>==")
|
||||
keymap.set("n", "<A-k>", ":m .-2<CR>==")
|
||||
keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
|
||||
keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
|
||||
keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
keymap.set("n", "J", "mzJ`z")
|
||||
keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
keymap.set("n", "n", "nzzzv")
|
||||
keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- system yank and paste
|
||||
keymap.set("x", "<leader>p", '"_dP')
|
||||
keymap.set("n", "<leader>y", '"+y')
|
||||
keymap.set("v", "<leader>y", '"+y')
|
||||
keymap.set("n", "<leader>Y", '"+Y')
|
||||
|
||||
keymap.set("n", "<leader>d", '"_d')
|
||||
keymap.set("v", "<leader>d", '"_d')
|
||||
|
||||
-- escape vertical edit mode gracefully
|
||||
keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
keymap.set("n", "Q", "<nop>")
|
||||
|
||||
-- search for word cursor is on
|
||||
keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
|
||||
|
||||
-- make current file executable (shell scripts)
|
||||
keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
|
||||
-- bufferline tabs
|
||||
keymap.set("n", "<S-l>", "<cmd>BufferLineCycleNext<CR>")
|
||||
keymap.set("n", "<S-h>", "<cmd>BufferLineCyclePrev<CR>")
|
||||
keymap.set("n", "<leader>bn", "<cmd>BufferLineMoveNext<CR>")
|
||||
keymap.set("n", "<leader>bp", "<cmd>BufferLineMovePrev<CR>")
|
||||
|
||||
keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
|
||||
keymap.set("n", "<C-n>", "<cmd>Neotree toggle reveal<CR>")
|
||||
|
||||
-- nvim dap
|
||||
keymap.set("n", "<leader>db", "<cmd> DapToggleBreakpoint <CR>")
|
||||
keymap.set("n", "<leader>dus", function()
|
||||
local widgets = require("dap.ui.widgets")
|
||||
local sidebar = widgets.sidebar(widgets.scopes)
|
||||
sidebar.open()
|
||||
end)
|
||||
-- dap-go
|
||||
keymap.set("n", "<leader>dgt", function()
|
||||
require("dap-go").debug_test()
|
||||
end)
|
||||
keymap.set("n", "<leader>dgl", function()
|
||||
require("dap-go").debug_last()
|
||||
end)
|
||||
|
||||
-- gopher
|
||||
keymap.set("n", "<leader>gsj", "<cmd> GoTagAdd json<CR>")
|
||||
keymap.set("n", "<leader>ger", "<cmd> GoIfErr<CR>")
|
||||
keymap.set("n", "<leader>gtg", "<cmd> GoTestsAll<CR>")
|
||||
|
||||
keymap.set("n", "<leader>rn", ":IncRename ")
|
||||
|
||||
-- Refactoring
|
||||
keymap.set("x", "<leader>re", function()
|
||||
require("refactoring").refactor("Extract Function")
|
||||
end)
|
||||
keymap.set("x", "<leader>rf", function()
|
||||
require("refactoring").refactor("Extract Function To File")
|
||||
end)
|
||||
-- Extract function supports only visual mode
|
||||
keymap.set("x", "<leader>rv", function()
|
||||
require("refactoring").refactor("Extract Variable")
|
||||
end)
|
||||
-- Extract variable supports only visual mode
|
||||
keymap.set("n", "<leader>rI", function()
|
||||
require("refactoring").refactor("Inline Function")
|
||||
end)
|
||||
-- Inline func supports only normal
|
||||
keymap.set({ "n", "x" }, "<leader>ri", function()
|
||||
require("refactoring").refactor("Inline Variable")
|
||||
end)
|
||||
-- Inline var supports both normal and visual mode
|
||||
|
||||
keymap.set("n", "<leader>rb", function()
|
||||
require("refactoring").refactor("Extract Block")
|
||||
end)
|
||||
keymap.set("n", "<leader>rbf", function()
|
||||
require("refactoring").refactor("Extract Block To File")
|
||||
end)
|
||||
-- Extract block supports only normal mode
|
||||
64
nvim/lua/config/lazy.lua
Normal file
64
nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not 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(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
import = "lazyvim.plugins",
|
||||
opts = {
|
||||
colorscheme = "vscode",
|
||||
news = {
|
||||
lazyvim = true,
|
||||
neovim = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- import any extras modules here
|
||||
{ import = "lazyvim.plugins.extras.linting.eslint" },
|
||||
{ import = "lazyvim.plugins.extras.formatting.prettier" },
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
{ import = "lazyvim.plugins.extras.lang.tailwind" },
|
||||
{ import = "lazyvim.plugins.extras.lang.go" },
|
||||
{ import = "lazyvim.plugins.extras.lang.ruby" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{ import = "lazyvim.plugins.extras.coding.copilot" },
|
||||
{ import = "lazyvim.plugins.extras.util.mini-hipatterns" },
|
||||
-- { 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",
|
||||
"rplugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
7
nvim/lua/config/options.lua
Normal file
7
nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- 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
|
||||
|
||||
-- Undercurl
|
||||
vim.cmd([[let &t_Cs = "\e[4:3m"]])
|
||||
vim.cmd([[let &t_Ce = "\e[4:0m"]])
|
||||
25
nvim/lua/plugins/cmp.lua
Normal file
25
nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<C-Space>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
["<CR>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
})
|
||||
end,
|
||||
}
|
||||
5
nvim/lua/plugins/coding.lua
Normal file
5
nvim/lua/plugins/coding.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
config = true,
|
||||
}
|
||||
12
nvim/lua/plugins/colorscheme.lua
Normal file
12
nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
{
|
||||
"Mofiqul/vscode.nvim",
|
||||
lazy = true,
|
||||
priority = 1000,
|
||||
opts = function()
|
||||
return {
|
||||
transparent = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
4
nvim/lua/plugins/disabled.lua
Normal file
4
nvim/lua/plugins/disabled.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
{ "folke/flash.nvim", enabled = false },
|
||||
{ "folke/which-key.nvim", enabled = false },
|
||||
}
|
||||
142
nvim/lua/plugins/editor.lua
Normal file
142
nvim/lua/plugins/editor.lua
Normal file
@@ -0,0 +1,142 @@
|
||||
return {
|
||||
"telescope.nvim",
|
||||
dependencies = { "nvim-telescope/telescope-file-browser.nvim" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>fP",
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = require("lazy.core.config").options.root,
|
||||
})
|
||||
end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
{
|
||||
";f",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.find_files({
|
||||
no_ignore = false,
|
||||
hidden = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
";r",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.live_grep()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"\\\\",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.buffers()
|
||||
end,
|
||||
},
|
||||
{
|
||||
";t",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.help_tags()
|
||||
end,
|
||||
},
|
||||
{
|
||||
";;",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.resume()
|
||||
end,
|
||||
},
|
||||
{
|
||||
";e",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.diagnostics()
|
||||
end,
|
||||
},
|
||||
{
|
||||
";s",
|
||||
function()
|
||||
local builtin = require("telescope.builtin")
|
||||
builtin.treesitter()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"fb",
|
||||
function()
|
||||
local telescope = require("telescope")
|
||||
local function telescope_buffer_dir()
|
||||
return vim.fn.expand("%:p:h")
|
||||
end
|
||||
telescope.extensions.file_browser.file_browser({
|
||||
path = "%:p:h",
|
||||
cwd = telescope_buffer_dir(),
|
||||
respect_gitignore = false,
|
||||
hidden = true,
|
||||
grouped = true,
|
||||
previewer = false,
|
||||
initial_mode = "normal",
|
||||
layout_config = { height = 40 },
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
local fb_actions = require("telescope").extensions.file_browser.actions
|
||||
|
||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
|
||||
wrap_results = true,
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
mappings = {
|
||||
n = {},
|
||||
},
|
||||
})
|
||||
|
||||
opts.pickers = {
|
||||
diagnostics = {
|
||||
theme = "ivy",
|
||||
initial_mode = "normal",
|
||||
layout_config = { preview_cutoff = 9999 },
|
||||
},
|
||||
}
|
||||
|
||||
opts.extensions = {
|
||||
file_browser = {
|
||||
theme = "dropdown",
|
||||
hijack_netrw = true,
|
||||
mappings = {
|
||||
["n"] = {
|
||||
-- custom normal mode mappings
|
||||
["a"] = fb_actions.create,
|
||||
["h"] = fb_actions.goto_parent_dir,
|
||||
["/"] = function()
|
||||
vim.cmd("startinsert")
|
||||
end,
|
||||
["<C-u>"] = function(prompt_bufnr)
|
||||
for i = 1, 10 do
|
||||
actions.move_selection_previous(prompt_bufnr)
|
||||
end
|
||||
end,
|
||||
["<C-d>"] = function(prompt_bufnr)
|
||||
for i = 1, 10 do
|
||||
actions.move_selection_next(prompt_bufnr)
|
||||
end
|
||||
end,
|
||||
["<PageUp>"] = actions.preview_scrolling_up,
|
||||
["<PageDown>"] = actions.preview_scrolling_down,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
telescope.setup(opts)
|
||||
require("telescope").load_extension("fzf")
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
}
|
||||
276
nvim/lua/plugins/example.lua
Normal file
276
nvim/lua/plugins/example.lua
Normal file
@@ -0,0 +1,276 @@
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- add symbols-outline
|
||||
{
|
||||
"simrat39/symbols-outline.nvim",
|
||||
cmd = "SymbolsOutline",
|
||||
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add telescope-fzf-native
|
||||
{
|
||||
"telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Use <tab> for completion and snippets (supertab)
|
||||
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
keys = function()
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
-- then: setup supertab in cmp
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||
-- this way you will only jump inside the snippet region
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<CR>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
6
nvim/lua/plugins/gitsigns.lua
Normal file
6
nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
_extmark_signs = false,
|
||||
},
|
||||
}
|
||||
19
nvim/lua/plugins/lsp.lua
Normal file
19
nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"stylua",
|
||||
"selene",
|
||||
"luacheck",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"tailwindcss-language-server",
|
||||
"typescript-language-server",
|
||||
"css-lsp",
|
||||
"solargraph",
|
||||
"gopls",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
nvim/lua/plugins/nvim-notify.lua
Normal file
8
nvim/lua/plugins/nvim-notify.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"rcarriga/nvim-notify",
|
||||
config = function(_, opts)
|
||||
require("notify").setup(vim.tbl_extend("keep", {
|
||||
background_colour = "#000000",
|
||||
}, opts))
|
||||
end,
|
||||
}
|
||||
11
nvim/lua/plugins/refactoring.lua
Normal file
11
nvim/lua/plugins/refactoring.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
lazy_load = true,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("refactoring").setup()
|
||||
end,
|
||||
}
|
||||
34
nvim/lua/plugins/treesitter.lua
Normal file
34
nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"astro",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"fish",
|
||||
"gitignore",
|
||||
"go",
|
||||
"graphql",
|
||||
"http",
|
||||
"java",
|
||||
"php",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"svelte",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
mdx = "markdown",
|
||||
},
|
||||
})
|
||||
vim.treesitter.language.register("markdown", "mdx")
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
nvim/lua/plugins/twilight.lua
Normal file
8
nvim/lua/plugins/twilight.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"folke/twilight.nvim",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
}
|
||||
85
nvim/lua/plugins/ui.lua
Normal file
85
nvim/lua/plugins/ui.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
return {
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.routes, {
|
||||
filter = {
|
||||
event = "notify",
|
||||
find = "No information available",
|
||||
},
|
||||
skip = true,
|
||||
})
|
||||
opts.presets.lsp_doc_border = true
|
||||
end,
|
||||
},
|
||||
-- animations
|
||||
{
|
||||
"echasnovski/mini.animate",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
opts.scroll = {
|
||||
enable = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
options = {
|
||||
-- globalstatus = false,
|
||||
theme = "vscode",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- filename
|
||||
{
|
||||
"b0o/incline.nvim",
|
||||
dependencies = { "craftzdog/solarized-osaka.nvim" },
|
||||
event = "BufReadPre",
|
||||
priority = 1200,
|
||||
config = function()
|
||||
local colors = require("solarized-osaka.colors").setup()
|
||||
require("incline").setup({
|
||||
highlight = {
|
||||
groups = {
|
||||
InclineNormal = { guibg = colors.violet700, guifg = colors.base04 },
|
||||
InclineNormalNC = { guifg = colors.violet500, guibg = colors.base03 },
|
||||
},
|
||||
},
|
||||
window = { margin = { vertical = 0, horizontal = 1 } },
|
||||
hide = {
|
||||
cursorline = true,
|
||||
},
|
||||
render = function(props)
|
||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||
if vim.bo[props.buf].modified then
|
||||
filename = "[+] " .. filename
|
||||
end
|
||||
|
||||
local icon, color = require("nvim-web-devicons").get_icon_color(filename)
|
||||
return { { icon, guifg = color }, { " " }, { filename } }
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
opts = function(_, opts)
|
||||
local logo = [[
|
||||
██████╗ ██╗ █████╗ ██╗ ██╗███████╗ ██████╗ ██╗██████╗ ██████╗ ██╗ ██╗ █████╗ ██╗ ██╗
|
||||
██╔══██╗██║ ██╔══██╗██║ ██╔╝██╔════╝ ██╔══██╗██║██╔══██╗██╔════╝ ██║ ██║██╔══██╗╚██╗ ██╔╝
|
||||
██████╔╝██║ ███████║█████╔╝ █████╗ ██████╔╝██║██║ ██║██║ ███╗██║ █╗ ██║███████║ ╚████╔╝
|
||||
██╔══██╗██║ ██╔══██║██╔═██╗ ██╔══╝ ██╔══██╗██║██║ ██║██║ ██║██║███╗██║██╔══██║ ╚██╔╝
|
||||
██████╔╝███████╗██║ ██║██║ ██╗███████╗ ██║ ██║██║██████╔╝╚██████╔╝╚███╔███╔╝██║ ██║ ██║
|
||||
╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝
|
||||
]]
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
opts.config.header = vim.split(logo, "\n")
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
nvim/lua/plugins/zen.lua
Normal file
8
nvim/lua/plugins/zen.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"folke/zen-mode.nvim",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user