aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorLuca Matei Pintilie <lucafulger@gmail.com>2022-08-14 12:32:27 +0000
committerLuca Matei Pintilie <lucafulger@gmail.com>2022-08-14 12:32:27 +0000
commite3326d1b0295aa5c25a3f96a62f347f370156d11 (patch)
tree35c5d89c9c400551ea4056a623e486bac6ffb331 /.config/nvim
parent47acc735759f256d95168fef475964953ab661fd (diff)
downloaddotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar.gz
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar.bz2
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar.lz
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar.xz
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.tar.zst
dotfiles-e3326d1b0295aa5c25a3f96a62f347f370156d11.zip
Add more configs for wezterm, swappy, electron and git, as well as a better neovim config
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua151
1 files changed, 118 insertions, 33 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 91f2d88..62149da 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -11,7 +11,7 @@ end
vim.api.nvim_set_option("mouse", "a")
vim.api.nvim_command("set number relativenumber")
-
+vim.api.nvim_set_option("termguicolors", true)
-- Comment the following lines to disable whitespace characters
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
@@ -25,6 +25,8 @@ vim.api.nvim_command("inoremap <A-j> <Esc>:m .+1<CR>==gi")
vim.api.nvim_command("inoremap <A-k> <Esc>:m .-2<CR>==gi")
vim.api.nvim_command("vnoremap <A-j> :m '>+1<CR>gv=gv")
vim.api.nvim_command("vnoremap <A-k> :m '<-2<CR>gv=gv")
+vim.api.nvim_command(
+ "nnoremap <buffer> <M-CR> :lua vim.lsp.buf.code_action()<CR>")
return require("packer").startup(function(use)
-- Package manager
@@ -144,27 +146,16 @@ return require("packer").startup(function(use)
use {
"https://github.com/lukas-reineke/indent-blankline.nvim",
- setup = function()
- vim.api.nvim_set_option("termguicolors", true)
- end,
+ setup = function() vim.api.nvim_set_option("termguicolors", true) end,
config = function()
- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
-
require("indent_blankline").setup {
show_end_of_line = true,
space_char_blankline = " ",
- char_highlight_list = {
- "IndentBlanklineIndent1", "IndentBlanklineIndent2",
- "IndentBlanklineIndent3", "IndentBlanklineIndent4",
- "IndentBlanklineIndent5", "IndentBlanklineIndent6",
- },
+ show_current_context = true,
+ show_current_context_start = true,
}
+
end,
}
@@ -203,9 +194,7 @@ return require("packer").startup(function(use)
use {
"https://github.com/norcalli/nvim-colorizer.lua",
- config = function ()
- require('colorizer').setup()
- end
+ config = function() require("colorizer").setup() end,
}
use {
@@ -222,11 +211,21 @@ return require("packer").startup(function(use)
"https://github.com/williamboman/nvim-lsp-installer",
config = function()
local lsp_installer = require("nvim-lsp-installer")
+ -- local nvim_lsp = require'nvim_lsp'
+ -- Disable Diagnostcs globally
+ -- vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end
lsp_installer.on_server_ready(function(server)
local opts = {}
- if server.name == "denols" then opts.root_dir = vim.loop.cwd end
+ if server.name == "denols" then
+ opts.root_dir = vim.loop.cwd
+ opts.init_options = {
+ enable = true,
+ unstable = false,
+ config = "./deno.jsonc"
+ }
+ end
server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
@@ -235,6 +234,88 @@ return require("packer").startup(function(use)
}
use {
+ "https://github.com/hrsh7th/nvim-cmp",
+ requires = {
+ "https://github.com/neovim/nvim-lspconfig",
+ "https://github.com/hrsh7th/cmp-nvim-lsp",
+ "https://github.com/hrsh7th/cmp-buffer",
+ "https://github.com/hrsh7th/cmp-path",
+ "https://github.com/hrsh7th/cmp-cmdline",
+ "https://github.com/hrsh7th/cmp-vsnip",
+ "https://github.com/hrsh7th/vim-vsnip",
+ "https://github.com/onsails/lspkind.nvim",
+ },
+ config = function()
+ -- Setup nvim-cmp.
+ local cmp = require "cmp"
+
+ cmp.setup({
+ snippet = {
+ -- REQUIRED - you must specify a snippet engine
+ expand = function(args)
+ vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` 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.
+ }),
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" }, { name = "vsnip" }, -- For vsnip users.
+ }, { { name = "buffer" } }),
+ })
+
+ -- 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 `/` (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" } }),
+ })
+
+ -- Setup lspconfig.
+ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp
+ .protocol
+ .make_client_capabilities())
+ -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
+ require("lspconfig")["denols"].setup { capabilities = capabilities }
+ local lspkind = require("lspkind")
+ cmp.setup {
+ formatting = {
+ format = lspkind.cmp_format({
+ mode = "symbol", -- show only symbol annotations
+ maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
+
+ -- The function below will be called before any actual modifications from lspkind
+ -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
+ before = function(entry, vim_item) return vim_item end,
+ }),
+ },
+ }
+
+ end,
+ }
+
+ use {
"https://github.com/nathom/filetype.nvim",
setup = function() vim.g.did_load_filetypes = 1 end,
}
@@ -246,6 +327,7 @@ return require("packer").startup(function(use)
use {
"https://github.com/lukas-reineke/lsp-format.nvim",
+ requires = { "https://github.com/neovim/nvim-lspconfig" },
config = function()
require"lsp-format".setup {
typescript = { tab_width = 4 },
@@ -254,26 +336,29 @@ return require("packer").startup(function(use)
end,
}
- use { "https://github.com/github/copilot.vim" }
-
use {
- disable = true,
- "https://github.com/ms-jpq/coq_nvim",
- requires = {
- "https://github.com/ms-jpq/coq.artifacts",
- "https://github.com/ms-jpq/coq.thirdparty",
- },
+ "https://github.com/folke/trouble.nvim",
+ requires = "https://github.com/kyazdani42/nvim-web-devicons",
config = function()
- vim.g.coq_settings = {
- auto_start = "shut-up",
- clients = { tabnine = { enabled = true } },
+ require("trouble").setup {
+ -- your configuration comes here
+ -- or leave it empty to use the default settings
+ -- refer to the configuration section below
}
- require("coq")
+ vim.api.nvim_command("nnoremap <buffer> <M-,> :TroubleToggle<CR>")
end,
}
+ use {
+ "https://github.com/wfxr/minimap.vim",
+ setup = function()
+ vim.g["minimap_auto_start"] = 1
+ vim.api.nvim_command("nnoremap <buffer> <M-m> :MinimapToggle<CR>")
+ end,
+ cmd = { "MinimapToggle" },
+ }
+
-- 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)
-