Add nvim config
This commit is contained in:
parent
92366b38ac
commit
df7bfd1282
14 changed files with 285 additions and 0 deletions
.config/nvim/after/plugin
8
.config/nvim/after/plugin/colors.lua
Normal file
8
.config/nvim/after/plugin/colors.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local dracula = require("dracula")
|
||||
dracula.setup({
|
||||
-- show the '~' characters after the end of buffers
|
||||
show_end_of_buffer = true, -- default false
|
||||
-- use transparent background
|
||||
transparent_bg = true, -- default false
|
||||
})
|
||||
vim.cmd('colorscheme dracula')
|
1
.config/nvim/after/plugin/fugitive.lua
Normal file
1
.config/nvim/after/plugin/fugitive.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
68
.config/nvim/after/plugin/lsp.lua
Normal file
68
.config/nvim/after/plugin/lsp.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
local lsp = require("lsp-zero")
|
||||
|
||||
lsp.preset("recommended")
|
||||
|
||||
lsp.ensure_installed({
|
||||
-- 'bashls',
|
||||
-- 'lua_ls',
|
||||
-- 'pylsp',
|
||||
-- 'rnix',
|
||||
})
|
||||
|
||||
-- Fix Undefined global 'vim'
|
||||
require('lspconfig').lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
cmp_mappings['<Tab>'] = nil
|
||||
cmp_mappings['<S-Tab>'] = nil
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings
|
||||
})
|
||||
|
||||
lsp.set_preferences({
|
||||
suggest_lsp_servers = false,
|
||||
sign_icons = {
|
||||
error = 'E',
|
||||
warn = 'W',
|
||||
hint = 'H',
|
||||
info = 'I'
|
||||
}
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
end)
|
||||
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true
|
||||
})
|
41
.config/nvim/after/plugin/lualine.lua
Normal file
41
.config/nvim/after/plugin/lualine.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local function window()
|
||||
return vim.api.nvim_win_get_number(0)
|
||||
end
|
||||
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'dracula',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { {
|
||||
'filename',
|
||||
path = 1,
|
||||
} },
|
||||
lualine_x = { 'encoding', '%<0x%B', 'fileformat' },
|
||||
lualine_y = { 'filetype' },
|
||||
lualine_z = { 'location', window }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location', window },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = { {
|
||||
'tabs',
|
||||
max_length = vim.o.columns / 2,
|
||||
mode = 2
|
||||
} },
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { 'branch' },
|
||||
lualine_z = {}
|
||||
}
|
||||
})
|
6
.config/nvim/after/plugin/swap.lua
Normal file
6
.config/nvim/after/plugin/swap.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local swap = require('sibling-swap')
|
||||
swap.setup({
|
||||
use_default_keymaps = true
|
||||
})
|
||||
vim.keymap.set('n', 'g<', swap.swap_with_left, {})
|
||||
vim.keymap.set('n', 'g>', swap.swap_with_right, {})
|
7
.config/nvim/after/plugin/telescope.lua
Normal file
7
.config/nvim/after/plugin/telescope.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
21
.config/nvim/after/plugin/treesitter.lua
Normal file
21
.config/nvim/after/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
1
.config/nvim/after/plugin/undotree.lua
Normal file
1
.config/nvim/after/plugin/undotree.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
Loading…
Add table
Add a link
Reference in a new issue