This commit is contained in:
Salar Rahmanian 2023-02-09 21:22:26 -08:00
parent 0d693101c1
commit f1e4018776
10 changed files with 693 additions and 672 deletions

View file

@ -1,12 +1,12 @@
local installed, gitsigns = pcall(require, 'gitsigns')
local installed, gitsigns = pcall(require, "gitsigns")
if installed then
gitsigns.setup {
gitsigns.setup({
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
}
})
end

View file

@ -1,13 +1,13 @@
local installed, lualine = pcall(require, 'lualine')
local installed, lualine = pcall(require, "lualine")
if installed then
-- Set lualine as statusline
-- See `:help lualine.txt`
lualine.setup {
lualine.setup({
options = {
icons_enabled = false,
theme = 'tokyonight',
component_separators = '|',
section_separators = '',
theme = "tokyonight",
component_separators = "|",
section_separators = "",
},
}
})
end

View file

@ -1,10 +1,15 @@
local installed, neogit = pcall(require, 'neogit')
local installed, neogit = pcall(require, "neogit")
if installed then
neogit.setup {
neogit.setup({
integrations = {
diffview = true,
},
}
})
vim.api.nvim_set_keymap('n', '<leader>ng', [[<cmd>lua require('neogit').open({ kind = "split" })<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap(
"n",
"<leader>ng",
[[<cmd>lua require('neogit').open({ kind = "split" })<cr>]],
{ noremap = true, silent = true }
)
end

View file

@ -1,4 +1,4 @@
local installed, nvim_tree = pcall(require, 'nvim-tree')
local installed, nvim_tree = pcall(require, "nvim-tree")
if installed then
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
@ -22,5 +22,10 @@ if installed then
},
})
vim.api.nvim_set_keymap('n', '<leader>m', [[<cmd>lua require('nvim-tree').toggle()<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap(
"n",
"<leader>m",
[[<cmd>lua require('nvim-tree').toggle()<cr>]],
{ noremap = true, silent = true }
)
end

View file

@ -1,37 +1,36 @@
local installed, telescope = pcall(require, 'telescope')
local installed, telescope = pcall(require, "telescope")
if installed then
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
require("telescope").setup({
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
["<C-u>"] = false,
["<C-d>"] = false,
},
},
},
}
})
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'scaladex')
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "scaladex")
-- 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()
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 {
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' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
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' })
}))
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" })
vim.keymap.set("n", "<leader>sw", require("telescope.builtin").grep_string, { desc = "[S]earch current [W]ord" })
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" })
end

View file

@ -1,36 +1,36 @@
local installed, texlabconfig = pcall(require, 'texlabconfig')
local installed, texlabconfig = pcall(require, "texlabconfig")
if installed then
-- vimtex
vim.g.vimtex_view_method = 'skim'
vim.g.vimtex_compiler_method = 'tectonic'
vim.g.vimtex_view_method = "skim"
vim.g.vimtex_compiler_method = "tectonic"
-- nvim-texlabconfig
local tex_preview_executable = '/Applications/Skim.app/Contents/SharedSupport/displayline'
local tex_preview_executable = "/Applications/Skim.app/Contents/SharedSupport/displayline"
local tex_preview_args = { "%l", "%p", "%f" }
local texlab_build_executable = 'tectonic'
local texlab_build_executable = "tectonic"
local texlab_build_args = {
'-X',
'compile',
'%f',
'--synctex',
'--keep-logs',
'--keep-intermediates'
"-X",
"compile",
"%f",
"--synctex",
"--keep-logs",
"--keep-intermediates",
}
texlabconfig.setup {
texlabconfig.setup({
cache_activate = true,
cache_filetypes = { 'tex', 'bib' },
cache_filetypes = { "tex", "bib" },
reverse_search_edit_cmd = vim.cmd.edit,
settings = {
texlab = {
build = {
executable = texlab_build_executable,
args = texlab_build_args
args = texlab_build_args,
},
forwardSearch = {
executable = tex_preview_executable,
args = tex_preview_args
}
}
}
}
args = tex_preview_args,
},
},
},
})
end

View file

@ -1,53 +1,53 @@
local installed, treesitter = pcall(require, 'nvim-treesitter.configs')
local installed, treesitter = pcall(require, "nvim-treesitter.configs")
if installed then
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
treesitter.setup {
treesitter.setup({
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'c',
'cpp',
'go',
'lua',
'python',
'rust',
'typescript',
'help',
'vim',
'scala',
'bash',
'dockerfile',
'fish',
'git_rebase',
'gitattributes',
'gitcommit',
'gitignore',
'haskell',
'hocon',
'html',
'http',
'java',
'javascript',
'json',
'json5',
'latex',
'make',
'markdown_inline',
'nix',
'sql',
'terraform',
'yaml'
"c",
"cpp",
"go",
"lua",
"python",
"rust",
"typescript",
"help",
"vim",
"scala",
"bash",
"dockerfile",
"fish",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"haskell",
"hocon",
"html",
"http",
"java",
"javascript",
"json",
"json5",
"latex",
"make",
"markdown_inline",
"nix",
"sql",
"terraform",
"yaml",
},
highlight = { enable = true },
indent = { enable = true, disable = { 'python' } },
indent = { enable = true, disable = { "python" } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<c-backspace>",
},
},
textobjects = {
@ -56,41 +56,41 @@ if installed then
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
["<leader>A"] = "@parameter.inner",
},
playground = {
enable = true,
@ -98,20 +98,19 @@ if installed then
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<cr>',
show_help = '?',
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
},
},
}
})
end

257
init.lua
View file

@ -1,82 +1,82 @@
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }
vim.cmd [[packadd packer.nvim]]
vim.fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
end
require('packer').startup(function(use)
require("packer").startup(function(use)
-- Package manager
use 'wbthomason/packer.nvim'
use("wbthomason/packer.nvim")
use { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
use({ -- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
requires = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- Useful status updates for LSP
'j-hui/fidget.nvim',
"j-hui/fidget.nvim",
-- Additional lua configuration, makes nvim stuff amazing
'folke/neodev.nvim',
"folke/neodev.nvim",
},
}
})
use { -- Autocompletion
'hrsh7th/nvim-cmp',
use({ -- Autocompletion
"hrsh7th/nvim-cmp",
requires = {
'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-nvim-lsp-signature-help'
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
}
})
use { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
use({ -- Highlight, edit, and navigate code
"nvim-treesitter/nvim-treesitter",
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
pcall(require("nvim-treesitter.install").update({ with_sync = true }))
end,
}
})
use { -- Additional text objects via treesitter
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter',
}
use({ -- Additional text objects via treesitter
"nvim-treesitter/nvim-treesitter-textobjects",
after = "nvim-treesitter",
})
-- Git related plugins
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
use 'lewis6991/gitsigns.nvim'
use("tpope/vim-fugitive")
use("tpope/vim-rhubarb")
use("lewis6991/gitsigns.nvim")
use 'folke/tokyonight.nvim' -- Theme
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
use("folke/tokyonight.nvim") -- Theme
use("nvim-lualine/lualine.nvim") -- Fancier statusline
use("lukas-reineke/indent-blankline.nvim") -- Add indentation guides even on blank lines
use("numToStr/Comment.nvim") -- "gc" to comment visual regions/lines
use("tpope/vim-sleuth") -- Detect tabstop and shiftwidth automatically
-- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
use({ "nvim-telescope/telescope.nvim", branch = "0.1.x", requires = { "nvim-lua/plenary.nvim" } })
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 }
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make", cond = vim.fn.executable("make") == 1 })
-- Add custom plugins to packer from ~/.config/nvim/lua/plugins.lua
local has_plugins, plugins = pcall(require, 'plugins')
local has_plugins, plugins = pcall(require, "plugins")
if has_plugins then
plugins(use)
end
if is_bootstrap then
require('packer').sync()
require("packer").sync()
end
end)
@ -85,20 +85,20 @@ end)
--
-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
print '=================================='
print ' Plugins are being installed'
print ' Wait until Packer completes,'
print ' then restart nvim'
print '=================================='
print("==================================")
print(" Plugins are being installed")
print(" Wait until Packer completes,")
print(" then restart nvim")
print("==================================")
return
end
-- Automatically source and re-compile packer whenever you save this init.lua
local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
vim.api.nvim_create_autocmd('BufWritePost', {
command = 'source <afile> | silent! LspStop | silent! LspStart | PackerCompile',
local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
command = "source <afile> | silent! LspStop | silent! LspStart | PackerCompile",
group = packer_group,
pattern = vim.fn.expand '$MYVIMRC',
pattern = vim.fn.expand("$MYVIMRC"),
})
-- [[ Setting options ]]
@ -109,13 +109,13 @@ vim.o.hlsearch = false
vim.o.incsearch = true
-- clipboard
vim.o.clipboard = 'unnamedplus'
vim.o.clipboard = "unnamedplus"
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
vim.o.mouse = "a"
-- Enable break indent
vim.o.breakindent = true
@ -129,63 +129,63 @@ vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = 'yes'
vim.wo.signcolumn = "yes"
-- Set colorscheme
vim.g.tokyonight_style = 'night'
vim.g.tokyonight_style = "night"
vim.g.tokyonight_italic_functions = true
vim.o.termguicolors = true
vim.cmd [[colorscheme tokyonight]]
vim.cmd([[colorscheme tokyonight]])
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
vim.o.completeopt = "menuone,noselect"
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- [[ 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', {
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 = '*',
pattern = "*",
})
-- Enable Comment.nvim
require('Comment').setup()
require("Comment").setup()
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
require('indent_blankline').setup {
char = '',
require("indent_blankline").setup({
char = "",
show_trailing_blankline_indent = false,
}
})
require('trouble').setup()
require("trouble").setup()
-- nvim-autopairs
require('nvim-autopairs').setup()
require("nvim-autopairs").setup()
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
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)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
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)
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
@ -198,38 +198,38 @@ local on_attach = function(_, bufnr)
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
desc = "LSP: " .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
nmap("<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
end, "[W]orkspace [L]ist Folders")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end, { desc = "Format current buffer with LSP" })
end
-- Enable the following language servers
@ -253,54 +253,54 @@ local servers = {
}
-- Setup neovim lua configuration
require('neodev').setup()
require("neodev").setup()
--
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Setup mason so it can manage external tooling
require('mason').setup()
require("mason").setup()
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup {
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
}
})
mason_lspconfig.setup_handlers {
mason_lspconfig.setup_handlers({
function(server_name)
require('lspconfig')[server_name].setup {
require("lspconfig")[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
})
end,
}
})
-- Turn on lsp status information
require('fidget').setup()
require("fidget").setup()
-- nvim-cmp setup
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup {
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
mapping = cmp.mapping.preset.insert({
["<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)
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
@ -308,8 +308,8 @@ cmp.setup {
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -317,23 +317,20 @@ cmp.setup {
else
fallback()
end
end, { 'i', 's' }),
},
end, { "i", "s" }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp_signature_help' }
{ name = "nvim_lua" },
{ name = "nvim_lsp_signature_help" },
},
}
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View file

@ -1,27 +1,26 @@
return function(use)
use({'folke/trouble.nvim'})
use({ "folke/trouble.nvim" })
use({
'folke/which-key.nvim',
"folke/which-key.nvim",
config = function()
require('which-key').setup({})
end
require("which-key").setup({})
end,
})
use({'windwp/nvim-autopairs'})
use({'nvim-tree/nvim-web-devicons'})
use({ "windwp/nvim-autopairs" })
use({ "nvim-tree/nvim-web-devicons" })
use({
'nvim-tree/nvim-tree.lua',
tag = 'nightly'
"nvim-tree/nvim-tree.lua",
tag = "nightly",
})
use({'ckipp01/stylua-nvim'})
use({'gennaro-tedesco/nvim-jqx'})
use({'lervag/vimtex'})
use({ "ckipp01/stylua-nvim" })
use({ "gennaro-tedesco/nvim-jqx" })
use({ "lervag/vimtex" })
use({
'f3fora/nvim-texlabconfig',
run = 'go build'
"f3fora/nvim-texlabconfig",
run = "go build",
})
use({'sindrets/diffview.nvim'})
use({'nvim-treesitter/playground'})
use({ 'softinio/scaladex.nvim' })
use({'TimUntersberger/neogit'})
use({ "sindrets/diffview.nvim" })
use({ "nvim-treesitter/playground" })
use({ "softinio/scaladex.nvim" })
use({ "TimUntersberger/neogit" })
end

View file

@ -1,14 +1,13 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
if vim.api.nvim_call_function("has", { "nvim-0.5" }) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
vim.api.nvim_command("packadd packer.nvim")
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
@ -34,29 +33,32 @@ local function save_profiles(threshold)
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = { chunk_name, time_taken }
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
table.sort(sorted_times, function(a, b)
return a[2] > b[2]
end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
results[i] = elem[1] .. " took " .. elem[2] .. "ms"
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
table.insert(results, "(Only showing plugins that took longer than " .. threshold .. " ms " .. "to load)")
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local package_path_str =
"/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
package.path = package.path .. ";" .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
package.cpath = package.cpath .. ";" .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
@ -65,7 +67,11 @@ local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
vim.api.nvim_notify(
"packer.nvim: Error running " .. component .. " for " .. name .. ": " .. result,
vim.log.levels.ERROR,
{}
)
end)
end
return result
@ -77,164 +83,164 @@ _G.packer_plugins = {
["Comment.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/Comment.nvim",
url = "https://github.com/numToStr/Comment.nvim"
url = "https://github.com/numToStr/Comment.nvim",
},
LuaSnip = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
url = "https://github.com/L3MON4D3/LuaSnip",
},
["cmp-buffer"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
url = "https://github.com/hrsh7th/cmp-buffer",
},
["cmp-cmdline"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
url = "https://github.com/hrsh7th/cmp-cmdline"
url = "https://github.com/hrsh7th/cmp-cmdline",
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
url = "https://github.com/hrsh7th/cmp-nvim-lsp",
},
["cmp-nvim-lsp-signature-help"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help",
},
["cmp-nvim-lua"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
url = "https://github.com/hrsh7th/cmp-nvim-lua",
},
["cmp-path"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
url = "https://github.com/hrsh7th/cmp-path",
},
cmp_luasnip = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
url = "https://github.com/saadparwaiz1/cmp_luasnip",
},
["diffview.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/diffview.nvim",
url = "https://github.com/sindrets/diffview.nvim"
url = "https://github.com/sindrets/diffview.nvim",
},
["fidget.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/fidget.nvim",
url = "https://github.com/j-hui/fidget.nvim"
url = "https://github.com/j-hui/fidget.nvim",
},
["gitsigns.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
url = "https://github.com/lewis6991/gitsigns.nvim",
},
["indent-blankline.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
url = "https://github.com/lukas-reineke/indent-blankline.nvim",
},
["lualine.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
url = "https://github.com/nvim-lualine/lualine.nvim",
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
url = "https://github.com/williamboman/mason-lspconfig.nvim",
},
["mason.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
url = "https://github.com/williamboman/mason.nvim",
},
["neodev.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/neodev.nvim",
url = "https://github.com/folke/neodev.nvim"
url = "https://github.com/folke/neodev.nvim",
},
neogit = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/neogit",
url = "https://github.com/TimUntersberger/neogit"
url = "https://github.com/TimUntersberger/neogit",
},
["nvim-autopairs"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
url = "https://github.com/windwp/nvim-autopairs",
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
url = "https://github.com/hrsh7th/nvim-cmp",
},
["nvim-jqx"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-jqx",
url = "https://github.com/gennaro-tedesco/nvim-jqx"
url = "https://github.com/gennaro-tedesco/nvim-jqx",
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
url = "https://github.com/neovim/nvim-lspconfig",
},
["nvim-texlabconfig"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-texlabconfig",
url = "https://github.com/f3fora/nvim-texlabconfig"
url = "https://github.com/f3fora/nvim-texlabconfig",
},
["nvim-tree.lua"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
url = "https://github.com/nvim-tree/nvim-tree.lua",
},
["nvim-treesitter"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
url = "https://github.com/nvim-treesitter/nvim-treesitter",
},
["nvim-treesitter-textobjects"] = {
load_after = {},
loaded = true,
needs_bufread = false,
path = "/Users/salar/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects",
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
},
["nvim-web-devicons"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/nvim-tree/nvim-web-devicons"
url = "https://github.com/nvim-tree/nvim-web-devicons",
},
["packer.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
url = "https://github.com/wbthomason/packer.nvim",
},
playground = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/playground",
url = "https://github.com/nvim-treesitter/playground"
url = "https://github.com/nvim-treesitter/playground",
},
["plenary.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
url = "https://github.com/nvim-lua/plenary.nvim",
},
["scaladex.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/scaladex.nvim",
url = "https://github.com/softinio/scaladex.nvim"
url = "https://github.com/softinio/scaladex.nvim",
},
["stylua-nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/stylua-nvim",
url = "https://github.com/ckipp01/stylua-nvim"
url = "https://github.com/ckipp01/stylua-nvim",
},
["telescope-fzf-native.nvim"] = {
cond = { true },
@ -242,55 +248,61 @@ _G.packer_plugins = {
needs_bufread = false,
only_cond = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim",
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim",
},
["telescope.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
url = "https://github.com/nvim-telescope/telescope.nvim",
},
["tokyonight.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
url = "https://github.com/folke/tokyonight.nvim"
url = "https://github.com/folke/tokyonight.nvim",
},
["trouble.nvim"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/trouble.nvim",
url = "https://github.com/folke/trouble.nvim"
url = "https://github.com/folke/trouble.nvim",
},
["vim-fugitive"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
url = "https://github.com/tpope/vim-fugitive",
},
["vim-rhubarb"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-rhubarb",
url = "https://github.com/tpope/vim-rhubarb"
url = "https://github.com/tpope/vim-rhubarb",
},
["vim-sleuth"] = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-sleuth",
url = "https://github.com/tpope/vim-sleuth"
url = "https://github.com/tpope/vim-sleuth",
},
vimtex = {
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vimtex",
url = "https://github.com/lervag/vimtex"
url = "https://github.com/lervag/vimtex",
},
["which-key.nvim"] = {
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0" },
config = {
"\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0",
},
loaded = true,
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/which-key.nvim",
url = "https://github.com/folke/which-key.nvim"
}
url = "https://github.com/folke/which-key.nvim",
},
}
time([[Defining packer_plugins]], false)
-- Config for: which-key.nvim
time([[Config for which-key.nvim]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")
try_loadstring(
"\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0",
"config",
"which-key.nvim"
)
time([[Config for which-key.nvim]], false)
-- Conditional loads
time([[Conditional loading of telescope-fzf-native.nvim]], true)
@ -298,8 +310,8 @@ time([[Conditional loading of telescope-fzf-native.nvim]], true)
time([[Conditional loading of telescope-fzf-native.nvim]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd nvim-treesitter ]]
vim.cmd [[ packadd nvim-treesitter-textobjects ]]
vim.cmd([[ packadd nvim-treesitter ]])
vim.cmd([[ packadd nvim-treesitter-textobjects ]])
time([[Sequenced loading]], false)
_G._packer.inside_compile = false
@ -308,11 +320,16 @@ if _G._packer.needs_bufread == true then
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
if should_profile then
save_profiles()
end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
vim.api.nvim_command(
'echohl ErrorMsg | echom "Error in packer_compiled: '
.. error_msg
.. '" | echom "Please check your config for correctness" | echohl None'
)
end