Skip to content

Commit

Permalink
updated the whole config (except dap) for neovim 0.8 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh672003 authored Oct 7, 2022
1 parent a3e39b0 commit f03955d
Show file tree
Hide file tree
Showing 17 changed files with 398 additions and 251 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

> Why does this repo exist?
This config attempts to provide a rock solid fully featured starting point for someone new to Neovim, or just tired of maintaining the basic IDE components of their config.
This config attempts to provide a rock solid fully featured starting point for someone new to Neovim, or just tired of maintaining the basic IDE components of their config.

> What makes it "rock solid"?
All of the included plugins are pinned to a version that ensures they are compatible and will not update potentially introducing errors into your config. For every Neovim release I will update this repo along with the community to keep it up to date with the newest versions.

As I mentioned, this config is meant as a starting point for people new to Neovim who want a familiar IDE experience. The config has a very simple structure that makes it easy to add new plugins.
As I mentioned, this config is meant as a starting point for people new to Neovim who want a familiar IDE experience. The config has a very simple structure that makes it easy to add new plugins.

## Install Neovim 0.7
## Install Neovim 0.8

You can install Neovim with your package manager e.g. brew, apt, pacman etc.. but remember that when you update your packages Neovim may be upgraded to a newer version.

If you would like to make sure Neovim only updates when you want it to than I recommend installing from source:

**NOTE** Verify the required [build prerequisites](https://github.com/neovim/neovim/wiki/Building-Neovim#build-prerequisites) for your system.

```sh
git clone https://github.com/neovim/neovim.git
cd neovim
git checkout release-0.7
git checkout release-0.8
make CMAKE_BUILD_TYPE=Release
sudo make install
```
Expand All @@ -32,9 +34,9 @@ Make sure to remove or move your current `nvim` directory
git clone https://github.com/LunarVim/nvim-basic-ide.git ~/.config/nvim
```

Run `nvim` and wait for the plugins to be installed
Run `nvim` and wait for the plugins to be installed

**NOTE** (You will notice treesitter pulling in a bunch of parsers the next time you open Neovim)
**NOTE** (You will notice treesitter pulling in a bunch of parsers the next time you open Neovim)

**NOTE** Checkout this file for some predefined keymaps: [keymaps](https://github.com/LunarVim/nvim-basic-ide/blob/master/lua/user/keymaps.lua)

Expand Down Expand Up @@ -75,13 +77,14 @@ Next we need to install python support (node is optional)
npm i -g neovim
```

We will also need `ripgrep` for Telescope to work:
We will also need `ripgrep` for Telescope to work:

- Ripgrep

```sh
sudo apt install ripgrep
```

---

**NOTE** make sure you have [node](https://nodejs.org/en/) installed, I recommend a node manager like [fnm](https://github.com/Schniz/fnm).
Expand Down Expand Up @@ -147,8 +150,9 @@ You can install new plugins here: [plugins](https://github.com/LunarVim/nvim-bas
- [cmp-nvim-lua](https://github.com/hrsh7th/cmp-nvim-lua)
- [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
- [friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
- [mason.nvim](https://github.com/williamboman/mason.nvim)
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- [nvim-lsp-installer](https://github.com/williamboman/nvim-lsp-installer)
- [mason-lspconfig.nvim](https://github.com/williamboman/mason-lspconfig.nvim)
- [null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim)
- [vim-illuminate](https://github.com/RRethy/vim-illuminate)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
Expand All @@ -160,6 +164,6 @@ You can install new plugins here: [plugins](https://github.com/LunarVim/nvim-bas

---

> The computing scientist's main challenge is not to get confused by the complexities of his own making.
> The computing scientist's main challenge is not to get confused by the complexities of his own making.
\- Edsger W. Dijkstra
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ require "user.autocommands"
require "user.colorscheme"
require "user.cmp"
require "user.telescope"
require "user.gitsigns"
require "user.treesitter"
require "user.autopairs"
require "user.comment"
require "user.gitsigns"
require "user.nvim-tree"
require "user.bufferline"
require "user.lualine"
Expand Down
85 changes: 55 additions & 30 deletions lua/user/autocommands.lua
Original file line number Diff line number Diff line change
@@ -1,46 +1,71 @@
-- Use 'q' to quit from common plugins
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel" },
callback = function()
vim.cmd([[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end,
]])
end,
})

-- Remove statusline and tabline when in Alpha
vim.api.nvim_create_autocmd({ "User" }, {
pattern = { "AlphaReady" },
callback = function()
vim.cmd [[
set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
]]
end,
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "gitcommit"},
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})

-- Set wrap and spell in markdown and gitcommit
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
pattern = { "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})

vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"

-- Fixes Autocomment
vim.cmd("autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif")
-- vim.api.nvim_create_autocmd({ "BufEnter" }, {
-- callback = function()
-- vim.cmd [[
-- if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif
-- ]]
-- end,
-- })

vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
vim.cmd("tabdo wincmd =")
end,
})

vim.api.nvim_create_autocmd({ "CmdWinEnter" }, {
callback = function()
vim.cmd("quit")
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
callback = function()
vim.cmd "set formatoptions-=cro"
end,
callback = function()
vim.cmd("set formatoptions-=cro")
end,
})

-- Highlight Yanked Text
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank { higroup = "Visual", timeout = 200 }
end,
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end,
})

vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.java" },
callback = function()
vim.lsp.codelens.refresh()
end,
})

vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
vim.cmd("hi link illuminatedWord LspReferenceText")
end,
})
33 changes: 25 additions & 8 deletions lua/user/autopairs.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
-- Setup nvim-cmp.
local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then
return
return
end

npairs.setup {
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
}
npairs.setup({
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},

local cmp_autopairs = require "nvim-autopairs.completion.cmp"
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
})

local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
return
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done {})
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
87 changes: 49 additions & 38 deletions lua/user/bufferline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,83 +10,94 @@ bufferline.setup {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
},

highlights = {
fill = {
guifg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "#ff0000" },
bg = { attribute = "bg", highlight = "TabLine" },
},

background = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

buffer_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

close_button = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
close_button_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

tab_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},

tab = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

tab_close = {
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "Normal" },
-- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "Normal" },
},

duplicate_selected = {
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "TabLineSel" },
gui = "italic",
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "TabLineSel" },
italic = true,
},

duplicate_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},

duplicate = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},

modified = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

modified_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},

modified_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

separator = {
guifg = { attribute = "bg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "bg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},

separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
fg = { attribute = "bg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},

indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" },
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
bg = { attribute = "bg", highlight = "Normal" },
},
},
}
2 changes: 1 addition & 1 deletion lua/user/colorscheme.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local colorscheme = "darkplus"
local colorscheme = "tokyonight-night"

local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
Expand Down
Loading

0 comments on commit f03955d

Please sign in to comment.