Transfer nvim config to separate file
This commit is contained in:
commit
314b11735c
26 changed files with 739 additions and 0 deletions
26
Dockerfile
Normal file
26
Dockerfile
Normal file
|
@ -0,0 +1,26 @@
|
|||
FROM ubuntu:latest
|
||||
|
||||
LABEL maintainer="pro100ton@gmail.com"
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
neovim \
|
||||
git \
|
||||
nodejs \
|
||||
npm \
|
||||
fzf \
|
||||
golang-go \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
unzip \
|
||||
ripgrep
|
||||
RUN useradd -m nvim_playground
|
||||
|
||||
USER nvim_playground
|
||||
|
||||
RUN mkdir /home/nvim_playground/.config
|
||||
RUN mkdir /home/nvim_playground/.config/nvim
|
||||
WORKDIR /home/nvim_playground/.config/nvim
|
||||
COPY . .
|
36
README.md
Normal file
36
README.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# File structure
|
||||
.
|
||||
├── Dockerfile
|
||||
├── README.md
|
||||
├── init.lua
|
||||
└── lua
|
||||
└── t0xa
|
||||
├── core
|
||||
│ └── options.lua
|
||||
└── plugins
|
||||
└── lazy.lua
|
||||
|
||||
## init.lua
|
||||
Файл, в который "смотрит" neovim при [старте](https://neovim.io/doc/user/starting.html#initialization).
|
||||
|
||||
## t0xa
|
||||
Вместо того, чтобы использовать обращение к файлам настройки напрямую - используется данная
|
||||
папка.
|
||||
Можно обходиться без нее, однако для избегания конфликтов нейминга решил что буду использовать
|
||||
так.
|
||||
## core
|
||||
Тут хранятся базовые настройки для neovim
|
||||
## plugins
|
||||
Папка для хранения и настроек плагинов для neovim
|
||||
|
||||
# Main options
|
||||
|
||||
|
||||
# Useful links
|
||||
- [neovim stup guide](https://www.youtube.com/watch?v=6pAG3BHurdM)
|
||||
|
||||
# Команда для запуска контейнеров
|
||||
|
||||
```
|
||||
docker build -t nvim:nvim . && docker run -it --user nvim_playground nvim:nvim
|
||||
```
|
3
init.lua
Normal file
3
init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
-- Omitting `lua` directory, because neovim autmaticaly serching in it
|
||||
require("t0xa.core.options")
|
||||
require("t0xa.lazy")
|
40
lua/t0xa/core/options.lua
Normal file
40
lua/t0xa/core/options.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local opt = vim.opt -- Shorcut to scip writing vim.opt.* in settings beneath
|
||||
|
||||
-- enable line number and relative line number
|
||||
opt.number = true -- This will show the line number cursor is currently standing
|
||||
opt.relativenumber = true -- This will enable relative numbers on the left side
|
||||
|
||||
-- tabs & indentation
|
||||
opt.shiftwidth = 2 -- Set spaces for tabs == 2
|
||||
opt.tabstop = 2 -- Set spaces for indent with == 2
|
||||
opt.expandtab = true -- use number of spaces to insert a <Tab>
|
||||
opt.softtabstop = 2
|
||||
|
||||
-- search settings
|
||||
opt.ignorecase = true -- ignore case when searching
|
||||
opt.smartcase = true -- If mixing cases while searching = you want case-sensitive search
|
||||
|
||||
-- Cursor line setting
|
||||
opt.cursorline = true
|
||||
|
||||
-- Turn on termguicolors for colorschemes
|
||||
-- (Have to use true color terminal to see theese setting work)
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||
opt.signcolumn = "yes" -- show sigh columns so that text doesn't shift
|
||||
|
||||
-- backspace setting
|
||||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
|
||||
|
||||
-- clipboard
|
||||
opt.clipboard:append("unnamedplus") -- config to set up clipboard as default register
|
||||
|
||||
-- split windows settings
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
-- disable swap files creation
|
||||
opt.swapfile = false
|
||||
|
||||
-- Add line at 88 symbols
|
||||
opt.colorcolumn = "88"
|
25
lua/t0xa/lazy.lua
Normal file
25
lua/t0xa/lazy.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Initializing `lazy` lib and
|
||||
require("lazy").setup({
|
||||
{
|
||||
import = "t0xa.plugins",
|
||||
},
|
||||
{
|
||||
import = "t0xa.plugins.colorschemes",
|
||||
},
|
||||
{
|
||||
import = "t0xa.plugins.lsp",
|
||||
},
|
||||
})
|
31
lua/t0xa/plugins/autopairs.lua
Normal file
31
lua/t0xa/plugins/autopairs.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = { "InsertEnter" },
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
-- import nvim-autopairs
|
||||
local autopairs = require("nvim-autopairs")
|
||||
|
||||
-- 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
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
-- import nvim-cmp plugin (completions plugin)
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
|
6
lua/t0xa/plugins/blame.lua
Normal file
6
lua/t0xa/plugins/blame.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"FabijanZulj/blame.nvim",
|
||||
config = function()
|
||||
require("blame").setup()
|
||||
end
|
||||
}
|
16
lua/t0xa/plugins/colorscheme.lua
Normal file
16
lua/t0xa/plugins/colorscheme.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"folke/tokyonight.nvim",
|
||||
dependencies = {
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
"sainnhe/everforest",
|
||||
"sainnhe/gruvbox-material",
|
||||
"rebelot/kanagawa.nvim",
|
||||
},
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.g.gruvbox_material_enable_italic = true
|
||||
vim.cmd.colorscheme("gruvbox-material")
|
||||
end,
|
||||
}
|
||||
|
3
lua/t0xa/plugins/colorschemes/kanagawa.lua
Normal file
3
lua/t0xa/plugins/colorschemes/kanagawa.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"rebelot/kanagawa.nvim",
|
||||
}
|
19
lua/t0xa/plugins/comment.lua
Normal file
19
lua/t0xa/plugins/comment.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
},
|
||||
config = function()
|
||||
-- import comment plugin safely
|
||||
local comment = require("Comment")
|
||||
|
||||
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
|
||||
|
||||
-- enable comment
|
||||
comment.setup({
|
||||
-- for commenting tsx, jsx, svelte, html files
|
||||
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||
})
|
||||
end,
|
||||
}
|
4
lua/t0xa/plugins/dressing.lua
Normal file
4
lua/t0xa/plugins/dressing.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy"
|
||||
}
|
109
lua/t0xa/plugins/lsp/lspconfig.lua
Normal file
109
lua/t0xa/plugins/lsp/lspconfig.lua
Normal file
|
@ -0,0 +1,109 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
-- Some additional QOL impovements like rename imports when file is renamed
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
-- Improved functionality when working with neovim config
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import mason_lspconfig plugin
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
-- import cmp-nvim-lsp plugin
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- nvim_create_autocmd - used to execute some logic automaticaly on a specific event
|
||||
-- Here it is used the LSP server attaches to file
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- Grouping together autocommands. Here we creating new group and calling it "UserLspConfig"
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
-- callback defining logic to execute on the event
|
||||
callback = function(ev)
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
|
||||
-- set keybinds
|
||||
opts.desc = "Show LSP references"
|
||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
||||
|
||||
opts.desc = "Show LSP definitions"
|
||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
||||
|
||||
opts.desc = "Show LSP implementations"
|
||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
||||
|
||||
opts.desc = "Show LSP type definitions"
|
||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
||||
|
||||
opts.desc = "Smart rename"
|
||||
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
||||
|
||||
opts.desc = "Show buffer diagnostics"
|
||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||
|
||||
opts.desc = "Go to previous diagnostic"
|
||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||
|
||||
opts.desc = "Go to next diagnostic"
|
||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||
|
||||
opts.desc = "Run formatting on current buffer"
|
||||
keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- default handler for installed servers
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
54
lua/t0xa/plugins/lsp/mason.lua
Normal file
54
lua/t0xa/plugins/lsp/mason.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim", -- util for better language servers manipulation
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- import mason
|
||||
local mason = require("mason")
|
||||
|
||||
-- import mason-lspconfig
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
local mason_tool_installer = require("mason-tool-installer")
|
||||
|
||||
-- enable mason and configure icons
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"gopls",
|
||||
},
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = {
|
||||
"prettier", -- prettier formatter
|
||||
"stylua", -- lua formatter
|
||||
"isort", -- python formatter
|
||||
"black", -- python formatter
|
||||
"pylint",
|
||||
"flake8",
|
||||
-- Astra settings for 3.7 Python
|
||||
-- { "isort", version = "5.11.5" }, -- python formatter
|
||||
-- { "black", version = "23.3.0" }, -- python formatter
|
||||
-- { "pylint", version = "2.9.0" },
|
||||
-- { "pylint", version = "2.9.0" },
|
||||
-- { "flake8", version = "4.0.1" },
|
||||
"eslint_d",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
22
lua/t0xa/plugins/lualine.lua
Normal file
22
lua/t0xa/plugins/lualine.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = "gruvbox-material",
|
||||
},
|
||||
sections = {
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true,
|
||||
path = 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
15
lua/t0xa/plugins/neogen.lua
Normal file
15
lua/t0xa/plugins/neogen.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"danymat/neogen",
|
||||
version = "*", -- Follow only stable versions
|
||||
enabled = true,
|
||||
config = function()
|
||||
local neogen = require("neogen")
|
||||
neogen.setup({
|
||||
enabled = true
|
||||
})
|
||||
local keymap = vim.keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
keymap.set("n", "<Leader>ids", ":lua require('neogen').generate()<CR>", opts)
|
||||
end,
|
||||
-- config = true,
|
||||
}
|
21
lua/t0xa/plugins/none-ls.lua
Normal file
21
lua/t0xa/plugins/none-ls.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.gofumpt,
|
||||
null_ls.builtins.formatting.goimports_reviser,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.golines,
|
||||
require("none-ls.diagnostics.flake8"),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
64
lua/t0xa/plugins/nvim-cmp.lua
Normal file
64
lua/t0xa/plugins/nvim-cmp.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter", -- Only load plugin when in INSERT mode
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
-- Load custom snippets from path
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.fn.stdpath("config") .. "/snippets/" })
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
-- !! Priority is important - autocompletion will be ordered from top to bottom
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- nvim LSP servers
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
40
lua/t0xa/plugins/nvim-tree.lua
Normal file
40
lua/t0xa/plugins/nvim-tree.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
local nvimtree = require("nvim-tree")
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
-- width = 35,
|
||||
adaptive_size = true,
|
||||
relativenumber = true,
|
||||
},
|
||||
-- disable window_picker for explorer to work well with window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Custom list of vim regex for names that will not be shown
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
-- Show files ignored by git
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- set nvim-tree keypmaps
|
||||
local keymap = vim.keymap
|
||||
keymap.set('n', '<leader>nt', ':NvimTreeToggle<CR>', {desc = "Toggle file explorer"})
|
||||
keymap.set('n', '<leader>nf', ':NvimTreeFindFileToggle<CR>', {desc = "Toggle file explorer on current file"})
|
||||
|
||||
end
|
||||
}
|
3
lua/t0xa/plugins/plenary.lua
Normal file
3
lua/t0xa/plugins/plenary.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"nvim-lua/plenary.nvim"
|
||||
}
|
38
lua/t0xa/plugins/telescope.lua
Normal file
38
lua/t0xa/plugins/telescope.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.6",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
-- Improving performance of finder
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
-- Display dev icons
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"folke/todo-comments.nvim",
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
path_display = { "smart" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf") -- load FZF extension to improve performance
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
local keymap = vim.keymap
|
||||
keymap.set("n", "<leader>ff", builtin.find_files, { desc = "FZF: find files in cwd" })
|
||||
keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "FZF: find string in cwd" })
|
||||
keymap.set("n", "<leader>fb", builtin.buffers, { desc = "FZF: display opened buffers" })
|
||||
keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "FZF: display help tags" })
|
||||
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "FZF: display TODO comments" })
|
||||
end,
|
||||
}
|
21
lua/t0xa/plugins/todo-comments.lua
Normal file
21
lua/t0xa/plugins/todo-comments.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local todo_comments = require("todo-comments")
|
||||
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
keymap.set("n", "]t", function()
|
||||
todo_comments.jump_next()
|
||||
end, { desc = "Next todo comment" })
|
||||
|
||||
keymap.set("n", "[t", function()
|
||||
todo_comments.jump_prev()
|
||||
end, { desc = "Previous todo comment" })
|
||||
|
||||
todo_comments.setup()
|
||||
end,
|
||||
}
|
66
lua/t0xa/plugins/treesitter.lua
Normal file
66
lua/t0xa/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,66 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
-- open this plugin on two events:
|
||||
-- BufReadPre - open existing file
|
||||
-- BufNewFile - open new file
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
build = ":TSUpdate", -- Run whenever this plugin is installed or updated
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag", -- Auto-closing functionality within treesitter
|
||||
},
|
||||
config = function()
|
||||
-- import nvim-treesitter plugin
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
|
||||
-- Configure treesitter
|
||||
-- treesitter.setup({
|
||||
-- -- enable syntax highlighting
|
||||
-- highligh = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
--
|
||||
-- -- enable better indentation
|
||||
-- indent = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
--
|
||||
-- -- enable auto-tagging
|
||||
-- autotag = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
--
|
||||
-- -- ensure these languages parsers are installed
|
||||
-- ensure_installed = {
|
||||
-- "python",
|
||||
-- "go",
|
||||
-- "lua",
|
||||
-- "bash",
|
||||
-- "json",
|
||||
-- "javascript",
|
||||
-- "jq",
|
||||
-- "markdown",
|
||||
-- "markdown_inline",
|
||||
-- "regex",
|
||||
-- "vim",
|
||||
-- "dockerfile",
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
treesitter.setup({
|
||||
ensure_installed = {
|
||||
"python",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"elixir",
|
||||
"heex",
|
||||
"javascript",
|
||||
"html",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
}
|
17
lua/t0xa/plugins/vim-tmux-navigator.lua
Normal file
17
lua/t0xa/plugins/vim-tmux-navigator.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"christoomey/vim-tmux-navigator",
|
||||
cmd = {
|
||||
"TmuxNavigateLeft",
|
||||
"TmuxNavigateDown",
|
||||
"TmuxNavigateUp",
|
||||
"TmuxNavigateRight",
|
||||
"TmuxNavigatePrevious",
|
||||
},
|
||||
keys = {
|
||||
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
|
||||
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
|
||||
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
|
||||
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
|
||||
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
|
||||
},
|
||||
}
|
19
lua/t0xa/plugins/which-key.lua
Normal file
19
lua/t0xa/plugins/which-key.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
-- Telling nvim that it can load this plugin later, and that it is not
|
||||
-- that important for initial UI
|
||||
event = "VeryLazy",
|
||||
-- Function that will run while neovim startup instead of when plugin is actualy loads
|
||||
init = function()
|
||||
-- How long which-key will wait until activation
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
end,
|
||||
-- Options that will pass to setup function, but we are leaving it empty to use
|
||||
-- default configuration
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
}
|
15
snippets/package.json
Normal file
15
snippets/package.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "custom-snippets",
|
||||
"engines": {
|
||||
"vscode": "^1.11.0"
|
||||
},
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "python",
|
||||
"path": "./python.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
26
snippets/python.json
Normal file
26
snippets/python.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"implog": {
|
||||
"prefix": "implog",
|
||||
"body": [
|
||||
"import logging",
|
||||
"_log = logging.getLogger(__name__)"
|
||||
],
|
||||
"description": "Snippet for importing logger"
|
||||
},
|
||||
"Log event": {
|
||||
"prefix": "logevent",
|
||||
"body": [
|
||||
"_log.error('${1:delimiter}' * 60)",
|
||||
"_log.error(${2})",
|
||||
"_log.error('${1:delimiter}' * 60)"
|
||||
],
|
||||
"description": "Snippet for inserting error log"
|
||||
},
|
||||
"Log debug": {
|
||||
"prefix": "logdebug",
|
||||
"body": [
|
||||
"_log.debug(${1:deug_body})"
|
||||
],
|
||||
"description": "Snippet for inserting debug log"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue