feat: cleanup config a bit
This commit is contained in:
parent
2b7b3c8662
commit
7375e269bc
|
@ -1,4 +1,15 @@
|
|||
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorcolumn=120,80,88', pattern = { '*.py', '*.pyi' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitright', pattern = { '*' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set colorcolumn=79,80,88,120', pattern = { '*.py', '*.pyi' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set splitright', pattern = { '*' } })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } })
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
|
|
@ -20,17 +20,6 @@ vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
|
|||
vim.keymap.set('v', '<M-k>', ":m '<-2<cr>gv=gv", { desc = 'Move selected lines up' })
|
||||
vim.keymap.set('v', '<M-j>', ":m '>+1<cr>gv=gv", { desc = 'Move selected lines down' })
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
|
@ -39,3 +28,6 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
|||
|
||||
-- terminal
|
||||
vim.keymap.set('t', '<C-x>', vim.api.nvim_replace_termcodes('<C-\\><C-N>', true, true, true), { desc = 'Escape terminal mode' })
|
||||
|
||||
-- disabling highlight
|
||||
vim.keymap.set('n', '<leader>hh', ':noh<CR>', { desc = 'No highlight search' })
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
-- See `:help vim.o`
|
||||
|
||||
-- disable netrw
|
||||
-- vim.g.loaded_netrw = 1
|
||||
-- vim.g.loaded_netrwPlugin = 1
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = true
|
||||
|
@ -14,9 +14,6 @@ vim.wo.number = true
|
|||
-- Make line numbers relative
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function leave_snippet()
|
||||
function Leave_snippet()
|
||||
if
|
||||
((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i')
|
||||
and require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
|
@ -9,7 +9,7 @@ function leave_snippet()
|
|||
end
|
||||
|
||||
vim.api.nvim_command [[
|
||||
autocmd ModeChanged * lua leave_snippet()
|
||||
autocmd ModeChanged * lua Leave_snippet()
|
||||
]]
|
||||
|
||||
vim.cmd 'highlight! link CmpPmenu Pmenu'
|
||||
|
@ -44,19 +44,22 @@ return {
|
|||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
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,
|
||||
},
|
||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif luasnip.locally_jumpable() then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -64,7 +67,7 @@ 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()
|
|
@ -4,5 +4,5 @@ return {
|
|||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
opts = { scope = { show_start = false, show_end = false } },
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
return {
|
||||
'ggandor/leap.nvim',
|
||||
dependencies = { 'tpope/vim-repeat' },
|
||||
config = function()
|
||||
require('leap').add_default_mappings()
|
||||
end,
|
||||
}
|
|
@ -52,7 +52,7 @@ return {
|
|||
'simrat39/rust-tools.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
{ 'j-hui/fidget.nvim', opts = {}, tag='legacy' },
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
|
@ -101,30 +101,24 @@ return {
|
|||
|
||||
local rust_tools_opts = {
|
||||
tools = {
|
||||
runnables = {
|
||||
use_telescope = true,
|
||||
},
|
||||
inlay_hints = {
|
||||
auto = true,
|
||||
show_parameter_hints = false,
|
||||
parameter_hints_prefix = '',
|
||||
other_hints_prefix = '',
|
||||
auto = false,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = {
|
||||
-- always enable all features
|
||||
features = 'all',
|
||||
},
|
||||
-- use clippy on save
|
||||
checkOnSave = {
|
||||
command = 'clippy',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- settings = {
|
||||
-- ['rust-analyzer'] = {
|
||||
-- cargo = {
|
||||
-- -- always enable all features
|
||||
-- features = 'all',
|
||||
-- },
|
||||
-- -- use clippy on save
|
||||
-- checkOnSave = {
|
||||
-- command = 'clippy',
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
return {
|
||||
'SmiteshP/nvim-navbuddy',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'SmiteshP/nvim-navic',
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('nvim-navbuddy').setup { lsp = { auto_attach = true } }
|
||||
|
||||
-- Plugins
|
||||
vim.keymap.set('n', '<leader>nb', ':Navbuddy<CR>', { desc = '[N]av[b]uddy' })
|
||||
vim.keymap.set('n', '<leader>nt', ':NvimTreeToggle<CR>', { desc = '[N]vim[T]ree' })
|
||||
end,
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
return {
|
||||
-- inject lsp formatting, diagonstics etc
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
'nvimtools/none-ls.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local null_ls = require 'null-ls'
|
|
@ -3,14 +3,11 @@ return {
|
|||
{
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '*',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
-- NOTE: If you are having trouble with this installation,
|
||||
-- refer to the README for telescope-fzf-native for more instructions.
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
|
@ -18,43 +15,43 @@ return {
|
|||
},
|
||||
},
|
||||
config = function()
|
||||
local telescopeConfig = require 'telescope.config'
|
||||
|
||||
-- Clone the default Telescope configuration
|
||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||||
|
||||
-- I want to search in hidden/dot files.
|
||||
table.insert(vimgrep_arguments, '--hidden')
|
||||
-- I don't want to respect .gitignore but do want to respect .ignore
|
||||
table.insert(vimgrep_arguments, '--no-ignore-vcs')
|
||||
-- I don't want to search in the `.git` directory.
|
||||
table.insert(vimgrep_arguments, '--glob')
|
||||
table.insert(vimgrep_arguments, '!**/.git/*')
|
||||
|
||||
local rg_defaults = { 'rg', '-S', '--hidden', '--no-ignore-vcs', '--glob', '!**/.git/*' }
|
||||
|
||||
local find_command = { unpack(rg_defaults) }
|
||||
table.insert(find_command, '--files')
|
||||
|
||||
local grep_command = { unpack(rg_defaults) }
|
||||
table.insert(grep_command, '--color=never')
|
||||
table.insert(grep_command, '--no-heading')
|
||||
table.insert(grep_command, '--with-filename')
|
||||
table.insert(grep_command, '--line-number')
|
||||
table.insert(grep_command, '--column')
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = {
|
||||
'rg',
|
||||
'-S',
|
||||
'--no-ignore-vcs',
|
||||
'--hidden',
|
||||
'--files',
|
||||
'-g',
|
||||
'!.git/',
|
||||
},
|
||||
find_command = find_command,
|
||||
},
|
||||
live_grep = {
|
||||
grep_command = {
|
||||
'rg',
|
||||
'--no-ignore-vcs',
|
||||
'--hidden',
|
||||
'--color=never',
|
||||
'--no-heading',
|
||||
'--with-filename',
|
||||
'--line-number',
|
||||
'--column',
|
||||
'--smart-case',
|
||||
'-g',
|
||||
'!.git/',
|
||||
},
|
||||
grep_command = grep_command,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -62,19 +59,9 @@ return {
|
|||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- Enable harpoon
|
||||
require('telescope').load_extension 'harpoon'
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', 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>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
|
@ -82,18 +69,6 @@ return {
|
|||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').spell_suggest, { desc = '[S]pell [S]suggest' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sc', function()
|
||||
require('telescope.builtin').colorscheme { enable_preview = true }
|
||||
end, { desc = '[S]earch [C]olorscheme' })
|
||||
|
||||
-- extensions
|
||||
vim.api.nvim_set_keymap('n', '<leader>tc', ':TodoTelescope<CR>', { desc = '[T]odo [c]omments', noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>hm', ':Telescope harpoon marks<CR>', { desc = '[H]arpoon [m]arks', noremap = true })
|
||||
end,
|
||||
},
|
||||
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available. Make sure you have the system
|
||||
-- requirements installed.
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
return {
|
||||
-- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
'nvim-treesitter/nvim-treesitter-refactor',
|
||||
},
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
|
||||
config = function()
|
||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
vim.defer_fn(function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'markdown' },
|
||||
|
@ -19,20 +16,16 @@ return {
|
|||
auto_install = true,
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { 'python' } },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<C-Space>',
|
||||
node_incremental = '<C-Space>',
|
||||
scope_incremental = '<C-M-Space>',
|
||||
node_decremental = '<C-Bslash>',
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-M-space>',
|
||||
node_decremental = '<c-bslash>',
|
||||
},
|
||||
},
|
||||
-- refactor
|
||||
refactor = {
|
||||
highlight_definitions = { enable = true, clear_on_cursor_move = true },
|
||||
},
|
||||
-- textobjects
|
||||
textobjects = {
|
||||
select = {
|
||||
|
@ -79,5 +72,6 @@ return {
|
|||
},
|
||||
},
|
||||
}
|
||||
end, 0)
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
return {
|
||||
-- a more adventurous wildmenu
|
||||
'gelguy/wilder.nvim',
|
||||
dependencies = { 'romgrk/fzy-lua-native' },
|
||||
config = function()
|
||||
local wilder = require 'wilder'
|
||||
wilder.setup { modes = { ':', '/', '?' } }
|
||||
-- Disable Python remote plugin
|
||||
wilder.set_option('use_python_remote_plugin', 0)
|
||||
|
||||
wilder.set_option('pipeline', {
|
||||
wilder.branch(
|
||||
wilder.cmdline_pipeline {
|
||||
fuzzy = 1,
|
||||
fuzzy_filter = wilder.lua_fzy_filter(),
|
||||
},
|
||||
wilder.vim_search_pipeline()
|
||||
),
|
||||
})
|
||||
|
||||
wilder.set_option(
|
||||
'renderer',
|
||||
wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
|
||||
highlights = {
|
||||
border = 'Normal',
|
||||
},
|
||||
-- stylua: ignore
|
||||
border = {
|
||||
'┌', '─', '┐',
|
||||
'│', '│',
|
||||
'└', '─', '┘',
|
||||
},
|
||||
highlighter = wilder.lua_fzy_highlighter(),
|
||||
left = { ' ', wilder.popupmenu_devicons() },
|
||||
right = { ' ', wilder.popupmenu_scrollbar() },
|
||||
})
|
||||
)
|
||||
end,
|
||||
}
|
Loading…
Reference in New Issue