comfortable, but python not formatting
This commit is contained in:
parent
f15af9b8be
commit
fc4c1c2612
24 changed files with 754 additions and 548 deletions
47
after/plugin/cmp.lua
Normal file
47
after/plugin/cmp.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
-- [[ Configure nvim-cmp ]]
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
}
|
||||
2
after/plugin/lazygit-config.lua
Normal file
2
after/plugin/lazygit-config.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
--[[ LazyGit Configurations ]]
|
||||
vim.keymap.set("n", "<leader>gg", ":LazyGit<CR>", { silent = true, desc = 'Launch Lazygit' })
|
||||
64
after/plugin/lsp-config.lua
Normal file
64
after/plugin/lsp-config.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
-- [[ Configure LSP ]]
|
||||
local lsp = require("lsp-zero")
|
||||
|
||||
lsp.preset("recommended")
|
||||
|
||||
lsp.ensure_installed({
|
||||
'gopls',
|
||||
'pyright',
|
||||
'tsserver',
|
||||
'rust_analyzer',
|
||||
})
|
||||
|
||||
-- Fix Undefined global 'vim'
|
||||
lsp.nvim_workspace()
|
||||
|
||||
|
||||
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 = '⛔️',
|
||||
warn = '⚠️',
|
||||
hint = '🧐',
|
||||
info = 'I'
|
||||
}
|
||||
})
|
||||
|
||||
lsp.on_attach(function(_, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() 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>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "gr", require('telescope.builtin').lsp_references, opts)
|
||||
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format, { desc = 'Format Buffer' })
|
||||
end)
|
||||
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true
|
||||
})
|
||||
1
after/plugin/mason.lua
Normal file
1
after/plugin/mason.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require('mason').setup({})
|
||||
42
after/plugin/telescope.lua
Normal file
42
after/plugin/telescope.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
-- [[ Configure Treesitter ]]
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', require('telescope.builtin').find_files, { desc = 'Find [F]iles' })
|
||||
vim.keymap.set('n', '<leader>fh', require('telescope.builtin').help_tags, { desc = 'Find [H]elp' })
|
||||
vim.keymap.set('n', '<leader>fw', require('telescope.builtin').grep_string, { desc = 'Find current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>fd', require('telescope.builtin').diagnostics, { desc = 'Find [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>fr', require('telescope.builtin').registers, { desc = 'Find [R]egister' })
|
||||
vim.keymap.set('n', '<leader>fF',
|
||||
function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end,
|
||||
{ desc = '[S]earch [R]esume' })
|
||||
|
||||
vim.keymap.set('n', '<leader>fg', require('telescope.builtin').live_grep, { desc = 'Find by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>fG', function()
|
||||
require("telescope.builtin").live_grep {
|
||||
additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end,
|
||||
}
|
||||
end, { desc = 'Find by [G]rep In all Files' })
|
||||
|
||||
43
after/plugin/treesitter-config.lua
Normal file
43
after/plugin/treesitter-config.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
-- See `:help nvim-treesitter`
|
||||
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||
--[[ vim.defer_fn(function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc',
|
||||
'vim' },
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
textobjects = {
|
||||
select = { enable = true, lookahead = true },
|
||||
move = { enable = true, set_jumps = true },
|
||||
swap = { enable = true },
|
||||
},
|
||||
opts = {
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
},
|
||||
}
|
||||
end, 0) ]]
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust", "go", "python", "tsx", "vim" },
|
||||
|
||||
-- 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 = {
|
||||
-- `false` will disable the whole extension
|
||||
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
after/plugin/undotree.lua
Normal file
1
after/plugin/undotree.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
11
after/plugin/which-key.lua
Normal file
11
after/plugin/which-key.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- document existing key chains
|
||||
require('which-key').register({
|
||||
--[[ ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
|
||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ]]
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
})
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue