Compare commits

..

No commits in common. "47d786ff470cd8a21154d4a80150ea1c750aa8f7" and "6c368d484e65278a6b2af6cb98a2b8559e7b2587" have entirely different histories.

17 changed files with 236 additions and 214 deletions

View File

@ -19,56 +19,11 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
require 'options'
require 'autocmd'
require 'keymaps'
require('lazy').setup({
{
-- NOTE: Theme
'sainnhe/gruvbox-material',
priority = 1000,
lazy = false,
config = function()
vim.g.gruvbox_material_background = 'soft'
vim.g.gruvbox_material_better_performance = 1
vim.g.gruvbox_material_enable_italic = 1
vim.cmd.colorscheme 'gruvbox-material'
end,
},
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: Second, plugins that require setup call (done via opts)
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- colorize in files
{ 'norcalli/nvim-colorizer.lua', opts = {} },
-- autopairs on newline
{ 'windwp/nvim-autopairs', opts = {} },
-- highlighting for comments
{ 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- cargo crates
{ 'saecki/crates.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- import other plugins
{ import = 'options' },
{ import = 'keymaps' },
{ import = 'plugins' },
{ import = 'autocmd' },
}, {})
-- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -2,3 +2,5 @@ vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorc
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 = { '*' } })
return {}

View File

@ -18,7 +18,7 @@ vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
-- Remap for moving selected line / block of text in visual mode
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' })
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()`
@ -37,5 +37,18 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
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' })
-- terminal keymaps
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end
--
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd 'autocmd! TermOpen term://* lua set_terminal_keymaps()'
return {}

View File

@ -39,3 +39,5 @@ vim.o.timeoutlen = 300
vim.o.completeopt = 'menuone,noselect'
vim.o.termguicolors = true
return {}

View File

@ -1,7 +0,0 @@
return {
'projekt0n/circles.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
icons = { empty = '', filled = '', lsp_prefix = '' },
},
}

View File

@ -8,15 +8,21 @@ function leave_snippet()
end
end
local border = {
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
}
vim.api.nvim_command [[
autocmd ModeChanged * lua leave_snippet()
]]
vim.cmd 'highlight! link CmpPmenu Pmenu'
vim.cmd 'highlight! link CmpPmenuBorder Pmenu'
vim.cmd 'highlight! CmpPmenu guibg=#282828'
vim.cmd 'highlight! CmpPmenuBorder guifg=#615750'
return {
{
'hrsh7th/nvim-cmp',
@ -24,20 +30,14 @@ return {
'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets',
},
config = function()
-- nvim-cmp setup
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
local border = require('utils').nvim_open_win_border
luasnip.config.setup {}
local highlight_opts = 'Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None'
cmp.setup {
snippet = {
expand = function(args)
@ -78,13 +78,7 @@ return {
},
window = {
completion = {
border = border 'CmpBorder',
side_padding = 1,
winhighlight = highlight_opts,
},
documentation = {
border = border 'CmpDocBorder',
winhighlight = highlight_opts,
border = border,
},
},
}

195
lua/plugins/common.lua Normal file
View File

@ -0,0 +1,195 @@
return {
-- NOTE: Theme
{
'sainnhe/gruvbox-material',
priority = 1000,
lazy = false,
config = function()
vim.g.gruvbox_material_background = 'soft'
vim.g.gruvbox_material_better_performance = 1
vim.g.gruvbox_material_enable_italic = 1
vim.cmd.colorscheme 'gruvbox-material'
end,
},
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: Second, plugins that require setup call (done via opts)
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- colorize in files
{ 'norcalli/nvim-colorizer.lua', opts = {} },
-- autopairs on newline
{ 'windwp/nvim-autopairs', opts = {} },
-- highlighting for comments
{ 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- cargo crates
{ 'saecki/crates.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- newage search plugin
{
'ggandor/leap.nvim',
dependencies = { 'tpope/vim-repeat' },
config = function()
require('leap').add_default_mappings()
end,
},
-- permanent links to fileranges
{
'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup {
callbacks = {
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
},
}
end,
},
-- NOTE: Third, plugins that require some setup, but not enugh for separate file
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
},
},
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'gruvbox-material',
statusline_style = 'mix',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename',
file_status = true,
path = 1,
},
},
},
},
},
{
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
},
{
-- git blame annotations
'f-person/git-blame.nvim',
init = function()
-- disable on startup
vim.g.gitblame_enabled = 0
end,
config = function()
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
end,
},
{
-- 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',
},
border = 'rounded',
highlighter = wilder.lua_fzy_highlighter(),
left = { ' ', wilder.popupmenu_devicons() },
right = { ' ', wilder.popupmenu_scrollbar() },
})
)
end,
},
{
'projekt0n/circles.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
icons = { empty = '', filled = '', lsp_prefix = '' },
},
},
-- file menu
{
'nvim-tree/nvim-tree.lua',
config = function()
require('nvim-tree').setup {
renderer = {
icons = {
glyphs = require('circles').get_nvimtree_glyphs(),
},
},
filters = {
custom = {
'__pycache__',
},
},
git = {
ignore = false,
},
}
end,
},
}

View File

@ -1,12 +0,0 @@
return {
-- git blame annotations
'f-person/git-blame.nvim',
init = function()
-- disable on startup
vim.g.gitblame_enabled = 0
end,
config = function()
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
end,
}

View File

@ -1,10 +0,0 @@
return {
'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup {
callbacks = {
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
},
}
end,
}

View File

@ -1,14 +0,0 @@
return {
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
},
}

View File

@ -1,10 +0,0 @@
return {
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
}

View File

@ -1,7 +0,0 @@
return {
'ggandor/leap.nvim',
dependencies = { 'tpope/vim-repeat' },
config = function()
require('leap').add_default_mappings()
end,
}

View File

@ -1,21 +0,0 @@
return {
'nvim-lualine/lualine.nvim',
opts = {
options = {
icons_enabled = false,
theme = 'gruvbox-material',
statusline_style = 'mix',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename',
file_status = true,
path = 1,
},
},
},
},
}

View File

@ -1,8 +0,0 @@
return {
'stevearc/oil.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('oil').setup()
vim.keymap.set('n', '-', require('oil').open, { desc = 'Open parent directory' })
end,
}

View File

@ -25,10 +25,15 @@ return {
keymaps = {
init_selection = '<C-Space>',
node_incremental = '<C-Space>',
scope_incremental = '<C-M-Space>',
scope_incremental = '<C-Space>',
node_decremental = '<C-Bslash>',
},
},
-- rainbow
rainbow = {
enable = true,
extended_mode = true,
},
-- refactor
refactor = {
highlight_definitions = { enable = true, clear_on_cursor_move = true },

View File

@ -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,
}

View File

@ -1,16 +0,0 @@
local M = {}
M.nvim_open_win_border = function(hl_name)
return {
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
}
end
return M