inital commit
This commit is contained in:
54
lua/config/autocmds.lua
Normal file
54
lua/config/autocmds.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
local function find_python_executable()
|
||||
if vim.env.VIRTUAL_ENV then
|
||||
local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/bin/python", true, true)
|
||||
local executable_path = table.concat(paths, ", ")
|
||||
if executable_path ~= "" then
|
||||
vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {})
|
||||
return executable_path
|
||||
end
|
||||
elseif vim.fn.filereadable(".venv/bin/python") == 1 then
|
||||
local executable_path = vim.fn.expand(".venv/bin/python")
|
||||
vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {})
|
||||
return executable_path
|
||||
end
|
||||
vim.api.nvim_echo({ { "No python executable found (see autocmds.lua)", "WarningMsg" } }, false, {})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "python" },
|
||||
callback = function()
|
||||
vim.g.python3_host_prog = find_python_executable() -- python executable
|
||||
vim.opt_local.colorcolumn = "72,88" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4 -- Number of spaces tabs count for
|
||||
vim.opt_local.shiftwidth = 4 -- Size of an indent
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "rust" },
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = "79" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4 -- Number of spaces tabs count for
|
||||
vim.opt_local.shiftwidth = 4 -- Size of an indent
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "typescript",
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = "79" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
end,
|
||||
})
|
||||
-- see lint.lua
|
||||
-- vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost" }, {
|
||||
-- callback = function()
|
||||
-- require("lint").try_lint()
|
||||
-- end,
|
||||
-- })
|
||||
22
lua/config/keymaps.lua
Normal file
22
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the keymap if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
map("n", "<leader>bo", "<cmd>%bd|e#<cr>", { desc = "Close all buffers but the current one" })
|
||||
62
lua/config/lazy.lua
Normal file
62
lua/config/lazy.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
-- "git"
|
||||
vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.docker" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{ import = "lazyvim.plugins.extras.lang.rust" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.tailwind" },
|
||||
{ import = "lazyvim.plugins.extras.lang.terraform" },
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.formatting.prettier" },
|
||||
{ import = "lazyvim.plugins.extras.linting.eslint" },
|
||||
{ import = "lazyvim.plugins.extras.test.core" },
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
{ import = "lazyvim.plugins.extras.dap.nlua" },
|
||||
-- { import = "lazyvim.plugins.extras.coding.copilot" }, -- see ai.lua instead
|
||||
{ import = "lazyvim.plugins.extras.coding.yanky" },
|
||||
{ import = "lazyvim.plugins.extras.util.mini-hipatterns" },
|
||||
{ import = "lazyvim.plugins.extras.vscode" },
|
||||
{ import = "lazyvim.plugins.extras.editor.mini-files" },
|
||||
{ import = "lazyvim.plugins.extras.coding.luasnip" },
|
||||
{ import = "lazyvim.plugins.extras.lsp.none-ls" },
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "catppuccin" } },
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
8
lua/config/options.lua
Normal file
8
lua/config/options.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
vim.opt.listchars = "tab:▸ ,trail:·,nbsp:␣,extends:❯,precedes:❮" -- show symbols for whitespace
|
||||
vim.opt.relativenumber = false -- relative line numbers
|
||||
vim.opt.scrolloff = 10 -- keep 20 lines above and below the cursor
|
||||
Reference in New Issue
Block a user