initial commit

This commit is contained in:
2025-08-05 00:16:13 +03:00
commit 4c7269dad4
7 changed files with 124 additions and 0 deletions

7
init.lua Normal file
View File

@@ -0,0 +1,7 @@
require "plugins"
require "options"
require "keymaps"
require "treesitter"
require "lsp"
vim.cmd.colorscheme "tokyonight"

18
lua/keymaps.lua Normal file
View File

@@ -0,0 +1,18 @@
local lazy = require "lazy-load"
local oil = lazy.setup "oil"
local pick = lazy.setup "mini.pick"
vim.keymap.set("n", "<Esc>", "<Cmd>noh<CR>")
vim.keymap.set("n", "<space>", "<nop>")
local function mapleader(lhs, rhs)
vim.keymap.set("n", "<leader>" .. lhs, rhs)
end
mapleader("s", "<Cmd>source<CR>")
mapleader("w", "<Cmd>write<CR>")
mapleader("f", function() vim.lsp.buf.format() end)
mapleader("o", function() oil().open() end)
mapleader("pf", function() pick().builtin.files() end)
mapleader("pg", function() pick().builtin.grep_live() end)
mapleader("ph", function() pick().builtin.help() end)

18
lua/lazy-load.lua Normal file
View File

@@ -0,0 +1,18 @@
local M = {}
function M.setup(module, opts)
local loaded = false
local instance = nil
return function()
if not loaded then
instance = require(module)
if instance.setup then
instance.setup(opts or {})
end
loaded = true
end
return instance
end
end
return M

51
lua/lsp.lua Normal file
View File

@@ -0,0 +1,51 @@
vim.lsp.enable({ "lua_ls", "denols" })
vim.lsp.config("lua_ls", {
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
},
format = {
enable = true,
defaultConfig = {
indent_style = "space",
indent_size = "3",
quote_style = "double",
table_separator_style = "comma",
trailing_table_separator = "smart",
call_arg_parentheses = "remove_string_only",
space_after_comment_dash = "true",
space_around_math_operator = "true",
["space_around_math_operator.exponent"] = "false",
align_call_args = "true",
align_continuous_similar_call_args = "true",
line_space_after_local_or_assign_statement = "max(2)",
line_space_after_expression_statement = "max(2)",
line_space_after_comment = "keep",
line_space_around_block = "max(1)",
break_all_list_when_line_exceed = "true",
remove_call_expression_list_finish_comma = "true",
end_statement_with_semicolon = "replace_with_newline",
},
},
},
},
})
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(ev)
local client = assert(vim.lsp.get_client_by_id(ev.data.client_id))
if client:supports_method "textDocument/completion" then
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
end
end,
})

12
lua/options.lua Normal file
View File

@@ -0,0 +1,12 @@
vim.o.number = true
vim.o.relativenumber = true
vim.o.cursorline = true
vim.o.expandtab = true
vim.o.wrap = false
vim.o.undofile = true
vim.g.mapleader = " "
vim.o.winborder = "single"
vim.o.completeopt = "menu,popup,noselect"
vim.o.signcolumn = "yes"
vim.o.foldmethod = "expr"
vim.o.foldlevel = 99

12
lua/plugins.lua Normal file
View File

@@ -0,0 +1,12 @@
vim.pack.add {
"https://github.com/NMAC427/guess-indent.nvim",
"https://github.com/hiphish/rainbow-delimiters.nvim",
"https://github.com/nvim-treesitter/nvim-treesitter",
"https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
"https://github.com/neovim/nvim-lspconfig",
"https://github.com/folke/tokyonight.nvim",
"https://github.com/echasnovski/mini.pick",
"https://github.com/stevearc/oil.nvim",
}
require "guess-indent".setup {}

6
lua/treesitter.lua Normal file
View File

@@ -0,0 +1,6 @@
require "nvim-treesitter.configs".setup {
ensure_installed = { "c", "bash", "lua", "luadoc", "vim", "vimdoc", "diff", "html", "javascript", "markdown" },
highlight = {
enable = true,
},
}