new: Added configs from all machines

This commit is contained in:
Sayantan Santra 2024-03-19 15:39:14 -05:00
parent 2337ac3682
commit 7993fef918
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
32 changed files with 590 additions and 1 deletions

View file

@ -1,6 +1,11 @@
# My NeoVim Config Files # My NeoVim Config Files
This is basically a copy of my `$XDG_CONFIG_HOME/nvim`. Feel free to use it for configuring your [NeoVim](https://neovim.io/) installation the way you like it. This is basically a collection of copies of `$XDG_CONFIG_HOME/nvim` from all my
machines. The `laptop` one is the most comprehensive, the others are basically
subsets of it.
Feel free to use it for configuring your [NeoVim](https://neovim.io/)
installation the way you like it.
[Link to the base repo.](https://git.sintan1729.uk/SinTan1729/my-nvim-config) [Link to the base repo.](https://git.sintan1729.uk/SinTan1729/my-nvim-config)

View file

@ -22,6 +22,7 @@ end
-- Load plugin via paq-nvim -- Load plugin via paq-nvim
bootstrap_paq { bootstrap_paq {
-- Let paq-nvim manage itself
"savq/paq-nvim", "savq/paq-nvim",
-- airline related plugins -- airline related plugins
"vim-airline/vim-airline", "vim-airline/vim-airline",

13
server/init.lua Normal file
View file

@ -0,0 +1,13 @@
-- Load old vimrc first
local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim"
vim.cmd.source(vimrc)
-- Load plugins using paq-nvim
local paq = vim.fn.stdpath("config") .. "/paq.lua"
vim.cmd.source(paq)
-- Default settings for comment plugin
require('Comment').setup()
-- Default settings for autopairs plugin
require('nvim-autopairs').setup()

55
server/paq.lua Normal file
View file

@ -0,0 +1,55 @@
-- Automatically bootstrap paq-nvim
local function clone_paq()
local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0
if not is_installed then
vim.fn.system { "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path }
return true
end
end
-- Automatically install new packages at startup
local function bootstrap_paq(packages)
local first_install = clone_paq()
vim.cmd.packadd("paq-nvim")
local paq = require("paq")
paq(packages)
if first_install then
vim.notify("Installing plugins... If prompted, hit Enter to continue.")
paq.install()
end
end
-- Load plugins via paq-nvim
bootstrap_paq {
-- Let paq-nvim manage itself
"savq/paq-nvim",
-- airline related plugins
"vim-airline/vim-airline",
"vim-airline/vim-airline-themes",
-- Auto commenting per filetype
"numToStr/Comment.nvim",
-- Give option to save files using sudo, if needed
"lambdalisue/suda.vim",
-- Auto toggle for number mode when vim isn't focused
"sitiom/nvim-numbertoggle",
-- LSP related plugins
"neovim/nvim-lspconfig",
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp", -- For LSP completion
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- Support programming terms
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
-- vim-moonfly theme
{ "bluz71/vim-moonfly-colors", as = 'moonfly' },
-- Automatically add bracket pairs
"windwp/nvim-autopairs",
-- Syntax highlighting for Caddyfile
"isobit/vim-caddyfile",
-- Syntax highlighting for Fish scripts
"khaveesh/vim-fish-syntax",
}

45
server/plugin/airline.vim Normal file
View file

@ -0,0 +1,45 @@
" enable tabline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
" Switch to your current theme
let g:airline_theme = 'moonfly'
" Always show tabs
set showtabline=2
" We don't need to see things like -- INSERT -- anymore
set noshowmode

61
server/plugin/cmp.lua Normal file
View file

@ -0,0 +1,61 @@
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.
-- 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(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
},
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 = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {{ name = 'buffer' }}
),
experimental = { ghost_text = true },
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ 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' }
})
})

26
server/plugin/moonfly.lua Normal file
View file

@ -0,0 +1,26 @@
-- Use moonfly colors in popups
vim.g.moonflyNormalFloat = true
-- Extra setup to distinguish between edit and floating windows
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = "single"
}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signatureHelp, {
border = "single"
}
)
vim.diagnostic.config({ float = { border = "single" } })
-- Some more setup is inside cmp.lua
-- Make the background transparent
vim.g.moonflyTransparent = true
-- Display diagnostic virtual text in color
vim.g.moonflyVirtualTextColor = true
-- Use the moonfly colorscheme
vim.cmd [[colorscheme moonfly]]

11
server/plugin/pyright.lua Normal file
View file

@ -0,0 +1,11 @@
require'lspconfig'.pyright.setup({
on_attach = on_attach,
flags = lsp_flags,
settings = {
python = {
analysis = {
typeCheckingMode = "off"
}
}
}
})

3
server/plugin/suda.vim Normal file
View file

@ -0,0 +1,3 @@
if ! &diff
let g:suda_smart_edit = 1
endif

75
server/vimrc.vim Normal file
View file

@ -0,0 +1,75 @@
" Disable netrw for nvim-tree to work
let loaded_netrw = 1
let loaded_netrwPlugin = 1
" Turn on numbers
set number
" Turn off line wrapping
set nowrap
" Turn on syntax highlighting
syntax on
filetype plugin indent on
" Disable cmdline from bottom
set cmdheight=0
" Display as much of a line as possible instead of just showing @
set display+=lastline
" Ignore case while searching except when the search term contains capital
" letters
set ignorecase
set smartcase
" Use 4 spaces for tabs and properly adjust them for files using TAB
set tabstop=4
set shiftwidth=4
set expandtab
" Needed for group colors to work in nvim-tree
set termguicolors
" Show LSP signs in the number column
set signcolumn=number
" Turn on spell checking
set spell
" Enable mouse support
set mouse=n
" Enable automatic format on save, text change in normal mode and leaving
" insert mode
autocmd BufWritePre,TextChanged,InsertLeave <buffer> lua vim.lsp.buf.format()
" Set K to hover
command -nargs=+ LspHover lua vim.lsp.buf.hover()
set keywordprg=:LspHover
" Enable programming dictionary
set spelllang=en,programming
" Disable unused plugins
let g:loaded_perl_provider=0
let g:loaded_node_provider=0
let g:loaded_ruby_provider=0
" Change the leader to a comma
let mapleader = ","
let g:mapleader = ","
" Use ,dd for deleting without putting into buffer
nnoremap <leader>d "_d
nnoremap <leader>D "_D
nnoremap <leader>x "_x
vnoremap <leader>d "_d
" Insert a newline in normal mode by ,o
nnoremap <Leader>o o<Esc>k
nnoremap <Leader>O O<Esc>j
" Use ,u for redo
nnoremap <Leader>u <c-r>

13
vps/init.lua Normal file
View file

@ -0,0 +1,13 @@
-- Load old vimrc first
local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim"
vim.cmd.source(vimrc)
-- Load plugins using paq-nvim
local paq = vim.fn.stdpath("config") .. "/paq.lua"
vim.cmd.source(paq)
-- Default settings for comment plugin
require('Comment').setup()
-- Default settings for autopairs plugin
require('nvim-autopairs').setup()

60
vps/paq.lua Normal file
View file

@ -0,0 +1,60 @@
-- Automatically bootstrap paq-nvim
local function clone_paq()
local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0
if not is_installed then
vim.fn.system { "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path }
return true
end
end
-- Automatically install new packages at startup
local function bootstrap_paq(packages)
local first_install = clone_paq()
vim.cmd.packadd("paq-nvim")
local paq = require("paq")
paq(packages)
if first_install then
vim.notify("Installing plugins... If prompted, hit Enter to continue.")
paq.install()
end
end
-- Load plugins via paq-nvim
bootstrap_paq {
-- Let paq-nvim manage itself
"savq/paq-nvim",
-- airline related plugins
"vim-airline/vim-airline",
"vim-airline/vim-airline-themes",
-- Auto commenting per filetype
"numToStr/Comment.nvim",
-- Give option to save files using sudo, if needed
"lambdalisue/suda.vim",
-- Auto toggle for number mode when vim isn't focused
"sitiom/nvim-numbertoggle",
-- Plugin for lean
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- LSP related plugins
"neovim/nvim-lspconfig",
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp", -- For LSP completion
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-vsnip", -- For snippets
"hrsh7th/vim-vsnip", -- For snippets
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- Support programming terms
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
-- vim-moonfly theme
{ "bluz71/vim-moonfly-colors", as = 'moonfly' },
-- Automatically add bracket pairs
"windwp/nvim-autopairs",
-- Syntax highlighting for Caddyfile
"isobit/vim-caddyfile",
-- Syntax highlighting for Fish scripts
"khaveesh/vim-fish-syntax",
}

45
vps/plugin/airline.vim Normal file
View file

@ -0,0 +1,45 @@
" enable tabline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
" Switch to your current theme
let g:airline_theme = 'moonfly'
" Always show tabs
set showtabline=2
" We don't need to see things like -- INSERT -- anymore
set noshowmode

61
vps/plugin/cmp.lua Normal file
View file

@ -0,0 +1,61 @@
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.
-- 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(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
},
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 = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {{ name = 'buffer' }}
),
experimental = { ghost_text = true },
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ 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' }
})
})

26
vps/plugin/moonfly.lua Normal file
View file

@ -0,0 +1,26 @@
-- Use moonfly colors in popups
vim.g.moonflyNormalFloat = true
-- Extra setup to distinguish between edit and floating windows
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = "single"
}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signatureHelp, {
border = "single"
}
)
vim.diagnostic.config({ float = { border = "single" } })
-- Some more setup is inside cmp.lua
-- Make the background transparent
vim.g.moonflyTransparent = true
-- Display diagnostic virtual text in color
vim.g.moonflyVirtualTextColor = true
-- Use the moonfly colorscheme
vim.cmd [[colorscheme moonfly]]

11
vps/plugin/pyright.lua Normal file
View file

@ -0,0 +1,11 @@
require'lspconfig'.pyright.setup({
on_attach = on_attach,
flags = lsp_flags,
settings = {
python = {
analysis = {
typeCheckingMode = "off"
}
}
}
})

3
vps/plugin/suda.vim Normal file
View file

@ -0,0 +1,3 @@
if ! &diff
let g:suda_smart_edit = 1
endif

75
vps/vimrc.vim Normal file
View file

@ -0,0 +1,75 @@
" Disable netrw for nvim-tree to work
let loaded_netrw = 1
let loaded_netrwPlugin = 1
" Turn on numbers
set number
" Turn off line wrapping
set nowrap
" Turn on syntax highlighting
syntax on
filetype plugin indent on
" Disable cmdline from bottom
set cmdheight=0
" Display as much of a line as possible instead of just showing @
set display+=lastline
" Ignore case while searching except when the search term contains capital
" letters
set ignorecase
set smartcase
" Use 4 spaces for tabs and properly adjust them for files using TAB
set tabstop=4
set shiftwidth=4
set expandtab
" Needed for group colors to work in nvim-tree
set termguicolors
" Show LSP signs in the number column
set signcolumn=number
" Turn on spell checking
set spell
" Enable mouse support
set mouse=n
" Enable automatic format on save, text change in normal mode and leaving
" insert mode
autocmd BufWritePre,TextChanged,InsertLeave <buffer> lua vim.lsp.buf.format()
" Set K to hover
command -nargs=+ LspHover lua vim.lsp.buf.hover()
set keywordprg=:LspHover
" Enable programming dictionary
set spelllang=en,programming
" Disable unused plugins
let g:loaded_perl_provider=0
let g:loaded_node_provider=0
let g:loaded_ruby_provider=0
" Change the leader to a comma
let mapleader = ","
let g:mapleader = ","
" Use ,dd for deleting without putting into buffer
nnoremap <leader>d "_d
nnoremap <leader>D "_D
nnoremap <leader>x "_x
vnoremap <leader>d "_d
" Insert a newline in normal mode by ,o
nnoremap <Leader>o o<Esc>k
nnoremap <Leader>O O<Esc>j
" Use ,u for redo
nnoremap <Leader>u <c-r>