Update config
This commit is contained in:
parent
5e426a71ab
commit
1c38bdd406
1
init.lua
1
init.lua
@ -12,5 +12,6 @@ end
|
|||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
require("vim_options")
|
require("vim_options")
|
||||||
|
require("keybinds")
|
||||||
require("lazy").setup("plugins")
|
require("lazy").setup("plugins")
|
||||||
|
|
||||||
|
2
lua/keybinds.lua
Normal file
2
lua/keybinds.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
vim.keymap.set("n", "<C-w>", ":bdelete<CR>")
|
||||||
|
vim.keymap.set("n", "<C-t>", ":enew<CR>")
|
@ -10,8 +10,8 @@ return {
|
|||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"ruff_lsp",
|
|
||||||
"pyright",
|
"pyright",
|
||||||
|
"clangd",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -26,9 +26,13 @@ return {
|
|||||||
capabilities=capabilities
|
capabilities=capabilities
|
||||||
})
|
})
|
||||||
lspconfig.pyright.setup({
|
lspconfig.pyright.setup({
|
||||||
capabilities=capabilities
|
capabilities=capabilities,
|
||||||
|
filetypes = {"python"}
|
||||||
})
|
})
|
||||||
lspconfig.ruff_lsp.setup({
|
--lspconfig.ruff_lsp.setup({
|
||||||
|
-- capabilities=capabilities
|
||||||
|
--})
|
||||||
|
lspconfig.clangd.setup({
|
||||||
capabilities=capabilities
|
capabilities=capabilities
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,12 +1,60 @@
|
|||||||
|
local is_neotree_focused = function()
|
||||||
|
-- Get our current buffer number
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf and vim.api.nvim_get_current_buf() or vim.fn.bufnr()
|
||||||
|
-- Get all the available sources in neo-tree
|
||||||
|
for _, source in ipairs(require("neo-tree").config.sources) do
|
||||||
|
-- Get each sources state
|
||||||
|
local state = require("neo-tree.sources.manager").get_state(source)
|
||||||
|
-- Check if the source has a state, if the state has a buffer and if the buffer is our current buffer
|
||||||
|
if state and state.bufnr and state.bufnr == bufnr then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_neotree_open()
|
||||||
|
local manager = require("neo-tree.sources.manager")
|
||||||
|
local renderer = require("neo-tree.ui.renderer")
|
||||||
|
|
||||||
|
local success, state = pcall(manager.get_state, "filesystem")
|
||||||
|
|
||||||
|
if not success then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local window_exists = renderer.window_exists(state)
|
||||||
|
return window_exists
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If the tree is currently open and focused, then close it. If it's not open, or it's open
|
||||||
|
-- but not currently focused, it is made focused.
|
||||||
|
-- Effectively prevents the need to close and re-open it to gain focus of the tree.
|
||||||
|
local function toggle()
|
||||||
|
local cmd = require("neo-tree.command")
|
||||||
|
if is_neotree_open() and is_neotree_focused() then
|
||||||
|
cmd.execute({
|
||||||
|
action = "close",
|
||||||
|
})
|
||||||
|
else
|
||||||
|
cmd.execute({
|
||||||
|
action = "focus",
|
||||||
|
source = "filesystem",
|
||||||
|
position = "left",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
branch = "v3.x",
|
branch = "v3.x",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
},
|
},
|
||||||
config=function()
|
config = function()
|
||||||
vim.keymap.set("n", "<C-h>", ":Neotree filesystem toggle left<CR>")
|
--vim.keymap.set("n", "<C-h>", ":Neotree filesystem toggle left<CR>")
|
||||||
end
|
vim.keymap.set("n", "<C-h>", toggle, {})
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,29 @@ return {
|
|||||||
"nvimtools/none-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
config=function()
|
config=function()
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
-- null_ls.builtins.formatting.stylua, -- THIS SUCKS ASS
|
null_ls.builtins.formatting.stylua, -- THIS SUCKS ASS
|
||||||
null_ls.builtins.formatting.isort,
|
|
||||||
null_ls.builtins.formatting.black,
|
null_ls.builtins.formatting.black,
|
||||||
}
|
null_ls.builtins.diagnostics.mypy,
|
||||||
|
--null_ls.builtins.diagnostics.ruff,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.supports_method("textDocument/formatting") then
|
||||||
|
vim.api.nvim_clear_autocmds({
|
||||||
|
group = augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function ()
|
||||||
|
vim.lsp.buf.format({bufnr = bufnr})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, {})
|
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, {})
|
||||||
end
|
end
|
||||||
|
20
lua/plugins/tabline.lua
Normal file
20
lua/plugins/tabline.lua
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
return {
|
||||||
|
"romgrk/barbar.nvim",
|
||||||
|
config = function ()
|
||||||
|
require('lazy').setup {
|
||||||
|
{'romgrk/barbar.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||||
|
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
||||||
|
},
|
||||||
|
init = function() vim.g.barbar_auto_setup = false end,
|
||||||
|
opts = {
|
||||||
|
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
|
||||||
|
-- animation = true,
|
||||||
|
-- insert_at_start = true,
|
||||||
|
-- …etc.
|
||||||
|
},
|
||||||
|
version = '^1.0.0', -- optional: only update when a new 1.x version is released
|
||||||
|
},
|
||||||
|
} end
|
||||||
|
}
|
17
lua/plugins/transparent.lua
Normal file
17
lua/plugins/transparent.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
"xiyaowong/transparent.nvim",
|
||||||
|
config = function ()
|
||||||
|
require("transparent").setup({ -- Optional, you don't have to run setup.
|
||||||
|
groups = { -- table: default groups
|
||||||
|
'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier',
|
||||||
|
'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String', 'Function',
|
||||||
|
'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText',
|
||||||
|
'SignColumn', 'CursorLine', 'CursorLineNr', 'StatusLine', 'StatusLineNC',
|
||||||
|
'EndOfBuffer',
|
||||||
|
},
|
||||||
|
extra_groups = {}, -- table: additional groups that should be cleared
|
||||||
|
exclude_groups = {}, -- table: groups you don't want to clear
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ return {
|
|||||||
config=function()
|
config=function()
|
||||||
local config = require("nvim-treesitter.configs")
|
local config = require("nvim-treesitter.configs")
|
||||||
config.setup({
|
config.setup({
|
||||||
ensure_installed = {"lua", "python", "rust"},
|
ensure_installed = {"lua", "python", "rust", "c"},
|
||||||
highlight = {enable=true},
|
highlight = {enable=true},
|
||||||
indent = {enable=true},
|
indent = {enable=true},
|
||||||
})
|
})
|
||||||
|
@ -9,6 +9,7 @@ vim.opt.number = true
|
|||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.fillchars="eob: " -- Remove the trailing ~s
|
vim.opt.fillchars="eob: " -- Remove the trailing ~s
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
-- Instant.nvim for Live Share function
|
-- Instant.nvim for Live Share function
|
||||||
require("instant_options")
|
require("instant_options")
|
||||||
|
18
test.py
Normal file
18
test.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
def primes(n: int):
|
||||||
|
"""Return whether the number is prime for the first n primes."""
|
||||||
|
sieve = [True] * n
|
||||||
|
|
||||||
|
res = []
|
||||||
|
|
||||||
|
for i in range(2, n):
|
||||||
|
if sieve[i]:
|
||||||
|
res.append(i)
|
||||||
|
for j in range(i * i, n, i):
|
||||||
|
sieve[j] = False
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
xs = primes(100)
|
||||||
|
ys = primes(200)
|
||||||
|
print(xs)
|
Loading…
Reference in New Issue
Block a user