initial commit
This commit is contained in:
commit
63694deb4f
16 changed files with 508 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
1
init.lua
Normal file
1
init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("nyanko")
|
23
lazy-lock.json
Normal file
23
lazy-lock.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "9238947645ce17d96f30842e61ba81147185b657" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "7e0fcf0d456fc5818da1af35b1a3f5c784fce457" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" }
|
||||
}
|
7
lua/nyanko/init.lua
Normal file
7
lua/nyanko/init.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- set leader key
|
||||
-- this has to happen before plugins load or it won't work
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
require("nyanko.opt")
|
||||
require("nyanko.lazy_init")
|
8
lua/nyanko/lazy/catppuccin.lua
Normal file
8
lua/nyanko/lazy/catppuccin.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
init = function()
|
||||
vim.cmd.colorscheme("catppuccin-mocha")
|
||||
end,
|
||||
}
|
85
lua/nyanko/lazy/cmp.lua
Normal file
85
lua/nyanko/lazy/cmp.lua
Normal file
|
@ -0,0 +1,85 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = (function()
|
||||
-- build step is needed for regex support
|
||||
-- this fails on windows a lot of the time
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
luasnip.config.setup({})
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- select the [n]ext item
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
-- select the [p]revious item
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- scroll the documentation window [b]ack or [f]orward
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
-- accept ([y]es) the completion
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
|
||||
-- manually trigger a completion from nvim-cmp
|
||||
-- you shouldn't need this, nvim-cmp will display completions
|
||||
-- whenever it has options available
|
||||
["<C-space>"] = cmp.mapping.complete({}),
|
||||
|
||||
-- move forward or backward through the snippet expansion
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{
|
||||
name = "lazydev",
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
47
lua/nyanko/lazy/conform.lua
Normal file
47
lua/nyanko/lazy/conform.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({
|
||||
async = true,
|
||||
lsp_format = "fallback",
|
||||
})
|
||||
end,
|
||||
mode = "",
|
||||
desc = "[F]ormat buffer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = {
|
||||
c = true,
|
||||
cpp = true,
|
||||
}
|
||||
|
||||
local lsp_format_opt
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
lsp_format_opt = "never"
|
||||
else
|
||||
lsp_format_opt = "fallback"
|
||||
end
|
||||
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = lsp_format_opt,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettierd" },
|
||||
javascriptreact = { "prettierd" },
|
||||
typescript = { "prettierd" },
|
||||
typescriptreact = { "prettierd" },
|
||||
json = { "prettierd" },
|
||||
},
|
||||
},
|
||||
}
|
18
lua/nyanko/lazy/lazydev.lua
Normal file
18
lua/nyanko/lazy/lazydev.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
{
|
||||
path = "luvit-meta/library",
|
||||
words = { "vim%.uv" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"Bilal2453/luvit-meta",
|
||||
lazy = true,
|
||||
},
|
||||
}
|
144
lua/nyanko/lazy/lspconfig.lua
Normal file
144
lua/nyanko/lazy/lspconfig.lua
Normal file
|
@ -0,0 +1,144 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
|
||||
-- useful LSP status updates
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("nyanko-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
-- highlight references of the word under cursor
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup("nyanko-lsp-highlight", { clear = false })
|
||||
|
||||
vim.api.nvim_create_autocmd({
|
||||
"CursorHold",
|
||||
"CursorHoldI",
|
||||
}, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({
|
||||
"CursorMoved",
|
||||
"CursorMovedI",
|
||||
}, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspDetach", {
|
||||
group = vim.api.nvim_create_augroup("nyanko-lsp-detach", { clear = true }),
|
||||
callback = function(detach_event)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = "nyanko-lsp-highlight",
|
||||
buffer = detach_event.buf,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
html = {},
|
||||
cssls = {},
|
||||
eslint = {
|
||||
settings = {
|
||||
workingDirectories = { mode = "auto" },
|
||||
},
|
||||
},
|
||||
jsonls = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = {
|
||||
{
|
||||
fileMatch = { "package.json" },
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "tsconfig*.json" },
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { ".prettierrc", ".prettierrc.json" },
|
||||
url = "https://json.schemastore.org/prettierrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { ".eslintrc", ".eslintrc.json" },
|
||||
url = "https//json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ts_ls = {},
|
||||
tailwindcss = {
|
||||
settings = {
|
||||
tailwindCSS = {
|
||||
experimental = {
|
||||
classRegex = {
|
||||
"tw`([^`]*)",
|
||||
'tw="([^"]*)',
|
||||
'tw={"([^"}]*)',
|
||||
"tw\\.\\w+`([^`]*)",
|
||||
"tw\\(.*?\\)`([^`]*)",
|
||||
{ "clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" },
|
||||
{ "classnames\\(([^)]*)\\)", "'([^']*)'" },
|
||||
{ "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" },
|
||||
{ "cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("mason").setup()
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
"stylua", -- used to format lua code
|
||||
"prettierd",
|
||||
})
|
||||
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = ensure_installed,
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {},
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
25
lua/nyanko/lazy/lualine.lua
Normal file
25
lua/nyanko/lazy/lualine.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = {
|
||||
"filename",
|
||||
function()
|
||||
return vim.fn["nvim_treesitter#statusline"](180)
|
||||
end,
|
||||
},
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
26
lua/nyanko/lazy/telescope.lua
Normal file
26
lua/nyanko/lazy/telescope.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch by current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.oldfiles, { desc = "[S]earch [R]ecent files" })
|
||||
end,
|
||||
}
|
10
lua/nyanko/lazy/todo-comments.lua
Normal file
10
lua/nyanko/lazy/todo-comments.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = {
|
||||
signs = false,
|
||||
},
|
||||
}
|
33
lua/nyanko/lazy/treesitter.lua
Normal file
33
lua/nyanko/lazy/treesitter.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
main = "nvim-treesitter.configs",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"diff",
|
||||
"html",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"query",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = {
|
||||
"ruby",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = {
|
||||
"ruby",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
12
lua/nyanko/lazy/which-key.lua
Normal file
12
lua/nyanko/lazy/which-key.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
opts = {
|
||||
icons = {
|
||||
mappings = false,
|
||||
},
|
||||
spec = {
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
},
|
||||
},
|
||||
}
|
31
lua/nyanko/lazy_init.lua
Normal file
31
lua/nyanko/lazy_init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--branch=stable",
|
||||
lazyrepo,
|
||||
lazypath,
|
||||
})
|
||||
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = "nyanko.lazy",
|
||||
install = { colorscheme = { "catppuccin-mocha" } },
|
||||
checker = { enabled = true },
|
||||
change_detection = { enabled = true, notify = false },
|
||||
})
|
37
lua/nyanko/opt.lua
Normal file
37
lua/nyanko/opt.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
-- for brevity
|
||||
local o = vim.opt
|
||||
|
||||
-- show line numbers
|
||||
o.number = true
|
||||
|
||||
-- enable mouse mode
|
||||
o.mouse = "a"
|
||||
|
||||
-- dont show the mode since it's in lualine
|
||||
o.showmode = false
|
||||
|
||||
-- faster updates
|
||||
o.updatetime = 100
|
||||
|
||||
-- tabs
|
||||
o.autoindent = true
|
||||
o.smartindent = true
|
||||
o.expandtab = false
|
||||
o.tabstop = 4
|
||||
o.shiftwidth = 4
|
||||
|
||||
-- indent wrapped lines of text
|
||||
o.breakindent = true
|
||||
|
||||
-- save undo history
|
||||
o.undofile = true
|
||||
|
||||
-- make search case insensitive unless \C or mixed-case is in the search
|
||||
o.ignorecase = true
|
||||
o.smartcase = true
|
||||
|
||||
-- keep sign column visible
|
||||
o.signcolumn = "yes"
|
||||
|
||||
-- show which line the cursor is on
|
||||
o.cursorline = true
|
Loading…
Add table
Reference in a new issue