Add customizations
This commit is contained in:
parent
93fde0556e
commit
af39dd4a9f
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.wrap = true
|
|
@ -0,0 +1,10 @@
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>a",
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
|
||||||
|
-- or vim.lsp.buf.codeAction() if you don't want grouping.
|
||||||
|
end,
|
||||||
|
{ desc = "Rust LSP Code [Action]", silent = true, buffer = bufnr }
|
||||||
|
)
|
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.wrap = true
|
61
init.lua
61
init.lua
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed
|
-- Set to true if you have a Nerd Font installed
|
||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.opt`
|
-- See `:help vim.opt`
|
||||||
|
@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
-- Experiment for yourself to see if you like it!
|
-- Experiment for yourself to see if you like it!
|
||||||
-- vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.opt.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
|
@ -320,6 +320,9 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||||
|
|
||||||
|
--- Get undo history for telescope
|
||||||
|
'debugloop/telescope-undo.nvim',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||||
|
@ -363,6 +366,7 @@ require('lazy').setup({
|
||||||
-- Enable Telescope extensions if they are installed
|
-- Enable Telescope extensions if they are installed
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
pcall(require('telescope').load_extension, 'ui-select')
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
pcall(require('telescope').load_extension, 'undo')
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
local builtin = require 'telescope.builtin'
|
local builtin = require 'telescope.builtin'
|
||||||
|
@ -540,7 +544,8 @@ require('lazy').setup({
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
pyright = {},
|
||||||
|
ruff_lsp = {},
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
--
|
--
|
||||||
|
@ -565,6 +570,10 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
yamlls = { yaml = {} },
|
||||||
|
typst_lsp = { { filetypes = { 'typst' } } },
|
||||||
|
jsonls = { { filetypes = { 'json' } } },
|
||||||
|
taplo = { filetypes = { 'toml' } },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
-- Ensure the servers and tools above are installed
|
||||||
|
@ -593,6 +602,8 @@ require('lazy').setup({
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||||
require('lspconfig')[server_name].setup(server)
|
require('lspconfig')[server_name].setup(server)
|
||||||
end,
|
end,
|
||||||
|
-- rust_analyzer is set up by rustacevim
|
||||||
|
['rust_analyzer'] = function() end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
@ -644,12 +655,12 @@ require('lazy').setup({
|
||||||
-- `friendly-snippets` contains a variety of premade snippets.
|
-- `friendly-snippets` contains a variety of premade snippets.
|
||||||
-- See the README about individual language/framework/plugin snippets:
|
-- See the README about individual language/framework/plugin snippets:
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
-- https://github.com/rafamadriz/friendly-snippets
|
||||||
-- {
|
{
|
||||||
-- 'rafamadriz/friendly-snippets',
|
'rafamadriz/friendly-snippets',
|
||||||
-- config = function()
|
config = function()
|
||||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
-- end,
|
end,
|
||||||
-- },
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
@ -728,22 +739,18 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
{ -- You can easily change to a different colorscheme.
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
-- Change the name of the colorscheme plugin below, and then
|
||||||
-- change the command in the config to whatever the name of that colorscheme is.
|
-- change the command in the config to whatever the name of that colorscheme is.
|
||||||
--
|
--
|
||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
'ellisonleao/gruvbox.nvim',
|
||||||
'folke/tokyonight.nvim',
|
priority = 1000,
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
|
||||||
init = function()
|
init = function()
|
||||||
-- Load the colorscheme here.
|
require('gruvbox').setup {
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
overrides = { SignColumn = { bg = '' } },
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
}
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
vim.o.background = 'dark'
|
||||||
|
vim.cmd.colorscheme 'gruvbox'
|
||||||
-- You can configure highlights by doing something like:
|
|
||||||
vim.cmd.hi 'Comment gui=none'
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -791,7 +798,7 @@ require('lazy').setup({
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
ensure_installed = { 'bash', 'c', 'html', 'json', 'lua', 'luadoc', 'markdown', 'python', 'rust', 'toml', 'typst', 'vim', 'vimdoc', 'yaml' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
|
@ -827,16 +834,16 @@ require('lazy').setup({
|
||||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||||
--
|
--
|
||||||
-- require 'kickstart.plugins.debug',
|
require 'kickstart.plugins.debug',
|
||||||
-- require 'kickstart.plugins.indent_line',
|
require 'kickstart.plugins.indent_line',
|
||||||
-- require 'kickstart.plugins.lint',
|
require 'kickstart.plugins.lint',
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- This is the easiest way to modularize your config.
|
-- This is the easiest way to modularize your config.
|
||||||
--
|
--
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||||
-- { import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {
|
}, {
|
||||||
ui = {
|
ui = {
|
||||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||||
|
@ -859,5 +866,9 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Import custom settings
|
||||||
|
require 'custom.init'
|
||||||
|
require 'custom.keymap'
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Fold code by expression
|
||||||
|
vim.opt.foldenable = false
|
||||||
|
vim.opt.foldmethod = 'expr'
|
||||||
|
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
|
||||||
|
-- Turn off line wrapping
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
-- Typst filetype support
|
||||||
|
vim.filetype.add { extension = { typ = 'typst' } }
|
||||||
|
|
||||||
|
-- Reset the cursor after leaving vim. Without this, the cursor changes to a
|
||||||
|
-- block for the terminal.
|
||||||
|
vim.cmd [[
|
||||||
|
augroup RestoreCursorShapeOnExit
|
||||||
|
autocmd!
|
||||||
|
autocmd VimLeave * set guicursor=a:ver1
|
||||||
|
augroup END
|
||||||
|
]]
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- Custom keychains
|
||||||
|
require('which-key').register {
|
||||||
|
['<leader>p'] = { name = '[P]ython', _ = 'which_key_ignore' },
|
||||||
|
}
|
||||||
|
-- Undo
|
||||||
|
vim.keymap.set("n", "<leader>su", require("telescope").extensions.undo.undo, { desc = '[S]earch [U]ndo' })
|
||||||
|
|
||||||
|
-- Lazygit
|
||||||
|
vim.keymap.set("n", "<leader>gg", ":LazyGit<CR>", { desc = "[G]it Lazy[G]it" })
|
||||||
|
|
||||||
|
-- Debug
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Leader>pm", function() require("dap-python").test_method() end,
|
||||||
|
{ desc = '[P]ython Debug [M]ethod' })
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Leader>pc", function() require("dap-python").test_class() end,
|
||||||
|
{ desc = '[P]ython Debug [C]lass' })
|
||||||
|
vim.keymap.set("v", "<Leader>k", function() require("dapui").eval() end, { desc = "Debug: Eval" })
|
||||||
|
|
||||||
|
-- Navigate buffers
|
||||||
|
vim.keymap.set("n", "<leader>l", ":ls<CR>:b<space>", { desc = "Select buffer" })
|
||||||
|
|
||||||
|
-- Make
|
||||||
|
vim.keymap.set("n", "<leader>m", ":make <CR>", { desc = "[M]ake" })
|
||||||
|
|
||||||
|
-- Telescope undo
|
||||||
|
vim.keymap.set("n", "<leader>su", require("telescope").extensions.undo.undo, { desc = '[S]earch [U]ndo' })
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
-- Optional dependency
|
||||||
|
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||||
|
config = function()
|
||||||
|
require("nvim-autopairs").setup {}
|
||||||
|
-- If you want to automatically add `(` after selecting a function or method
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
local cmp = require('cmp')
|
||||||
|
cmp.event:on(
|
||||||
|
'confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done()
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
--- File explorer
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
'mrcjkb/rustaceanvim',
|
||||||
|
version = '^4', -- Recommended
|
||||||
|
ft = { 'rust' },
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
return { require 'lspconfig'.typst_lsp.setup {
|
||||||
|
settings = {
|
||||||
|
exportPdf = "never" -- Choose onType, onSave or never.
|
||||||
|
-- serverPath = "" -- Normally, there is no need to uncomment it.
|
||||||
|
}
|
||||||
|
} }
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
-- Seamless navigation between tmux panes and vim splits
|
||||||
|
'christoomey/vim-tmux-navigator',
|
||||||
|
config = function()
|
||||||
|
-- disable netrw for nvim-tree
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
end,
|
||||||
|
}
|
|
@ -22,7 +22,8 @@ return {
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
-- 'leoluz/nvim-dap-go',
|
||||||
|
'mfussenegger/nvim-dap-python',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
|
@ -41,7 +42,8 @@ return {
|
||||||
-- online, please don't ask me how to install them :)
|
-- online, please don't ask me how to install them :)
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
'delve',
|
-- 'delve',
|
||||||
|
'debugpy',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ return {
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup()
|
-- require('dap-go').setup()
|
||||||
|
require('dap-python').setup('~/.local/share/nvim/mason/packages/debugpy/venv/bin/python')
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue