mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 08:41:34 +02:00
Squashed 'config/nvim/' content from commit 0bd687c
git-subtree-dir: config/nvim git-subtree-split: 0bd687c8b69605fa1c7c88222354158b1c2de2f8
This commit is contained in:
commit
f4858d42a8
36 changed files with 906 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/plugin
|
||||
5
Makefile
Normal file
5
Makefile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fmt:
|
||||
@stylua {lua,init.lua}
|
||||
|
||||
lint:
|
||||
@selene {lua,init.lua}
|
||||
6
ftplugin/go.lua
Normal file
6
ftplugin/go.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local ok, dapi = pcall(require, "dap-install")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapi.config("go_delve", {})
|
||||
6
ftplugin/javascript.lua
Normal file
6
ftplugin/javascript.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local ok, dapi = pcall(require, "dap-install")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapi.config("jsnode", {})
|
||||
6
ftplugin/lua.lua
Normal file
6
ftplugin/lua.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local ok, dapi = pcall(require, "dap-install")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapi.config("lua", {})
|
||||
6
ftplugin/python.lua
Normal file
6
ftplugin/python.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local ok, dapi = pcall(require, "dap-install")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
dapi.config("python", {})
|
||||
9
init.lua
Normal file
9
init.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
require "options"
|
||||
require "plugin"
|
||||
require "keymapings"
|
||||
require "disabled"
|
||||
require "globals"
|
||||
require "autocmd"
|
||||
|
||||
vim.g.vscode_style = "dark"
|
||||
vim.cmd [[colo vscode]]
|
||||
1
lua/autocmd.lua
Normal file
1
lua/autocmd.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.cmd [[ autocmd BufWritePre * lua mkdir() ]]
|
||||
26
lua/disabled.lua
Normal file
26
lua/disabled.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
local disabled_built_ins = {
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"gzip",
|
||||
"zip",
|
||||
"tohtml",
|
||||
"man",
|
||||
"zipPlugin",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"2html_plugin",
|
||||
"logipat",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"matchit",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
vim.g["loaded_" .. plugin] = 1
|
||||
end
|
||||
10
lua/globals.lua
Normal file
10
lua/globals.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function _G.term_cmd(cmd)
|
||||
require("toggleterm.terminal").Terminal:new({ cmd = cmd, hidden = true }):toggle()
|
||||
end
|
||||
|
||||
function _G.mkdir()
|
||||
local dir = vim.fn.expand "%:p:h"
|
||||
if vim.fn.isdirectory(dir) == 0 then
|
||||
vim.fn.mkdir(dir, "p")
|
||||
end
|
||||
end
|
||||
78
lua/keymapings.lua
Normal file
78
lua/keymapings.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
local u = require "utils"
|
||||
local map, nmap, expr = u.map, u.nmap, u.expr
|
||||
|
||||
nmap("<C-s>", "<cmd>write!<cr>")
|
||||
nmap("<leader>h", "<cmd>nohlsearch<cr>")
|
||||
nmap("<leader>q", "<cmd>quit!<cr>")
|
||||
nmap("<leader>w", "<cmd>write!<cr>")
|
||||
nmap("<leader>e", "<cmd>NvimTreeToggle<cr>")
|
||||
nmap("<leader>/", "<cmd>lua require[[Comment]].toggle()<cr>")
|
||||
map("v", "<leader>/", "gc")
|
||||
nmap("<leader>ps", "<cmd>PackerSync<cr>")
|
||||
|
||||
-- Windows
|
||||
for _, k in ipairs { "h", "j", "k", "l" } do
|
||||
nmap(string.format("<C-%s>", k), string.format("<cmd>wincmd %s<cr>", k))
|
||||
map("t", string.format("<C-%s>", k), string.format("<C-\\><C-N><C-w>%s", k))
|
||||
end
|
||||
|
||||
nmap("<C-Left>", "<cmd>vertical resize -2<cr>")
|
||||
nmap("<C-Up", "<cmd>resize -1<cr>")
|
||||
nmap("<C-Down>", "<cmd>resize +2<cr>")
|
||||
nmap("<C-Right>", "<cmd>vertical resize +2<CR>")
|
||||
|
||||
-- Alternative up/down for arrows
|
||||
expr("i", "<C-j>", 'pumvisible() ? "\\<down>" : "\\<C-j>"')
|
||||
expr("i", "<C-k>", 'pumvisible() ? "\\<up>" : "\\<C-k>"')
|
||||
expr("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"')
|
||||
expr("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"')
|
||||
|
||||
-- Move line
|
||||
map("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
|
||||
map("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
|
||||
map("v", "K", ":move '<-2<CR>gv-gv")
|
||||
map("v", "J", ":move '>+1<CR>gv-gv")
|
||||
nmap("<A-j>", ":m .+1<CR>==")
|
||||
nmap("<A-k>", ":m .-2<CR>==")
|
||||
|
||||
-- Telescope
|
||||
nmap("<leader>f", "<cmd>Telescope find_files<cr>")
|
||||
nmap("<leader>b", "<cmd>Telescope buffers<cr>")
|
||||
nmap("<leader>st", "<cmd>Telescope live_grep<cr>")
|
||||
nmap("<leader>sT", "<cmd>Telescope grep_string<cr>")
|
||||
nmap("<leader>sp", "<cmd>Telescope projects<cr>")
|
||||
nmap("<leader>sr", "<cmd>Telescope oldfiles<cr>")
|
||||
nmap("<leader>sb", "<cmd>Telescope git_branches<cr>")
|
||||
nmap("<leader>sc", "<cmd>Telescope git_commits<cr>")
|
||||
nmap("<leader>sk", "<cmd>Telescope keymaps<cr>")
|
||||
|
||||
-- Terminal
|
||||
nmap("<leader>gg", "<cmd>lua term_cmd('lazygit')<cr>")
|
||||
nmap("<leader>D", "<cmd> lua term_cmd('lazydocker')<cr>")
|
||||
|
||||
-- DAP
|
||||
nmap("<leader>dt", "<cmd>lua require'dap'.toggle_breakpoint()<cr>")
|
||||
nmap("<leader>db", "<cmd>lua require'dap'.step_back()<cr>")
|
||||
nmap("<leader>dc", "<cmd>lua require'dap'.continue()<cr>")
|
||||
nmap("<leader>dd", "<cmd>lua require'dap'.disconnect()<cr>")
|
||||
nmap("<leader>di", "<cmd>lua require'dap'.step_into()<cr>")
|
||||
nmap("<leader>do", "<cmd>lua require'dap'.step_over()<cr>")
|
||||
nmap("<leader>du", "<cmd>lua require'dap'.step_out()<cr>")
|
||||
nmap("<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>")
|
||||
nmap("<leader>dp", "<cmd>lua require'dap'.pause.toggle()<cr>")
|
||||
nmap("<leader>dq", "<cmd>lua require'dap'.close()<cr>")
|
||||
|
||||
-- Ultest
|
||||
nmap("<leader>tt", "<cmd>Ultest<cr>")
|
||||
nmap("<leader>ts", "<cmd>UltestStop<cr>")
|
||||
nmap("<leader>tc", "<cmd>UltestClear<cr>")
|
||||
nmap("<leader>tn", "<cmd>UltestNearest<cr>")
|
||||
nmap("<leader>to", "<cmd>UltestOutput<cr>")
|
||||
|
||||
-- Buffer
|
||||
nmap("<A-0>", "<cmd>BufferLast<cr>")
|
||||
nmap("<C-w>", "<cmd>BufferClose<cr>")
|
||||
nmap("<leader>c", "<cmd>BufferClose!<cr>")
|
||||
for i = 1, 9 do
|
||||
nmap(string.format("<A-%d>", i), string.format("<cmd>BufferGoto %d<cr>", i))
|
||||
end
|
||||
26
lua/lsp/attach.lua
Normal file
26
lua/lsp/attach.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
return function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_range_formatting = false
|
||||
|
||||
local function buf_map(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", ...)
|
||||
end
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
buf_map("K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_map("gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_map("gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
buf_map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_map("gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_map("gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_map("gl", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_map("<leader>la", "<cmd>Telescope lsp_code_actions<CR>", opts)
|
||||
buf_map("<leader>lA", "lua vim.lsp.buf.range_code_action()<CR>", opts)
|
||||
buf_map("<leader>ld", "<cmd>TroubleToggle<cr>", opts)
|
||||
buf_map("<leader>lr", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_map("<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
buf_map("<leader>ls", "<cmd>Telescope lsp_document_symbols<CR>", opts)
|
||||
buf_map("<leader>li", "<cmd>LspInfo<CR>", opts)
|
||||
buf_map("<leader>lR", "<cmd>LspRestart<CR>", opts)
|
||||
end
|
||||
22
lua/lsp/init.lua
Normal file
22
lua/lsp/init.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local on_attach = require "lsp.attach"
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("nvim-lsp-installer").on_server_ready(function(server)
|
||||
local opts = { on_attach = on_attach }
|
||||
|
||||
local ok, server_opts = pcall(require, "lsp.providers." .. server.name)
|
||||
if ok then
|
||||
opts = vim.tbl_deep_extend("force", opts, server_opts or {})
|
||||
end
|
||||
|
||||
server:setup(opts)
|
||||
|
||||
vim.cmd [[ do User LspAttachBuffers ]]
|
||||
|
||||
require("lsp.null").setup()
|
||||
require("lspconfig")["null-ls"].setup {}
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
38
lua/lsp/null.lua
Normal file
38
lua/lsp/null.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
local fmt = null_ls.builtins.formatting
|
||||
local lint = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.config {
|
||||
sources = {
|
||||
-- Lua
|
||||
fmt.stylua,
|
||||
lint.selene,
|
||||
|
||||
-- Golang
|
||||
fmt.gofumpt,
|
||||
fmt.goimports,
|
||||
|
||||
-- JavaScirpt
|
||||
fmt.prettierd,
|
||||
lint.eslint_d,
|
||||
|
||||
-- Shell
|
||||
fmt.shfmt,
|
||||
lint.shellcheck,
|
||||
|
||||
-- Python
|
||||
fmt.black,
|
||||
fmt.isort,
|
||||
lint.flake8,
|
||||
|
||||
-- Rust
|
||||
fmt.rustfmt,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
16
lua/lsp/providers/jsonls.lua
Normal file
16
lua/lsp/providers/jsonls.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
settings = {
|
||||
schemaDownload = {
|
||||
enable = true,
|
||||
},
|
||||
schemas = {
|
||||
{ fileMatch = { "package.json" }, url = "https://json.schemastore.org/package.json" },
|
||||
{ url = "https://json.schemastore.org/tsconfig.json", fileMatch = { "tsconfig.json", "tsconfig.*.json" } },
|
||||
{ url = "https://json.schemastore.org/lerna.json", fileMatch = { "lerna.json" } },
|
||||
{ url = "https://json.schemastore.org/eslintrc.json", fileMatch = { ".eslintrc.json", ".eslintrc" } },
|
||||
{ url = "https://json.schemastore.org/prettierrc", fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" } },
|
||||
{ fileMatch = { ".golangci.toml", ".golangci.json" }, url = "https://json.schemastore.org/golangci-lint.json" },
|
||||
{ fileMatch = { "package.json" }, url = "https://json.schemastore.org/package.json" },
|
||||
},
|
||||
},
|
||||
}
|
||||
8
lua/lsp/providers/pyright.lua
Normal file
8
lua/lsp/providers/pyright.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
12
lua/lsp/providers/sqls.lua
Normal file
12
lua/lsp/providers/sqls.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
settings = {
|
||||
sqls = {
|
||||
connections = {
|
||||
{
|
||||
driver = "postgresql",
|
||||
dataSourceName = "host=0.0.0.0 port=5432 user=postgres password=qwerty123 dbname=postgres sslmode=disable",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
15
lua/lsp/providers/sumneko_lua.lua
Normal file
15
lua/lsp/providers/sumneko_lua.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
19
lua/lsp/providers/tsserver.lua
Normal file
19
lua/lsp/providers/tsserver.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
setup = {
|
||||
handlers = {
|
||||
["textDocument/publishDiagnostics"] = function(_, _, p, id, _, cfg)
|
||||
if p.diagnostics ~= nil then
|
||||
local i = 1
|
||||
while i <= #p.diagnostics do
|
||||
if p.diagnostics[i].code == 80001 then
|
||||
table.remove(p.diagnostics, i)
|
||||
else
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(_, _, p, id, _, cfg)
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
14
lua/lsp/providers/yamlls.lua
Normal file
14
lua/lsp/providers/yamlls.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
settings = {
|
||||
yaml = {
|
||||
hover = true,
|
||||
completion = true,
|
||||
validate = true,
|
||||
schemaStore = {
|
||||
enable = true,
|
||||
url = "https://www.schemastore.org/api/json/catalog.json",
|
||||
},
|
||||
schemas = {},
|
||||
},
|
||||
},
|
||||
}
|
||||
47
lua/options.lua
Normal file
47
lua/options.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local o = vim.opt
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = ","
|
||||
vim.g.netrw_banner = false
|
||||
|
||||
-- o.laststatus = 0
|
||||
o.backup = false
|
||||
o.clipboard = "unnamedplus"
|
||||
o.cmdheight = 1
|
||||
o.colorcolumn = "99999"
|
||||
o.completeopt = { "menuone", "noselect" }
|
||||
o.conceallevel = 0
|
||||
o.fileencoding = "utf-8"
|
||||
o.foldmethod = "manual"
|
||||
o.foldexpr = ""
|
||||
o.guifont = "JetBrains Mono Nerd Font:h17"
|
||||
o.hidden = true
|
||||
o.hlsearch = true
|
||||
o.ignorecase = true
|
||||
o.mouse = "a"
|
||||
o.pumheight = 10
|
||||
o.showmode = false
|
||||
o.smartcase = true
|
||||
o.smartindent = true
|
||||
o.splitbelow = true
|
||||
o.splitright = true
|
||||
o.swapfile = false
|
||||
o.termguicolors = true
|
||||
-- o.timeoutlen = 100
|
||||
o.title = true
|
||||
o.undofile = true
|
||||
o.updatetime = 300
|
||||
o.writebackup = false
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 2
|
||||
o.tabstop = 2
|
||||
o.cursorline = true
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.numberwidth = 4
|
||||
o.signcolumn = "yes"
|
||||
o.wrap = false
|
||||
o.spell = false
|
||||
o.spelllang = "en"
|
||||
o.scrolloff = 8
|
||||
o.sidescrolloff = 8
|
||||
163
lua/plugin.lua
Normal file
163
lua/plugin.lua
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
return require("packer").startup(function(use)
|
||||
use "wbthomason/packer.nvim"
|
||||
use "nvim-lua/plenary.nvim"
|
||||
use "Mofiqul/vscode.nvim"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "romgrk/barbar.nvim"
|
||||
use { "dstein64/vim-startuptime", cmd = "StartupTime" }
|
||||
|
||||
use {
|
||||
"pwntester/octo.nvim",
|
||||
cmd = "Octo",
|
||||
opt = true,
|
||||
config = function()
|
||||
require("octo").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"neovim/nvim-lspconfig",
|
||||
requires = {
|
||||
"williamboman/nvim-lsp-installer",
|
||||
{ "jose-elias-alvarez/null-ls.nvim", after = "nvim-lspconfig" },
|
||||
},
|
||||
config = function()
|
||||
require("lsp").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = function()
|
||||
require("plugin.project").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"mfussenegger/nvim-dap",
|
||||
module = "dap",
|
||||
requires = {
|
||||
{ "Pocco81/DAPInstall.nvim", requires = "nvim-dap" },
|
||||
{ "theHamsta/nvim-dap-virtual-text", after = "nvim-dap", config = [[ require"nvim-dap-virtual-text".setup() ]] },
|
||||
{ "nvim-telescope/telescope-dap.nvim", after = "nvim-dap", config = [[ require("telescope").load_extension "dap" ]] },
|
||||
},
|
||||
config = function()
|
||||
require("plugin.dap").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"ray-x/go.nvim",
|
||||
ft = "go",
|
||||
opt = true,
|
||||
config = function()
|
||||
require("go").setup { gofmt = "gofumpt" }
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("plugin.gitsigns").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
require("plugin.statusline").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"rcarriga/vim-ultest",
|
||||
requires = { { "vim-test/vim-test", after = "vim-ultest" } },
|
||||
cmd = { "Ultest", "UltestStop", "UltestClear", "UltestNearest", "UltestOutput" },
|
||||
run = ":UpdateRemotePlugins",
|
||||
config = function()
|
||||
require("plugin.ultest").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
{ "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" },
|
||||
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" },
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
requires = {
|
||||
{ "L3MON4D3/LuaSnip", after = "cmp_luasnip" },
|
||||
{ "rafamadriz/friendly-snippets", after = "LuaSnip" },
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("plugin.cmp").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"max397574/better-escape.nvim",
|
||||
config = function()
|
||||
require("better_escape").setup { mapping = { "jk" } }
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
module = "telescope",
|
||||
config = function()
|
||||
require("plugin.telescope").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
config = function()
|
||||
require("plugin.nvimtree").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "0.5-compat",
|
||||
config = function()
|
||||
require("plugin.treesitter").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"Smirnov-O/ts-unit.nvim",
|
||||
after = "nvim-treesitter",
|
||||
config = function()
|
||||
require("ts-unit").setup { keymaps = true }
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"akinsho/toggleterm.nvim",
|
||||
module = "toggleterm",
|
||||
keys = "<C-t>",
|
||||
config = function()
|
||||
require("plugin.terminal").setup()
|
||||
end,
|
||||
}
|
||||
end)
|
||||
68
lua/plugin/cmp.lua
Normal file
68
lua/plugin/cmp.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local cmp = require "cmp"
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load {
|
||||
paths = { "~/.local/share/nvim/site/pack/packer/start/friendly-snippets" },
|
||||
}
|
||||
|
||||
cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done())
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "(L)",
|
||||
nvim_lua = "(N)",
|
||||
buffer = "(B)",
|
||||
luasnip = "(S)",
|
||||
})[entry.source.name]
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-k>"] = cmp.mapping.select_prev_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.Replace, select = false },
|
||||
["<Tab>"] = 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,
|
||||
["<S-Tab>"] = 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,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lua", max_item_count = 5 },
|
||||
{ name = "nvim_lsp", max_item_count = 8 },
|
||||
{ name = "buffer", keyword_length = 4, max_item_count = 5 },
|
||||
{ name = "luasnip", max_item_count = 4, keyword_length = 2 },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
24
lua/plugin/dap.lua
Normal file
24
lua/plugin/dap.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.fn.sign_define("DapBreakpoint", {
|
||||
text = "",
|
||||
texthl = "LspDiagnosticsSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
})
|
||||
vim.fn.sign_define("DapBreakpointRejected", {
|
||||
text = "",
|
||||
texthl = "LspDiagnosticsSignHint",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
})
|
||||
vim.fn.sign_define("DapStopped", {
|
||||
text = "",
|
||||
texthl = "LspDiagnosticsSignInformation",
|
||||
linehl = "DiagnosticUnderlineInfo",
|
||||
numhl = "LspDiagnosticsSignInformation",
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
53
lua/plugin/gitsigns.lua
Normal file
53
lua/plugin/gitsigns.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("gitsigns").setup {
|
||||
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" },
|
||||
},
|
||||
signcolumn = true,
|
||||
numhl = false,
|
||||
linehl = false,
|
||||
word_diff = false,
|
||||
keymaps = {
|
||||
noremap = true,
|
||||
["n <leader>gs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
||||
["n <leader>gr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
||||
["n <leader>gR"] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
|
||||
["n <leader>gp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
||||
["n <leader>gl"] = '<cmd>lua require"gitsigns".blame_line(true)<CR>',
|
||||
["n <leader>gS"] = '<cmd>lua require"gitsigns".stage_buffer()<CR>',
|
||||
["n <leader>gU"] = '<cmd>lua require"gitsigns".reset_buffer_index()<CR>',
|
||||
},
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 300,
|
||||
},
|
||||
current_line_blame_formatter_opts = { relative_time = false },
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil,
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
border = "single",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
yadm = { enable = false },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
44
lua/plugin/nvimtree.lua
Normal file
44
lua/plugin/nvimtree.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local tree_cb = require("nvim-tree.config").nvim_tree_callback
|
||||
|
||||
require("nvim-tree").setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
auto_close = true,
|
||||
auto_open = true,
|
||||
update_cwd = false,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
custom = { ".git", "node_modules", "__pycache__", "env", ".bin" },
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
auto_resize = false,
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {
|
||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
|
||||
{ key = "h", cb = tree_cb "close_node" },
|
||||
{ key = "v", cb = tree_cb "vsplit" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.nvim_tree_group_empty = 1
|
||||
vim.g.nvim_tree_indent_markers = 1
|
||||
end
|
||||
|
||||
return M
|
||||
15
lua/plugin/project.lua
Normal file
15
lua/plugin/project.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("project_nvim").setup {
|
||||
manual_mode = false,
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = { ".git", ".svn", "Makefile", "package.json", "go.mod" },
|
||||
ignore_lsp = {},
|
||||
exclude_dirs = {},
|
||||
show_hidden = false,
|
||||
silent_chdir = true,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
22
lua/plugin/statusline.lua
Normal file
22
lua/plugin/statusline.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
theme = "codedark",
|
||||
component_separators = { "", "" },
|
||||
section_separators = { "", "" },
|
||||
disabled_filetypes = { "NvimTree", "Telescope" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "branch", "diff" },
|
||||
lualine_b = { "filename" },
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { { "diagnostics", sources = { "nvim_lsp" } } },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
52
lua/plugin/telescope.lua
Normal file
52
lua/plugin/telescope.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local actions = require "telescope.actions"
|
||||
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
width = 0.75,
|
||||
preview_cutoff = 120,
|
||||
prompt_position = "top",
|
||||
horizontal = { mirror = false },
|
||||
vertical = { mirror = false },
|
||||
},
|
||||
file_ignore_patterns = { ".git", "node_modules", "__pycache__", "target", "env", ".bin" },
|
||||
path_display = { shorten = 5 },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
set_env = { ["COLORTERM"] = "truecolor" },
|
||||
pickers = {
|
||||
find_files = { find_command = { "fd", "--type=file", "--hidden", "--smart-case" } },
|
||||
live_grep = { only_sort_text = true },
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-u>"] = false,
|
||||
|
||||
["<C-h>"] = "which_key",
|
||||
},
|
||||
n = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope").load_extension "projects"
|
||||
end
|
||||
|
||||
return M
|
||||
28
lua/plugin/terminal.lua
Normal file
28
lua/plugin/terminal.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("toggleterm").setup {
|
||||
size = 20,
|
||||
open_mapping = [[<c-t>]],
|
||||
hide_numbers = true,
|
||||
shade_filetypes = {},
|
||||
shade_terminals = true,
|
||||
shading_factor = 2,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
persist_size = false,
|
||||
direction = "float",
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
winblend = 0,
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
background = "Normal",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
20
lua/plugin/treesitter.lua
Normal file
20
lua/plugin/treesitter.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = { "lua", "go", "gomod" },
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { "python", "yml" } },
|
||||
autotag = { enable = true },
|
||||
context_commentstring = { enable = true },
|
||||
rainbow = {
|
||||
enable = false,
|
||||
extended_mode = true,
|
||||
max_file_lines = 500,
|
||||
},
|
||||
}
|
||||
|
||||
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
end
|
||||
|
||||
return M
|
||||
7
lua/plugin/ultest.lua
Normal file
7
lua/plugin/ultest.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.g["test#go#gotest#optiongs"] = "-v"
|
||||
end
|
||||
|
||||
return M
|
||||
27
lua/utils.lua
Normal file
27
lua/utils.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local M = {}
|
||||
|
||||
M.opts = { noremap = true, silent = true }
|
||||
|
||||
function M._map(mode, from, to, opts)
|
||||
vim.api.nvim_set_keymap(mode, from, to, opts)
|
||||
end
|
||||
|
||||
function M.map(mode, from, to)
|
||||
if type(mode) == "table" then
|
||||
for _, m in pairs(mode) do
|
||||
M._map(m, from, to, M.opts)
|
||||
end
|
||||
end
|
||||
|
||||
M._map(mode, from, to, M.opts)
|
||||
end
|
||||
|
||||
function M.nmap(from, to)
|
||||
M._map("n", from, to, M.opts)
|
||||
end
|
||||
|
||||
function M.expr(mode, from, to)
|
||||
M._map(mode, from, to, { noremap = true, expr = true })
|
||||
end
|
||||
|
||||
return M
|
||||
1
selene.toml
Normal file
1
selene.toml
Normal file
|
|
@ -0,0 +1 @@
|
|||
std="lua51+vim"
|
||||
6
stylua.toml
Normal file
6
stylua.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
column_width = 140
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
no_call_parentheses = true
|
||||
5
vim.toml
Normal file
5
vim.toml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[vim]
|
||||
any = true
|
||||
|
||||
[_G]
|
||||
any = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue