mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
NVIM with Lazy.vim Package Manager
- Added the basic setting for functional LSP. - Split configurations into multiple files suitable for Lazy usage.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -63,6 +63,9 @@ Temporary Items
|
||||
# Vim Artifacts
|
||||
*.swp
|
||||
|
||||
# NVIM Artifacts
|
||||
*.luarc.json
|
||||
|
||||
resharper-host/
|
||||
tasks/
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../.vim/autoload
|
||||
31
common/.config/nvim/init.lua
Normal file
31
common/.config/nvim/init.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
-- TODO: Todo-Comments: Highlight TODOs
|
||||
-- TODO: Neo-Tree: reduce size, hidden visible by default, set vcs root at pwd+cwd
|
||||
-- TODO: Telescope: open in a new window -> vertial & horizontal
|
||||
-- TODO: LSPConfig: Standardize keymaps to <leader>d[x]
|
||||
-- TODO: Note what exactly Treesitter does???
|
||||
|
||||
-- Loads the system's Vim configs: keeps the VIM & NVim configs in sync
|
||||
local vimrc = vim.fn.stdpath("config") .. "/vim-sync.vim"
|
||||
if vim.loop.fs_stat(vimrc) then
|
||||
vim.cmd("source " .. vimrc)
|
||||
end
|
||||
|
||||
-- Setup Lazy.nvim package manager
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require("lazy").setup("plugins", {
|
||||
change_detection = {
|
||||
enabled = true,
|
||||
notify = false
|
||||
}
|
||||
})
|
||||
15
common/.config/nvim/lua/plugins.lua
Normal file
15
common/.config/nvim/lua/plugins.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Keeps the plugin list that Lazy uses at one place
|
||||
return {
|
||||
-- From VIM
|
||||
{ "tpope/vim-fugitive" },
|
||||
{ "tpope/vim-surround" },
|
||||
{ "tpope/vim-repeat" },
|
||||
{ "tpope/vim-commentary" },
|
||||
{ "tpope/vim-sensible" },
|
||||
{ "rstacruz/vim-closer" },
|
||||
{ "machakann/vim-highlightedyank" },
|
||||
{ "airblade/vim-gitgutter" },
|
||||
{ "easymotion/vim-easymotion" },
|
||||
{ "preservim/nerdtree" },
|
||||
-- { 'itchyny/lightline.vim' },
|
||||
}
|
||||
73
common/.config/nvim/lua/plugins/codinghelp.lua
Normal file
73
common/.config/nvim/lua/plugins/codinghelp.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local tree_config = require("nvim-treesitter.configs")
|
||||
tree_config.setup({
|
||||
ensure_installed = { "lua", "vim", "vimdoc", "bash", "c_sharp", "css", "dockerfile", "git_config", "gitignore", "html", "http", "ini", "json", "proto", "python", "rust", "sql", "toml", "tsx", "typescript" , "javascript" },
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
-- LSP Configuration
|
||||
{
|
||||
-- Provides :Mason command which installs Language Servers
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
-- Helps to auto install Language Servers by specifying them
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "bashls", "cssls", "dockerls", "emmet_ls", "jsonls", "tsserver", "marksman", "pyre", "rust_analyzer", "sqlls", "taplo" }
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
-- Hook up NVIM with the above installed Language Servers
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
lspconfig.cssls.setup({})
|
||||
lspconfig.dockerls.setup({})
|
||||
lspconfig.emmet_ls.setup({})
|
||||
lspconfig.jsonls.setup({})
|
||||
lspconfig.tsserver.setup({})
|
||||
lspconfig.marksman.setup({})
|
||||
lspconfig.pyre.setup({})
|
||||
lspconfig.rust_analyzer.setup({})
|
||||
lspconfig.sqlls.setup({})
|
||||
lspconfig.taplo.setup({})
|
||||
|
||||
-- LSP Keybindings
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, {})
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, {})
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, {})
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, {})
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, {})
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, {})
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, {})
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, {})
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, {})
|
||||
vim.keymap.set('n', '<leader>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, {})
|
||||
end
|
||||
}
|
||||
}
|
||||
30
common/.config/nvim/lua/plugins/colorthemes.lua
Normal file
30
common/.config/nvim/lua/plugins/colorthemes.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
return {
|
||||
{
|
||||
"rebelot/kanagawa.nvim",
|
||||
name = "kanagawa",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.cmd.colorscheme "kanagawa-wave"
|
||||
end
|
||||
},
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
-- config = function()
|
||||
-- show_end_of_buffer = true,
|
||||
-- integrations = {
|
||||
-- cmp = true,
|
||||
-- gitsigns = true,
|
||||
-- nvimtree = true,
|
||||
-- },
|
||||
-- vim.cmd.colorscheme "catppuccin-macchiato",
|
||||
-- end
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
priority = 1000,
|
||||
},
|
||||
}
|
||||
10
common/.config/nvim/lua/plugins/lualine.lua
Normal file
10
common/.config/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "powerline_dark"
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
13
common/.config/nvim/lua/plugins/neo-tree.lua
Normal file
13
common/.config/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- Keymaps for Neotree
|
||||
vim.keymap.set("n", "<Leader>n", ":lcd %:h <BAR>:Neotree filesystem reveal left<CR>")
|
||||
end
|
||||
}
|
||||
27
common/.config/nvim/lua/plugins/telescope.lua
Normal file
27
common/.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
-- Keymaps for Telescope
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<Leader>fg", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<Leader>fb", builtin.buffers, {})
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown{
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
require("telescope").load_extension("ui-select")
|
||||
end
|
||||
}
|
||||
}
|
||||
20
common/.config/nvim/lua/plugins/todo-comments.lua
Normal file
20
common/.config/nvim/lua/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
vim.keymap.set("n", "]t", function()
|
||||
require("todo-comments").jump_next(
|
||||
{ keywords = { "ERROR", "WARNING", "TODO" }}
|
||||
)
|
||||
end,
|
||||
{ desc = "Next todo comment"}
|
||||
)
|
||||
vim.keymap.set("n", "[t", function()
|
||||
require("todo-comments").jump_prev(
|
||||
{ keywords = { "ERROR", "WARNING", "TODO" }}
|
||||
)
|
||||
end,
|
||||
{ desc = "Previous todo comment"}
|
||||
)
|
||||
end
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
"
|
||||
" Get source common configs from VIM
|
||||
" Source common configs from VIM
|
||||
"
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
let $VIMDIR="$HOME/.vim"
|
||||
let $NVIMDIR="$HOME/.config/nvim"
|
||||
|
||||
" Load plugins
|
||||
source $VIMDIR/plugins.vim
|
||||
|
||||
" Load VIM Configurations
|
||||
source $VIMDIR/configs.vim
|
||||
|
||||
@@ -18,11 +15,3 @@ source $VIMDIR/key_maps.vim
|
||||
" Save session files to $HOME/.vim/session directory
|
||||
let g:session_dir="$VIMDIR/session"
|
||||
|
||||
""""""""""""""""""""""""""""""""
|
||||
"
|
||||
" LOOKS
|
||||
"
|
||||
""""""""""""""""""""""""""""""""
|
||||
let g:lightline = { 'colorscheme': 'deepspace' }
|
||||
colorscheme deep-space
|
||||
|
||||
@@ -8,6 +8,7 @@ set shiftwidth=4 tabstop=4 softtabstop=4 expandtab
|
||||
set autoindent smartindent
|
||||
|
||||
syntax on " syntax highlighting.
|
||||
set cursorline " Hightlight cursor line
|
||||
set showmatch " Highlight matching braces
|
||||
set ls=2 " Show a status line
|
||||
set wrap " Wrap text
|
||||
|
||||
@@ -36,6 +36,9 @@ nnoremap <Leader>/ :call clearmatches()<CR>:noh<CR>
|
||||
" Make space-bar the leader-key
|
||||
let mapleader = " "
|
||||
|
||||
" Changes the pwd to the opened file's directory
|
||||
nnoremap <leader>cd :lcd %:h<CR>
|
||||
|
||||
" Map easymotion Plugin to <Leader>j
|
||||
map <leader>j <Plug>(easymotion-s)
|
||||
|
||||
@@ -45,6 +48,3 @@ nnoremap <leader>e :lcd %:h<CR> :NERDTreeToggleVCS<CR>
|
||||
let g:NERDTreeShowHidden = 1
|
||||
let g:NERDTreeWinSize = 20
|
||||
|
||||
" Changes the pwd to the opened file's directory
|
||||
nnoremap <leader>cd :lcd %:h<CR>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user