treewide: chores

This commit is contained in:
Guanran Wang 2024-09-14 20:17:10 +08:00
parent 92228a6538
commit 2c3b306495
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF
5 changed files with 41 additions and 25 deletions

View file

@ -13,6 +13,9 @@ vim.opt.cursorline = true
vim.opt.number = true
vim.opt.relativenumber = true
-- Breakindent
vim.opt.breakindent = true
-- Mouse
vim.cmd([[
aunmenu PopUp.How-to\ disable\ mouse
@ -29,7 +32,10 @@ vim.opt.ignorecase = true
vim.opt.smartcase = true
-- System integration
vim.opt.clipboard = "unnamedplus"
-- https://github.com/nvim-lua/kickstart.nvim/blob/7201dc480134f41dd1be1f8f9b8f8470aac82a3b/init.lua#L113-L119
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
vim.opt.swapfile = false
vim.opt.undofile = true
@ -42,12 +48,3 @@ vim.opt.tabstop = 2
vim.opt.laststatus = 3
vim.opt.showmode = false -- Handled by lualine
vim.opt.signcolumn = "yes" -- Prevents shifting
-- Neovide specific settings
if vim.g.neovide then
vim.opt.guifont = "monospace:h12"
-- Terminal-emulator-like copy/pasting
vim.api.nvim_set_keymap("n", "<C-C>", '"+y', { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<C-V>", '"+p', { noremap = true, silent = true })
end

View file

@ -6,12 +6,19 @@ return {
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
"neovim/nvim-lspconfig",
-- Snippets
{
"L3MON4D3/LuaSnip", -- snippet engine
dependencies = {
"rafamadriz/friendly-snippets", -- pre-configured snippet texts
"saadparwaiz1/cmp_luasnip", -- nvim-cmp source
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
},
},
event = { "InsertEnter", "CmdlineEnter" },
opts = function()
@ -23,8 +30,6 @@ return {
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
-- keybinds
-- see: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings
@ -32,10 +37,8 @@ return {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
@ -44,14 +47,27 @@ return {
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<CR>"] = cmp.mapping.confirm(),
["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() then
if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({
select = true,
})
end
else
fallback()
end
end),
["<Up>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
["<Down>"] = cmp.mapping.select_next_item({ behavior = "select" }),
},

View file

@ -15,7 +15,7 @@ return {
end,
keys = {
{
"<leader>lf",
"<leader>f",
function()
vim.lsp.buf.format()
end,

View file

@ -2,7 +2,10 @@ return {
"nvim-tree/nvim-tree.lua",
opts = {
view = {
adaptive_size = true,
side = "right",
},
renderer = {
symlink_destination = false, -- usually too long
},
},
init = function()

View file

@ -7,8 +7,8 @@ return {
opts = {},
cmd = "Telescope",
keys = {
{ "<leader>f", "<cmd>Telescope find_files<CR>", desc = "Find files" },
{ "<leader><leader>", "<cmd>Telescope oldfiles<CR>", desc = "Recent files" },
{ "<leader>sf", "<cmd>Telescope find_files<CR>", desc = "Find files" },
{ "<leader>sg", "<cmd>Telescope live_grep<CR>", desc = "Live grep" },
},
}