Initial commit
This commit is contained in:
commit
6ea6401f65
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
plugin/packer_compiled.lua
|
1
ftplugin/markdown.lua
Normal file
1
ftplugin/markdown.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.opt.textwidth = 80
|
24
init.lua
Normal file
24
init.lua
Normal file
@ -0,0 +1,24 @@
|
||||
-- Dependencies needed for this config:
|
||||
-- ripgrep - https://github.com/BurntSushi/ripgrep
|
||||
-- fd - https://github.com/sharkdp/fd
|
||||
-- git - https://git-scm.com/
|
||||
-- bat - https://github.com/sharkdp/bat
|
||||
|
||||
-- disables netrw
|
||||
vim.g.loaded = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- speed up loading Lua modules
|
||||
if pcall(require, 'impatient') then
|
||||
require('impatient')
|
||||
else
|
||||
print('Failed to load impatient.')
|
||||
end
|
||||
|
||||
-- require('plenary.reload').reload_module('plugins')
|
||||
require('install-plugins')
|
||||
|
||||
-- require('plenary.reload').reload_module('user.settings')
|
||||
-- require('plenary.reload').reload_module('user.keymaps')
|
||||
require('user.settings')
|
||||
require('user.keymaps')
|
350
lua/install-plugins.lua
Normal file
350
lua/install-plugins.lua
Normal file
@ -0,0 +1,350 @@
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use 'lewis6991/impatient.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use {
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
require('plugins.lsp')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'j-hui/fidget.nvim',
|
||||
config = function()
|
||||
require('plugins.fidget-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.nvim-cmp')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'Saecki/crates.nvim',
|
||||
event = { "BufRead Cargo.toml" },
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('plugins.crates-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'petertriho/cmp-git',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
}
|
||||
use {
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('plugins.mason-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
config = function()
|
||||
require('plugins.mason-lspconfig-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'rmagatti/goto-preview',
|
||||
config = function()
|
||||
require('plugins.goto-preview-nvim')
|
||||
end,
|
||||
}
|
||||
use 'hrsh7th/cmp-vsnip'
|
||||
use 'hrsh7th/vim-vsnip'
|
||||
use 'rafamadriz/friendly-snippets'
|
||||
use {
|
||||
'folke/trouble.nvim',
|
||||
config = function()
|
||||
require('plugins.trouble-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'mfussenegger/nvim-dap',
|
||||
config = function()
|
||||
require('plugins.nvim-dap')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
config = function()
|
||||
require('plugins.nvim-dap-virtual-text')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'rcarriga/nvim-dap-ui',
|
||||
requires = {
|
||||
'mfussenegger/nvim-dap',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.nvim-dap-ui')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'kosayoda/nvim-lightbulb',
|
||||
requires = 'antoinemadec/FixCursorHold.nvim',
|
||||
config = function()
|
||||
require('plugins.nvim-lightbulb')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'weilbith/nvim-code-action-menu',
|
||||
cmd = 'CodeActionMenu',
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
|
||||
config = function()
|
||||
require('plugins.nvim-treesitter')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'theHamsta/nvim-treesitter-pairs',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'windwp/nvim-ts-autotag',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require('plugins.nvim-autopairs')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter-refactor',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.comment-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.nvim-treesitter-context')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('plugins.telescope')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
run = 'make',
|
||||
requires = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope-symbols.nvim',
|
||||
requires = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope-github.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'LinArcX/telescope-env.nvim',
|
||||
requires = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'xiyaowong/telescope-emoji.nvim',
|
||||
requires = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
}
|
||||
use 'nvim-telescope/telescope-ui-select.nvim'
|
||||
use 'nvim-telescope/telescope-project.nvim'
|
||||
use {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
config = function()
|
||||
require('plugins.gruvbox')
|
||||
end,
|
||||
}
|
||||
use { 'shaunsingh/oxocarbon.nvim', run = './install.sh' }
|
||||
use {
|
||||
'akinsho/toggleterm.nvim',
|
||||
tag = '*',
|
||||
config = function()
|
||||
require('plugins.toggleterm-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'ethanholz/nvim-lastplace',
|
||||
config = function()
|
||||
require('plugins.lastplace-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nacro90/numb.nvim',
|
||||
config = function()
|
||||
require('plugins.numb-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'tpope/vim-fugitive',
|
||||
config = function()
|
||||
require('plugins.fugitive')
|
||||
end,
|
||||
}
|
||||
use 'tpope/vim-rhubarb'
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
require('plugins.gitsigns')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'sindrets/diffview.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim'
|
||||
}
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use {
|
||||
'pwntester/octo.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
require('octo').setup()
|
||||
end
|
||||
}
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
},
|
||||
tag = 'nightly',
|
||||
config = function()
|
||||
require('plugins.nvim-tree')
|
||||
end
|
||||
}
|
||||
use {
|
||||
'kylechui/nvim-surround',
|
||||
config = function()
|
||||
require('plugins.surround-nvim')
|
||||
end,
|
||||
}
|
||||
use 'dstein64/vim-startuptime'
|
||||
use {
|
||||
'nvim-neotest/neotest',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'antoinemadec/FixCursorHold.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.neotest')
|
||||
end,
|
||||
}
|
||||
use 'rouge8/neotest-rust'
|
||||
use {
|
||||
'simrat39/rust-tools.nvim',
|
||||
requires = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
config = function()
|
||||
require('plugins.rust-tools-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'akinsho/bufferline.nvim',
|
||||
tag = "v2.*",
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function()
|
||||
require('plugins.bufferline-nvim')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
requires = {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
opt = true
|
||||
},
|
||||
config = function()
|
||||
require('plugins.lualine-nvim')
|
||||
end,
|
||||
}
|
||||
use 'tpope/vim-unimpaired'
|
||||
use 'tpope/vim-repeat'
|
||||
use 'tpope/vim-eunuch'
|
||||
use 'tpope/vim-sleuth'
|
||||
use {
|
||||
'simnalamburt/vim-mundo',
|
||||
config = function()
|
||||
require('plugins.vim-mundo')
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
config = function()
|
||||
require('plugins.indent-blankline-nvim')
|
||||
end,
|
||||
}
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
7
lua/plugins/bufferline-nvim.lua
Normal file
7
lua/plugins/bufferline-nvim.lua
Normal file
@ -0,0 +1,7 @@
|
||||
vim.opt.termguicolors = true
|
||||
require('bufferline').setup({
|
||||
options = {
|
||||
mode = 'tabs',
|
||||
diagnostics = 'nvim_lsp',
|
||||
},
|
||||
})
|
69
lua/plugins/comment-nvim.lua
Normal file
69
lua/plugins/comment-nvim.lua
Normal file
@ -0,0 +1,69 @@
|
||||
require("Comment").setup({
|
||||
---Add a space b/w comment and the line
|
||||
---@type boolean|fun():boolean
|
||||
padding = true,
|
||||
|
||||
---Whether the cursor should stay at its position
|
||||
---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat
|
||||
---@type boolean
|
||||
sticky = true,
|
||||
|
||||
---Lines to be ignored while comment/uncomment.
|
||||
---Could be a regex string or a function that returns a regex string.
|
||||
---Example: Use '^$' to ignore empty lines
|
||||
---@type string|fun():string
|
||||
ignore = nil,
|
||||
|
||||
---LHS of toggle mappings in NORMAL + VISUAL mode
|
||||
---@type table
|
||||
toggler = {
|
||||
---Line-comment toggle keymap
|
||||
line = "gcc",
|
||||
---Block-comment toggle keymap
|
||||
block = "gbc",
|
||||
},
|
||||
|
||||
---LHS of operator-pending mappings in NORMAL + VISUAL mode
|
||||
---@type table
|
||||
opleader = {
|
||||
---Line-comment keymap
|
||||
line = "gc",
|
||||
---Block-comment keymap
|
||||
block = "gb",
|
||||
},
|
||||
|
||||
---LHS of extra mappings
|
||||
---@type table
|
||||
extra = {
|
||||
---Add comment on the line above
|
||||
above = "gcO",
|
||||
---Add comment on the line below
|
||||
below = "gco",
|
||||
---Add comment at the end of line
|
||||
eol = "gcA",
|
||||
},
|
||||
|
||||
---Create basic (operator-pending) and extended mappings for NORMAL + VISUAL mode
|
||||
---NOTE: If `mappings = false` then the plugin won't create any mappings
|
||||
---@type boolean|table
|
||||
mappings = {
|
||||
---Operator-pending mapping
|
||||
---Includes `gcc`, `gbc`, `gc[count]{motion}` and `gb[count]{motion}`
|
||||
---NOTE: These mappings can be changed individually by `opleader` and `toggler` config
|
||||
basic = true,
|
||||
---Extra mapping
|
||||
---Includes `gco`, `gcO`, `gcA`
|
||||
extra = true,
|
||||
---Extended mapping
|
||||
---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
|
||||
extended = false,
|
||||
},
|
||||
|
||||
---Pre-hook, called before commenting the line
|
||||
---@type fun(ctx: CommentCtx):string
|
||||
pre_hook = nil,
|
||||
|
||||
---Post-hook, called after commenting is done
|
||||
---@type fun(ctx: CommentCtx)
|
||||
post_hook = nil,
|
||||
})
|
1
lua/plugins/crates-nvim.lua
Normal file
1
lua/plugins/crates-nvim.lua
Normal file
@ -0,0 +1 @@
|
||||
require('crates').setup()
|
1
lua/plugins/fidget-nvim.lua
Normal file
1
lua/plugins/fidget-nvim.lua
Normal file
@ -0,0 +1 @@
|
||||
require('fidget').setup()
|
9
lua/plugins/fugitive.lua
Normal file
9
lua/plugins/fugitive.lua
Normal file
@ -0,0 +1,9 @@
|
||||
vim.keymap.set('n', '<leader>gx', [[<Cmd>G<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gs', [[<Cmd>Git<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gd', [[<Cmd>Gdiff<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gc', [[<Cmd>Gcommit<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gb', [[<Cmd>Git blame -C<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gp', [[<Cmd>Git push<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gf', [[<Cmd>Git push --force<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gu', [[<Cmd>Git pull<CR>]], { noremap = false, silent = true })
|
||||
vim.keymap.set('n', '<leader>gh', [[<Cmd>Git diff --cached<CR>]], { noremap = false, silent = true })
|
41
lua/plugins/gitsigns.lua
Normal file
41
lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,41 @@
|
||||
require('gitsigns').setup({
|
||||
update_debounce = 500,
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
-- Actions
|
||||
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<leader>hp', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>td', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
})
|
5
lua/plugins/goto-preview-nvim.lua
Normal file
5
lua/plugins/goto-preview-nvim.lua
Normal file
@ -0,0 +1,5 @@
|
||||
require('goto-preview').setup({
|
||||
default_mappings = true,
|
||||
-- resizing_mappings = true,
|
||||
opacity = 90,
|
||||
})
|
23
lua/plugins/gruvbox.lua
Normal file
23
lua/plugins/gruvbox.lua
Normal file
@ -0,0 +1,23 @@
|
||||
require("gruvbox").setup({
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = true, -- will make italic comments and special strings
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "hard", -- can be "hard" or "soft"
|
||||
dim_inactive = true,
|
||||
transparent_mode = false,
|
||||
palette_overrides = {
|
||||
dark1 = '#282828',
|
||||
},
|
||||
overrides = {
|
||||
Pmenu = { bg = '#222222'}
|
||||
}
|
||||
})
|
||||
vim.o.background = "dark"
|
||||
vim.api.nvim_command([[colorscheme gruvbox]])
|
1
lua/plugins/indent-blankline-nvim.lua
Normal file
1
lua/plugins/indent-blankline-nvim.lua
Normal file
@ -0,0 +1 @@
|
||||
require("indent_blankline").setup()
|
5
lua/plugins/lastplace-nvim.lua
Normal file
5
lua/plugins/lastplace-nvim.lua
Normal file
@ -0,0 +1,5 @@
|
||||
require('nvim-lastplace').setup({
|
||||
lastplace_ignore_buftype = { 'quickfix', 'nofile', 'help' },
|
||||
lastplace_ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' },
|
||||
lastplace_open_folds = true,
|
||||
})
|
82
lua/plugins/lsp.lua
Normal file
82
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,82 @@
|
||||
local on_attach = require('plugins.lsp.on_attach')
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
require('lspconfig')['pyright'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['tsserver'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['jsonls'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['eslint'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['html'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['cssls'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
-- Setup by rust-tools automatically
|
||||
-- require('lspconfig')['rust_analyzer'].setup({
|
||||
-- on_attach = on_attach,
|
||||
-- flags = lsp_flags,
|
||||
-- -- Server-specific settings...
|
||||
-- settings = {
|
||||
-- ['rust-analyzer'] = {}
|
||||
-- }
|
||||
-- })
|
||||
require('lspconfig')['sumneko_lua'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require('lspconfig')['bashls'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['marksman'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['sqls'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
||||
require('lspconfig')['taplo'].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
})
|
61
lua/plugins/lsp/on_attach.lua
Normal file
61
lua/plugins/lsp/on_attach.lua
Normal file
@ -0,0 +1,61 @@
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
-- thallada: NOTE: copied also in lsp/init.lua since I can't figure out how to import it here
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<M-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
-- vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
-- vim.keymap.set('n', 'gW', vim.lsp.buf.workspace_symbol, bufopts)
|
||||
-- vim.keymap.set('n', 'g0', vim.lsp.buf.document_symbol, bufopts)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'gr',
|
||||
[[<Cmd>lua require('telescope.builtin').lsp_references()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'gd',
|
||||
[[<Cmd>lua require('telescope.builtin').lsp_definitions()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>D',
|
||||
[[<Cmd>lua require('telescope.builtin').lsp_type_definitions()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'gW',
|
||||
[[<Cmd>lua require('telescope.builtin').lsp_dynamic_workspace_symbols()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'g0',
|
||||
[[<Cmd>lua require('telescope.builtin').lsp_document_symbols()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
||||
|
||||
return on_attach
|
1
lua/plugins/lualine-nvim.lua
Normal file
1
lua/plugins/lualine-nvim.lua
Normal file
@ -0,0 +1 @@
|
||||
require('lualine').setup()
|
4
lua/plugins/mason-lspconfig-nvim.lua
Normal file
4
lua/plugins/mason-lspconfig-nvim.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = { 'sumneko_lua', 'rust_analyzer', 'bashls', 'cssls', 'html', 'jsonls', 'marskman', 'sqls', 'taplo'},
|
||||
automatic_installation = true,
|
||||
})
|
3
lua/plugins/mason-nvim.lua
Normal file
3
lua/plugins/mason-nvim.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('mason').setup({
|
||||
max_concurrent_installers = 10,
|
||||
})
|
17
lua/plugins/neotest.lua
Normal file
17
lua/plugins/neotest.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local neotest = require('neotest')
|
||||
neotest.setup({
|
||||
adapters = {
|
||||
require('neotest-rust'),
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>t", function() neotest.run.run() end)
|
||||
vim.keymap.set("n", "<leader>tf", function() neotest.run.run(vim.fn.expand('%')) end)
|
||||
vim.keymap.set("n", "<leader>tt", function() neotest.run.run({ strategy = 'dap' }) end)
|
||||
vim.keymap.set("n", "<leader>ta", function() neotest.run.attach() end)
|
||||
vim.keymap.set("n", "<leader>to", function() neotest.output.open({ enter = true }) end)
|
||||
vim.keymap.set("n", "<leader>ts", function() neotest.summary.toggle() end)
|
||||
|
||||
vim.diagnostic.config({
|
||||
neotest = true,
|
||||
}, vim.api.nvim_create_namespace('neotest'))
|
6
lua/plugins/numb-nvim.lua
Normal file
6
lua/plugins/numb-nvim.lua
Normal file
@ -0,0 +1,6 @@
|
||||
require("numb").setup({
|
||||
show_numbers = true, -- Enable 'number' for the window while peeking
|
||||
show_cursorline = true, -- Enable 'cursorline' for the window while peeking
|
||||
number_only = false, -- Peek only when the command is only a number instead of when it starts with a number
|
||||
centered_peeking = true, -- Peeked line will be centered relative to window
|
||||
})
|
28
lua/plugins/nvim-autopairs.lua
Normal file
28
lua/plugins/nvim-autopairs.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local npairs = require("nvim-autopairs")
|
||||
local Rule = require('nvim-autopairs.rule')
|
||||
local cmp = require('cmp')
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = {'string'},-- it will not add a pair on that treesitter node
|
||||
javascript = {'template_string'},
|
||||
java = false,-- don't check treesitter on java
|
||||
}
|
||||
})
|
||||
|
||||
local ts_conds = require('nvim-autopairs.ts-conds')
|
||||
|
||||
-- press % => %% only while inside a comment or string
|
||||
npairs.add_rules({
|
||||
Rule("%", "%", "lua")
|
||||
:with_pair(ts_conds.is_ts_node({'string','comment'})),
|
||||
Rule("$", "$", "lua")
|
||||
:with_pair(ts_conds.is_not_ts_node({'function'}))
|
||||
})
|
||||
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
116
lua/plugins/nvim-cmp.lua
Normal file
116
lua/plugins/nvim-cmp.lua
Normal file
@ -0,0 +1,116 @@
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
experimental = { ghost_text = true },
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn['vsnip#anonymous'](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{
|
||||
name = 'nvim_lsp_signature_help',
|
||||
priority = 100,
|
||||
group_index = 1,
|
||||
},
|
||||
{
|
||||
name = 'nvim_lsp',
|
||||
priority = 100,
|
||||
group_index = 1,
|
||||
},
|
||||
{
|
||||
name = 'buffer',
|
||||
priority = 80,
|
||||
group_index = 3,
|
||||
},
|
||||
{
|
||||
name = 'path',
|
||||
priority = 80,
|
||||
group_index = 3,
|
||||
},
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}),
|
||||
sorting = {
|
||||
comparators = {
|
||||
function(...) return require('cmp_buffer'):compare_locality(...) end,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline', keyword_pattern=[=[[^[:blank:]\!]*]=], keyword_length=3 }
|
||||
})
|
||||
})
|
||||
|
||||
-- Add additional capabilities supported by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
|
||||
local servers = { 'pyright', 'tsserver', 'html', 'cssls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup({
|
||||
-- on_attach = my_custom_on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
capabilities,
|
||||
}
|
1
lua/plugins/nvim-dap-ui.lua
Normal file
1
lua/plugins/nvim-dap-ui.lua
Normal file
@ -0,0 +1 @@
|
||||
require('dapui').setup()
|
1
lua/plugins/nvim-dap-virtual-text.lua
Normal file
1
lua/plugins/nvim-dap-virtual-text.lua
Normal file
@ -0,0 +1 @@
|
||||
require('nvim-dap-virtual-text').setup()
|
27
lua/plugins/nvim-dap.lua
Normal file
27
lua/plugins/nvim-dap.lua
Normal file
@ -0,0 +1,27 @@
|
||||
-- thallada: this is setup in rust-tools
|
||||
local dap = require('dap')
|
||||
-- dap.adapters.codelldb = {
|
||||
-- type = 'server',
|
||||
-- port = '${port}',
|
||||
-- executable = {
|
||||
-- command = '/home/thallada/vscode-lldb/extension/adapter/codelldb',
|
||||
-- args = { '--port', '${port}'}
|
||||
-- }
|
||||
-- }
|
||||
-- dap.configurations.rust = {
|
||||
-- {
|
||||
-- name = "Launch file",
|
||||
-- type = "codelldb",
|
||||
-- request = "launch",
|
||||
-- program = function()
|
||||
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
-- end,
|
||||
-- cwd = '${workspaceFolder}',
|
||||
-- stopOnEntry = true,
|
||||
-- },
|
||||
-- }
|
||||
|
||||
vim.keymap.set('n', '<leader>b', [[<Cmd>lua require('dap').toggle_breakpoint()<CR>]])
|
||||
vim.keymap.set('n', '<leader>be', [[<Cmd>lua require('dap').set_exception_breakpoints()<CR>]])
|
||||
vim.keymap.set('n', '<leader>bc', [[<Cmd>lua require('dap').clear_breakpoints()<CR>]])
|
||||
vim.keymap.set('n', '<leader>bo', [[<Cmd>lua require('dapui').toggle()<CR>]])
|
1
lua/plugins/nvim-lightbulb.lua
Normal file
1
lua/plugins/nvim-lightbulb.lua
Normal file
@ -0,0 +1 @@
|
||||
require('nvim-lightbulb').setup({ autocmd = { enabled = true } })
|
29
lua/plugins/nvim-tree.lua
Normal file
29
lua/plugins/nvim-tree.lua
Normal file
@ -0,0 +1,29 @@
|
||||
require('nvim-tree').setup({
|
||||
hijack_netrw = true,
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
view = {
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "<CR>", action = "edit_in_place" },
|
||||
{ key = "<C-i>", action = "toggle_file_info" },
|
||||
}
|
||||
}
|
||||
},
|
||||
remove_keymaps = {
|
||||
'<C-k>'
|
||||
},
|
||||
})
|
||||
|
||||
local function toggle_replace()
|
||||
local view = require('nvim-tree.view')
|
||||
if view.is_visible() then
|
||||
view.close()
|
||||
else
|
||||
require('nvim-tree').open_replacing_current_buffer()
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '-', function() toggle_replace() end, { noremap = true, silent = true })
|
5
lua/plugins/nvim-treesitter-context.lua
Normal file
5
lua/plugins/nvim-treesitter-context.lua
Normal file
@ -0,0 +1,5 @@
|
||||
require('treesitter-context').setup{
|
||||
enable = true,
|
||||
max_lines = 0,
|
||||
min_window_height = 10,
|
||||
}
|
72
lua/plugins/nvim-treesitter.lua
Normal file
72
lua/plugins/nvim-treesitter.lua
Normal file
@ -0,0 +1,72 @@
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = 'all',
|
||||
ignore_install = { 'phpdoc' },
|
||||
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn",
|
||||
node_incremental = "grn",
|
||||
scope_incremental = "grc",
|
||||
node_decremental = "grm",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
}
|
||||
}
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
clear_on_cursor_move = true,
|
||||
},
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
smart_rename = 'grr',
|
||||
},
|
||||
},
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
pairs = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
highlight_pair_events = {}, -- e.g. {"CursorMoved"}, -- when to highlight the pairs, use {} to deactivate highlighting
|
||||
highlight_self = false, -- whether to highlight also the part of the pair under cursor (or only the partner)
|
||||
goto_right_end = false, -- whether to go to the end of the right partner or the beginning
|
||||
fallback_cmd_normal = "call matchit#Match_wrapper('',1,'n')", -- What command to issue when we can't find a pair (e.g. "normal! %")
|
||||
keymaps = {
|
||||
goto_partner = "<leader>%",
|
||||
delete_balanced = "X",
|
||||
},
|
||||
delete_balanced = {
|
||||
only_on_first_char = false, -- whether to trigger balanced delete when on first character of a pair
|
||||
fallback_cmd_normal = nil, -- fallback command when no pair found, can be nil
|
||||
longest_partner = false, -- whether to delete the longest or the shortest pair when multiple found.
|
||||
-- E.g. whether to delete the angle bracket or whole tag in <pair> </pair>
|
||||
}
|
||||
},
|
||||
}
|
51
lua/plugins/rust-tools-nvim.lua
Normal file
51
lua/plugins/rust-tools-nvim.lua
Normal file
@ -0,0 +1,51 @@
|
||||
local rt = require('rust-tools')
|
||||
local lsp_on_attach = require('plugins.lsp.on_attach')
|
||||
local nvim_cmp_capabilities = require('plugins.nvim-cmp').capabilities
|
||||
|
||||
local extension_path = vim.env.HOME .. '/vscode-lldb/extension/'
|
||||
local codelldb_path = extension_path .. 'adapter/codelldb'
|
||||
local liblldb_path = extension_path .. 'lldb/lib/liblldb.so'
|
||||
|
||||
rt.setup({
|
||||
tools = {
|
||||
runnables = {
|
||||
use_telescope = true
|
||||
},
|
||||
},
|
||||
server = {
|
||||
capabilities = nvim_cmp_capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
lsp_on_attach(client, bufnr)
|
||||
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
vim.keymap.set("n", "<leader>rc", rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr })
|
||||
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, { buffer = bufnr })
|
||||
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, { buffer = bufnr })
|
||||
end,
|
||||
settings = {
|
||||
-- to enable rust-analyzer settings visit:
|
||||
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
||||
["rust-analyzer"] = {
|
||||
-- enable clippy on save
|
||||
checkOnSave = {
|
||||
command = "clippy"
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
dap = {
|
||||
adapter = require('rust-tools.dap').get_codelldb_adapter(
|
||||
codelldb_path,
|
||||
liblldb_path
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufRead', {
|
||||
group = vim.api.nvim_create_augroup('CmpSourceCargo', { clear = true }),
|
||||
pattern = 'Cargo.toml',
|
||||
callback = function()
|
||||
require('cmp').setup.buffer({ sources = { { name = 'crates' } } })
|
||||
end,
|
||||
})
|
1
lua/plugins/surround-nvim.lua
Normal file
1
lua/plugins/surround-nvim.lua
Normal file
@ -0,0 +1 @@
|
||||
require("nvim-surround").setup({})
|
156
lua/plugins/telescope.lua
Normal file
156
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,156 @@
|
||||
local trouble = require('trouble.providers.telescope')
|
||||
local telescope = require('telescope')
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<c-t>'] = trouble.open_with_trouble,
|
||||
['<c-h>'] = 'which_key',
|
||||
},
|
||||
n = {
|
||||
['<c-t>'] = trouble.open_with_trouble,
|
||||
['<c-h>'] = 'which_key',
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
project = {
|
||||
theme = 'dropdown',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
require('telescope').load_extension('gh')
|
||||
require('telescope').load_extension('env')
|
||||
require('telescope').load_extension('emoji')
|
||||
require('telescope').load_extension('ui-select')
|
||||
require('telescope').load_extension('project')
|
||||
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader><tab>',
|
||||
[[<Cmd>lua require('telescope.builtin').git_files()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>f.',
|
||||
[[<Cmd>lua require('telescope.builtin').git_files({ no_ignore = true })<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'_',
|
||||
[[<Cmd>lua require('telescope.builtin').live_grep()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>_',
|
||||
[[<Cmd>lua require('telescope.builtin').live_grep({ search_dirs = { vim.fn.expand('%:p:h') } })<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>8',
|
||||
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>3',
|
||||
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>fd",
|
||||
[[<Cmd>lua require('telescope.builtin').find_files({cwd=require('telescope.utils').buffer_dir()})<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fb',
|
||||
[[<Cmd>lua require('telescope.builtin').buffers()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fh',
|
||||
[[<Cmd>lua require('telescope.builtin').help_tags()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>ft',
|
||||
[[<Cmd>lua require('telescope.builtin').treesitter()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fr',
|
||||
[[<Cmd>lua require('telescope.builtin').resume()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>fs',
|
||||
[[<Cmd>lua require('telescope.builtin').spell_suggest()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>fgc',
|
||||
[[<Cmd>lua require('telescope.builtin').git_commits()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
'<Leader>fga',
|
||||
[[<Cmd>lua require('telescope.builtin').git_bcommits()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>fgb',
|
||||
[[<Cmd>lua require('telescope.builtin').git_branches()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>fe',
|
||||
[[<Cmd>Telescope emoji<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>f"',
|
||||
[[<Cmd>lua require('telescope.builtin').registers()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>fm',
|
||||
[[<Cmd>lua require('telescope.builtin').keymaps()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>ff',
|
||||
[[<Cmd>lua require('telescope.builtin').builtin()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>fl',
|
||||
[[<Cmd>lua require('telescope.builtin').reloader()<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<C-p>',
|
||||
[[<Cmd>lua require('telescope').extensions.project.project({ display_type = 'full' })<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
31
lua/plugins/toggleterm-nvim.lua
Normal file
31
lua/plugins/toggleterm-nvim.lua
Normal file
@ -0,0 +1,31 @@
|
||||
local cl = vim.o.columns
|
||||
local ln = vim.o.lines
|
||||
local width = 0.8
|
||||
local height = 0.8
|
||||
|
||||
require("toggleterm").setup({
|
||||
direction = "horizontal",
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
width = math.ceil(cl * width),
|
||||
height = math.ceil(ln * height - 4),
|
||||
winblend = 3,
|
||||
},
|
||||
open_mapping = [[<C-\>]],
|
||||
hide_numbers = true,
|
||||
-- shell = 'fish',
|
||||
})
|
||||
|
||||
vim.keymap.set('n', [[<M-=>]], [[<Cmd>ToggleTerm direction=float<CR>]])
|
||||
vim.keymap.set('n', [[<M-\>]], [[<Cmd>ToggleTerm direction=horizontal<CR>]])
|
||||
-- tmux muscle-memory for fullscreening nvim window
|
||||
vim.keymap.set('n', [[<C-a>z]], [[<Cmd>ToggleTermToggleAll<CR>]])
|
||||
vim.keymap.set('t', [[<C-a>z]], [[<Cmd>tab split<CR>]])
|
||||
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]])
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd h<CR>]])
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]])
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]])
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]])
|
||||
|
||||
-- vim.keymap.set('n', '<F12>', [[<Cmd>ToggleTerm<CR>]], { noremap = true, silent = true })
|
||||
-- vim.keymap.set('t', '<F12>', [[<Cmd>ToggleTerm<CR>]], { noremap = true, silent = true })
|
18
lua/plugins/trouble-nvim.lua
Normal file
18
lua/plugins/trouble-nvim.lua
Normal file
@ -0,0 +1,18 @@
|
||||
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
1
lua/plugins/vim-mundo.lua
Normal file
1
lua/plugins/vim-mundo.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.keymap.set('n', '<leader>u', [[<Cmd>MundoToggle<CR>]], { noremap = true, silent = true })
|
27
lua/user/keymaps.lua
Normal file
27
lua/user/keymaps.lua
Normal file
@ -0,0 +1,27 @@
|
||||
-- Pasting with Control-V because of muscle-memory
|
||||
vim.keymap.set('n', '<C-v>', '"+p')
|
||||
vim.keymap.set('n', '<C-s-v>', '"+p')
|
||||
vim.keymap.set('i', '<C-v>', '<C-r>*')
|
||||
vim.keymap.set('i', '<C-s-v>', '<C-r>*')
|
||||
vim.keymap.set('t', '<C-v>', '<C-\\><C-n>"+pi')
|
||||
vim.keymap.set('t', '<C-s-v>', '<C-\\><C-n>"+pi')
|
||||
|
||||
-- Faster window navigation
|
||||
vim.keymap.set('n', '<C-j>', '<C-w>j')
|
||||
vim.keymap.set('n', '<C-k>', '<C-w>k')
|
||||
vim.keymap.set('n', '<C-h>', '<C-w>h')
|
||||
vim.keymap.set('n', '<C-l>', '<C-w>l')
|
||||
|
||||
vim.keymap.set('n', '<leader>,', ':noh<CR>', { silent = true })
|
||||
|
||||
vim.keymap.set('n', '<leader>v', [[<Cmd>:e ~/.config/nvim/init.lua<CR>]], { silent = true })
|
||||
|
||||
-- URL handling (since I disabled netrw)
|
||||
-- source: https://sbulav.github.io/vim/neovim-opening-urls/
|
||||
if vim.fn.has('mac') == 1 then
|
||||
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })
|
||||
elseif vim.fn.has("unix") == 1 then
|
||||
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['xdg-open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })
|
||||
else
|
||||
vim.keymap.set[''].gx = {[[<Cmd>lua print("Error: gx is not supported on this OS!")<CR>]]}
|
||||
end
|
69
lua/user/settings.lua
Normal file
69
lua/user/settings.lua
Normal file
@ -0,0 +1,69 @@
|
||||
-- Nubmer column
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
vim.opt.signcolumn = 'yes' -- remove jitter
|
||||
|
||||
-- Wrapping / indenting
|
||||
vim.opt.wrap = true
|
||||
vim.opt.breakindent = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop=2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.textwidth = 120
|
||||
vim.opt.colorcolumn = '+1'
|
||||
|
||||
-- Search
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.hlsearch = true
|
||||
|
||||
-- Scrolling
|
||||
vim.opt.scrolloff = 3
|
||||
vim.opt.sidescrolloff = 15
|
||||
vim.opt.sidescroll = 1
|
||||
|
||||
-- Mouse
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- Window decorations
|
||||
vim.opt.title = true
|
||||
|
||||
-- Leader
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Fonts
|
||||
vim.opt.guifont = 'Hack:h9.3'
|
||||
|
||||
-- Swap / backup / undo
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Shell (may speed up nvim)
|
||||
vim.opt.shell = '/bin/bash'
|
||||
|
||||
-- Rendering
|
||||
vim.opt.lazyredraw = true
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldmethod = 'expr'
|
||||
vim.opt.foldexpr = vim.call('nvim_treesitter#foldexpr')
|
||||
|
||||
-- Completion settings
|
||||
-- " Set completeopt to have a better completion experience
|
||||
-- " :help completeopt
|
||||
-- " menuone: popup even 'hen there's only one match
|
||||
-- " noinsert: Do not insert text until a selection is made
|
||||
-- " noselect: Do not select, force user to select one from the menu
|
||||
vim.opt.completeopt = 'menuone,noinsert,noselect'
|
||||
|
||||
-- Avoid showing extra messages when using completion
|
||||
vim.o.shortmess = vim.o.shortmess .. 'c'
|
||||
|
||||
-- Python
|
||||
vim.g.python3_host_prog = '/usr/bin/python3'
|
||||
|
||||
-- Format options
|
||||
vim.cmd([[set formatoptions+=wantrqlc]])
|
Loading…
Reference in New Issue
Block a user