Compare commits
17 Commits
a880f3a2c1
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d22c843462 | |||
| 787871f897 | |||
| 0da0684f14 | |||
| 8d58de8cd1 | |||
| ee42090f4f | |||
| 254eca6c11 | |||
| eb7111025a | |||
| 49c7c3f9e6 | |||
| 85a216b44e | |||
| 559319f6af | |||
| 48223a6f54 | |||
| 2b60372114 | |||
| 7aceac087e | |||
| 44fdfa566d | |||
| 1f54f75f62 | |||
| a9f320f6f1 | |||
| b9b395b736 |
@@ -1,4 +1,5 @@
|
||||
lua require('config.init')
|
||||
lua require('status-line')
|
||||
|
||||
" vim.fn.stdpath("data")
|
||||
"lua require('plugins')
|
||||
@@ -28,7 +29,7 @@ call matchadd('ColorColumn', '\%81v', 100)
|
||||
" Find files and tab autocomplete
|
||||
set path+=**
|
||||
set wildmenu
|
||||
nnoremap <leader>fi :find<Space>
|
||||
"nnoremap <leader>fi :find<Space>
|
||||
|
||||
autocmd TermOpen * setlocal nonumber
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
cmd = { "lua-language-server" },
|
||||
filetypes = { "lua" },
|
||||
root_markers = { { ".luarc.json", ".luarc.jsonc" }, ".git" },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
---@brief
|
||||
---
|
||||
--- https://github.com/microsoft/pyright
|
||||
---
|
||||
--- `pyright`, a static type checker and language server for python
|
||||
|
||||
local function set_python_path(command)
|
||||
local path = command.args
|
||||
local clients = vim.lsp.get_clients {
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
name = 'pyright',
|
||||
}
|
||||
for _, client in ipairs(clients) do
|
||||
if client.settings then
|
||||
client.settings.python =
|
||||
vim.tbl_deep_extend('force', client.settings.python --[[@as table]], { pythonPath = path })
|
||||
else
|
||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } })
|
||||
end
|
||||
client:notify('workspace/didChangeConfiguration', { settings = nil })
|
||||
end
|
||||
end
|
||||
|
||||
---@type vim.lsp.Config
|
||||
return {
|
||||
cmd = { 'pyright-langserver', '--stdio' },
|
||||
filetypes = { 'python' },
|
||||
root_markers = {
|
||||
'pyrightconfig.json',
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'.git',
|
||||
},
|
||||
---@type lspconfig.settings.pyright
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'openFilesOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
||||
local params = {
|
||||
command = 'pyright.organizeimports',
|
||||
arguments = { vim.uri_from_bufnr(bufnr) },
|
||||
}
|
||||
|
||||
-- Using client.request() directly because "pyright.organizeimports" is private
|
||||
-- (not advertised via capabilities), which client:exec_cmd() refuses to call.
|
||||
-- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
client.request('workspace/executeCommand', params, nil, bufnr)
|
||||
end, {
|
||||
desc = 'Organize Imports',
|
||||
})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, {
|
||||
desc = 'Reconfigure pyright with the provided python path',
|
||||
nargs = 1,
|
||||
complete = 'file',
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
local M = {}
|
||||
|
||||
CmdsList = nil
|
||||
|
||||
function M.checkCommand(cmd, desc)
|
||||
local toRun = ""
|
||||
|
||||
if IS_UNIX then
|
||||
toRun = "command -v " .. cmd
|
||||
else
|
||||
toRun = "where " .. cmd
|
||||
end
|
||||
|
||||
local p = io.popen(toRun)
|
||||
local output = p:read("*l")
|
||||
p:close()
|
||||
|
||||
if output == nil and desc ~= nil and desc ~= "" then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " [" .. desc .. "] - not found!", "DiagnosticError" } }, true, {})
|
||||
elseif output == nil then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " not found!", "DiagnosticError" } }, true, {})
|
||||
else
|
||||
vim.api.nvim_echo({ { " ✓ " .. cmd, "DiagnosticOk" } }, true, {})
|
||||
end
|
||||
end
|
||||
|
||||
function M.run()
|
||||
if CmdsList == nil or next(CmdsList) == nil then
|
||||
vim.api.nvim_echo({ { "Dependencies list passed is null or empty, nothing to check", "DiagnosticWarn" } }, true, {})
|
||||
return
|
||||
end
|
||||
|
||||
print("Check installed system commands:")
|
||||
for _, cmd in ipairs(CmdsList) do
|
||||
M.checkCommand(cmd.cmd, cmd.desc)
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(cmds)
|
||||
IS_UNIX = package.config:sub(1, 1) ~= "\\"
|
||||
CmdsList = cmds
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,28 @@
|
||||
function Run()
|
||||
local dep = require("check_dependencies")
|
||||
|
||||
dep.setup({
|
||||
{ cmd = "git", desc = "git" },
|
||||
|
||||
-- fzf dependencies
|
||||
{ cmd = "fzf", desc = "fuzzy finder" },
|
||||
{ cmd = "fd", desc = "better find" },
|
||||
{ cmd = "bat", desc = "cat clone" },
|
||||
{ cmd = "rg", desc = "rip grep" },
|
||||
|
||||
-- Conform => formatters
|
||||
{ cmd = "stylua", desc = "lua formatter" },
|
||||
{ cmd = "ruff", desc = "python formatter" },
|
||||
|
||||
-- Lsp server
|
||||
{ cmd = "lua-language-server", desc = "lua lsp server" },
|
||||
{ cmd = "pyright-langserver", desc = "python lsp server" },
|
||||
|
||||
-- Test not exists
|
||||
{ cmd = "fff", desc = "test not exists command" },
|
||||
})
|
||||
|
||||
dep.run()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("DependenciesCheck", Run, {})
|
||||
@@ -0,0 +1,6 @@
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "ruff_format"},
|
||||
},
|
||||
})
|
||||
+44
-1
@@ -1 +1,44 @@
|
||||
vim.keymap.set('n', '<leader>f', '<cmd>FzfLua<cr>')
|
||||
vim.keymap.set("n", "<leader>fz", "<cmd>FzfLua<cr>")
|
||||
vim.keymap.set("n", "<leader>ff", "<cmd>FzfLua files<cr>")
|
||||
vim.keymap.set("n", "<leader>fg", "<cmd>FzfLua live_grep<cr>")
|
||||
vim.keymap.set("n", "<leader>fr", "<cmd>FzfLua resume<cr>")
|
||||
vim.keymap.set("n", "<leader>fb", "<cmd>FzfLua buffers<cr>")
|
||||
vim.keymap.set("n", "<leader>fw", "<cmd>FzfLua grep_cword<cr>")
|
||||
vim.keymap.set("n", "<leader>fW", "<cmd>FzfLua grep_cWORD<cr>")
|
||||
|
||||
require("fzf-lua").setup({
|
||||
defaults = {
|
||||
formatter = "path.dirname_first",
|
||||
},
|
||||
winopts = {
|
||||
fullscreen = true,
|
||||
preview = {
|
||||
default = "bat",
|
||||
vertical = "down:60%",
|
||||
horizontal = "right:50%",
|
||||
layout = "vertical",
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
fzf = {
|
||||
["ctrl-z"] = "abort",
|
||||
["ctrl-u"] = "unix-line-discard",
|
||||
["ctrl-f"] = "half-page-down",
|
||||
["ctrl-b"] = "half-page-up",
|
||||
["ctrl-a"] = "beginning-of-line",
|
||||
["ctrl-e"] = "end-of-line",
|
||||
["alt-a"] = "toggle-all",
|
||||
["alt-g"] = "first",
|
||||
["alt-G"] = "last",
|
||||
["ctrl-k"] = "up",
|
||||
["ctrl-j"] = "down",
|
||||
|
||||
-- Only valid with fzf previewers (bat/cat/git/etc)
|
||||
["f3"] = "toggle-preview-wrap",
|
||||
["f4"] = "toggle-preview",
|
||||
["ctrl-q"] = "select-all+accept",
|
||||
-- ["<S-e>"] = "preview-page-down",
|
||||
-- ["<S-y>"] = "preview-page-up",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
require('ibl').setup({
|
||||
indent = { char= '¦' },
|
||||
scope = { enabled = false},
|
||||
--use_treesitter = true,
|
||||
})
|
||||
+14
-8
@@ -1,9 +1,15 @@
|
||||
require('config.settings')
|
||||
require('config.keybinds')
|
||||
require('config.pack')
|
||||
require("config.settings")
|
||||
require("config.keybinds")
|
||||
require("config.pack")
|
||||
require("config.lsp")
|
||||
|
||||
require("config.theme")
|
||||
require("config.neogit")
|
||||
require("config.oil")
|
||||
require("config.autopairs")
|
||||
require("config.fzf")
|
||||
require("config.indent_blank_line")
|
||||
require("config.conform")
|
||||
|
||||
require("config.check_dependencies")
|
||||
|
||||
require('config.theme')
|
||||
require('config.neogit')
|
||||
require('config.oil')
|
||||
require('config.autopairs')
|
||||
require('config.fzf')
|
||||
|
||||
+34
-32
@@ -1,42 +1,43 @@
|
||||
vim.api.nvim_create_user_command('W', "update", { nargs='?'})
|
||||
vim.api.nvim_create_user_command("W", "update", { nargs = "?" })
|
||||
|
||||
local bind = vim.keymap.set
|
||||
|
||||
vim.g.mapleader = ","
|
||||
|
||||
bind('n', '<leader>v', '<cmd>vsp<cr><C-w>l', { desc = 'Vertical split' })
|
||||
bind('n', '<leader>e', '<cmd>e .<cr><cmd>set relativenumber<cr>', { desc = 'Netrw file manager' })
|
||||
bind("n", "<leader>v", "<cmd>vsp<cr><C-w>l", { desc = "Vertical split" })
|
||||
bind("n", "<leader>e", "<cmd>e .<cr><cmd>set relativenumber<cr>", { desc = "Netrw file manager" })
|
||||
|
||||
-- Buffer navigation
|
||||
bind('n', '<M-l>', '<cmd>bp<cr>', { desc = 'Buffer previous' })
|
||||
bind('n', '<M-h>', '<cmd>bn<cr>', { desc = 'Buffer next' })
|
||||
bind('n', '<M-Down>', '<cmd>CloseOpenBuff<cr>', { desc = 'Buffer close' })
|
||||
bind("n", "<M-l>", "<cmd>bp<cr>", { desc = "Buffer previous" })
|
||||
bind("n", "<M-h>", "<cmd>bn<cr>", { desc = "Buffer next" })
|
||||
bind("n", "<M-Down>", "<cmd>CloseOpenBuff<cr>", { desc = "Buffer close" })
|
||||
|
||||
-- Buffer resize
|
||||
bind('n', '<leader>+', '<cmd>vertical resize +5<cr>', { desc = 'Buffer increase size' })
|
||||
bind('n', '<leader>-', '<cmd>vertical resize -5<cr>', { desc = 'Buffer decrease size' })
|
||||
bind("n", "<leader>+", "<cmd>vertical resize +5<cr>", { desc = "Buffer increase size" })
|
||||
bind("n", "<leader>-", "<cmd>vertical resize -5<cr>", { desc = "Buffer decrease size" })
|
||||
|
||||
-- Tab movements
|
||||
bind('n', '<C-M-n>', '<cmd>tabnew<cr>', { desc = 'New tab' })
|
||||
bind('n', '<C-M-Down>', '<cmd>tabclose<cr>', { desc = 'Close tab' })
|
||||
bind('n', '<C-M-l>', '<cmd>tabnext<cr>', { desc = 'Next tab' })
|
||||
bind('n', '<C-M-h>', '<cmd>tabprevious<cr>', { desc = 'Previous tab' })
|
||||
bind("n", "<C-M-n>", "<cmd>tabnew<cr>", { desc = "New tab" })
|
||||
bind("n", "<C-M-Down>", "<cmd>tabclose<cr>", { desc = "Close tab" })
|
||||
bind("n", "<C-M-l>", "<cmd>tabnext<cr>", { desc = "Next tab" })
|
||||
bind("n", "<C-M-h>", "<cmd>tabprevious<cr>", { desc = "Previous tab" })
|
||||
|
||||
-- Movements into buffer
|
||||
bind('n', "<C-d>", "<C-d>zz", { desc = 'Center cursor after page down' })
|
||||
bind('n', "<C-u>", "<C-u>zz", { desc = 'Center cursor after page up' })
|
||||
bind("n", "<C-d>", "<C-d>zz", { desc = "Center cursor after page down" })
|
||||
bind("n", "<C-u>", "<C-u>zz", { desc = "Center cursor after page up" })
|
||||
|
||||
-- Move lines in visual mode
|
||||
bind('v', 'K', ":m '<-2<cr>gv=gv", { desc = 'Move highlighted lines up' })
|
||||
bind('v', 'J', ":m '>+1<cr>gv=gv", { desc = 'Move highlighted lines down' })
|
||||
bind("v", "K", ":m '<-2<cr>gv=gv", { desc = "Move highlighted lines up" })
|
||||
bind("v", "J", ":m '>+1<cr>gv=gv", { desc = "Move highlighted lines down" })
|
||||
|
||||
-- Text cleaning
|
||||
bind('n', '<leader>w', '<cmd>%s/\\s\\+$/<cr><cmd>nohlsearch<cr>', { desc = 'Delete white spaces at end of each line' })
|
||||
bind("n", "<leader>w", "<cmd>%s/\\s\\+$/<cr><cmd>nohlsearch<cr>", { desc = "Delete white spaces at end of each line" })
|
||||
|
||||
-- Quick fix list
|
||||
bind('n', '<leader>cc', '<cmd>cclose<cr>')
|
||||
bind('n', '<leader>co', '<cmd>copen<cr>')
|
||||
bind("n", "<leader>cc", "<cmd>cclose<cr>")
|
||||
bind("n", "<leader>co", "<cmd>copen<cr>")
|
||||
|
||||
-- Oil vim
|
||||
vim.keymap.set("n", "<M-1>", function()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
if dir == "" then
|
||||
@@ -45,18 +46,19 @@ vim.keymap.set("n", "<M-1>", function()
|
||||
require("oil").open(dir)
|
||||
end, { desc = "Open Oil in current file directory" })
|
||||
|
||||
-- Telescope
|
||||
-- bind('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
|
||||
-- bind('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
|
||||
-- bind('n', '<leader>fg', require("telescope").extensions.live_grep_args.live_grep_args, { noremap = true })
|
||||
-- bind('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
|
||||
-- bind('n', '<leader>fh', '<cmd>Telescope help_tags<cr>')
|
||||
-- Conform
|
||||
vim.api.nvim_create_user_command("FormatConform", function(opts)
|
||||
require("conform").format()
|
||||
end, {
|
||||
desc = "Format current buffer",
|
||||
})
|
||||
|
||||
-- Testing funcs
|
||||
-- vim.api.nvim_create_user_command('MyFuncs', require('my_funcs').reopen, { nargs='?'})
|
||||
-- bind('n', '<leader>r', '<cmd>MyFuncs<cr>')
|
||||
|
||||
-- vim.api.nvim_create_user_command('MyFuncsPP', require('my_funcs').print_path, { nargs='?'})
|
||||
-- bind('n', '<leader>pp', '<cmd>MyFuncsPP<cr>')
|
||||
-- bind({'n', 'i'}, '<C-w>', '<cmd>w<cr>', { desc = 'Save with CTRL+s' })
|
||||
bind("n", "<leader><C-M-l>", "<cmd>FormatConform<cr>")
|
||||
|
||||
-- Lsp
|
||||
bind("n", "<C-h>", vim.diagnostic.open_float)
|
||||
bind("n", "<leader>gl", vim.diagnostic.setloclist)
|
||||
bind("n", "<leader>gq", vim.diagnostic.setqflist)
|
||||
bind("n", "<leader>gf", vim.lsp.buf.format)
|
||||
bind("n", "K", vim.lsp.buf.hover)
|
||||
bind("n", "<leader>k", vim.lsp.buf.signature_help)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
| Set | Mapping | Function | Neovim Function | Brief Description |
|
||||
| --- | ------------- | ---------------------------- | --------------------------------------- | --------------------------------------------------------------------------- |
|
||||
| y | `gd` | Go to Definition | `vim.lsp.buf.definition()` | Jump to the symbol's definition. |
|
||||
| y | `gD` | Go to Declaration | `vim.lsp.buf.declaration()` | Jump to the symbol's declaration. |
|
||||
| y | `K` | Hover Documentation | `vim.lsp.buf.hover()` | Show documentation and type information for the symbol under the cursor. |
|
||||
| y | `<leader>k` | Signature Help | `vim.lsp.buf.signature_help()` | Display the current function signature and parameter information. |
|
||||
| y | `grr` | Find References | `vim.lsp.buf.references()` | List all references to the symbol across the project. |
|
||||
| y | `gri` | Go to Implementation | `vim.lsp.buf.implementation()` | Jump to the implementation(s) of the symbol. |
|
||||
| y | `grt` | Go to Type Definition | `vim.lsp.buf.type_definition()` | Jump to the definition of the symbol's type. |
|
||||
| y | `grn` | Rename Symbol | `vim.lsp.buf.rename()` | Rename the symbol and update all references. |
|
||||
| y | `gra` | Code Actions | `vim.lsp.buf.code_action()` | Show available quick fixes and refactoring actions. |
|
||||
| ? | `gO` | Document Symbols | `vim.lsp.buf.document_symbol()` | List all symbols (functions, classes, variables, etc.) in the current file. |
|
||||
| y | `[d` | Previous Diagnostic | `vim.diagnostic.goto_prev()` | Jump to the previous diagnostic (error, warning, hint, or info). |
|
||||
| y | `]d` | Next Diagnostic | `vim.diagnostic.goto_next()` | Jump to the next diagnostic. |
|
||||
| y | `<leader>e` | Diagnostic Float | `vim.diagnostic.open_float()` | Show diagnostic details in a floating window. |
|
||||
| y | `<leader>gl` | Diagnostics to Location List | `vim.diagnostic.setloclist()` | Populate the location list with diagnostics from the current buffer. |
|
||||
| y | `<leader>f` | Format Buffer | `vim.lsp.buf.format()` | Format the current buffer using the LSP server. |
|
||||
| n | `<leader>wa` | Add Workspace Folder | `vim.lsp.buf.add_workspace_folder()` | Add a folder to the current LSP workspace. |
|
||||
| n | `<leader>wr` | Remove Workspace Folder | `vim.lsp.buf.remove_workspace_folder()` | Remove a folder from the current LSP workspace. |
|
||||
| n | `<leader>wl` | List Workspace Folders | `vim.lsp.buf.list_workspace_folders()` | List all folders in the current LSP workspace. |
|
||||
| n | `<leader>cl` | Run CodeLens | `vim.lsp.codelens.run()` | Execute the CodeLens action at the current cursor position. |
|
||||
| n | `<leader>cr` | Refresh CodeLens | `vim.lsp.codelens.refresh()` | Refresh available CodeLens actions in the buffer. |
|
||||
| n | `<leader>th` | Toggle Inlay Hints | `vim.lsp.inlay_hint.enable()` | Enable or disable inline type and parameter hints. |
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
vim.o.autocomplete = true
|
||||
vim.opt.complete:append('o')
|
||||
vim.o.pummaxwidth = 40
|
||||
vim.o.completeopt = "fuzzy,menuone,noselect,noinsert"
|
||||
|
||||
vim.lsp.enable({
|
||||
"lua_ls",
|
||||
"python_ls"
|
||||
})
|
||||
|
||||
@@ -6,4 +6,5 @@ vim.pack.add({
|
||||
{ src = "https://github.com/windwp/nvim-autopairs", name = "nvim-autopairs" },
|
||||
{ src = "https://github.com/ibhagwan/fzf-lua", name = "fzf-lua" },
|
||||
{ src = "https://github.com/lukas-reineke/indent-blankline.nvim", name = "indent-blankline.nvim" },
|
||||
{ src = "https://github.com/stevearc/conform.nvim", name = "conform.nvim" },
|
||||
})
|
||||
|
||||
@@ -18,8 +18,8 @@ local function statusline()
|
||||
local align_right = "%="
|
||||
local fileencoding = " %{&fileencoding?&fileencoding:&encoding}"
|
||||
local fileformat = "[%{&fileformat}]"
|
||||
local percentage = " %p%%"
|
||||
local linecol = "%l/%L:%c"
|
||||
local percentage = "|%p%%"
|
||||
|
||||
if branch then
|
||||
return string.format(
|
||||
@@ -31,7 +31,7 @@ local function statusline()
|
||||
modified,
|
||||
align_right,
|
||||
fileencoding,
|
||||
filetype,
|
||||
-- filetype,
|
||||
fileformat,
|
||||
linecol,
|
||||
percentage
|
||||
@@ -44,7 +44,7 @@ local function statusline()
|
||||
modified,
|
||||
align_right,
|
||||
fileencoding,
|
||||
filetype,
|
||||
-- filetype,
|
||||
fileformat,
|
||||
linecol,
|
||||
percentage
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
"rev": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c",
|
||||
"src": "https://github.com/catppuccin/nvim"
|
||||
},
|
||||
"fzf'lua": {
|
||||
"rev": "39da6060d53659acf3ec118200bc48721b29b8fd",
|
||||
"src": "https://github.com/ibhagwan/fzf-lua"
|
||||
"conform.nvim": {
|
||||
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
|
||||
"src": "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
"fzf-lua": {
|
||||
"rev": "39da6060d53659acf3ec118200bc48721b29b8fd",
|
||||
|
||||
Reference in New Issue
Block a user