~coder_kalyan/dotfiles

56a3ac521ce13033b11a4e7fec32a56ad347090a — Kalyan Sriram 7 months ago de9b451
nvim: initial commit with new lua config
2 files changed, 134 insertions(+), 0 deletions(-)

A .config/nvim/init.lua
A .config/nvim/lua/plugins.lua
A .config/nvim/init.lua => .config/nvim/init.lua +14 -0
@@ 0,0 1,14 @@
-- packages are managed in ~/.config/nvim/lua/plugins.lua
require('plugins')

-- hybrid line numbering
vim.o.number = true
vim.o.relativenumber = true

vim.o.smartcase = true -- ignore case if search is all lower, else case-sensitive
vim.o.showmatch = true -- show matching parenthesis

vim.o.termguicolors = true -- enable true colors
vim.cmd('colorscheme palenight')

vim.o.mouse = 'a'

A .config/nvim/lua/plugins.lua => .config/nvim/lua/plugins.lua +120 -0
@@ 0,0 1,120 @@
-- auto-install new plugins every time this file is edited
vim.cmd([[
	augroup packer_use_config
		autocmd!
		autocmd BufWritePost plugins.lua source <afile> | PackerCompile
	augroup end
]])

return require('packer').startup(function(use)
	-- update packer itself
	use 'wbthomason/packer.nvim'

	-- transparent background
	use {
		'xiyaowong/nvim-transparent',
		config = function() require('transparent').setup({
			enable = true,
			extra_groups = {
				"all",
			},
			exclude = {},
		}) end
	}

	-- color scheme
	use 'drewtempelmeyer/palenight.vim'

	-- status line
	use {
		'nvim-lualine/lualine.nvim',
		requires = {'kyazdani42/nvim-web-devicons', opt = true},
		config = function() require('lualine').setup({
			options = {theme = 'palenight'},
		}) end
	}

	-- color highlighter
	use {
		'norcalli/nvim-colorizer.lua',
		config = function() require('colorizer').setup() end
	}
	-- server configuration for built in lsp client
	use 'neovim/nvim-lspconfig'

	-- autocompletion framework
	-- completion sources
	use 'hrsh7th/cmp-nvim-lsp'
	use 'hrsh7th/cmp-buffer'
	use 'hrsh7th/cmp-path'
	use 'hrsh7th/cmp-cmdline'

	-- snippets and snippet completion
	use 'L3MON4D3/LuaSnip'
	use 'saadparwaiz1/cmp_luasnip'
	use {
		'hrsh7th/nvim-cmp',
		config = function()
			local cmp = require('cmp')

			cmp.setup({
				snippet = {
					expand = function(args)
						require('luasnip').lsp_expand(args.body)
					end,
				},
				mapping = {
					['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
					['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
					['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
					['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
					['<C-e>'] = cmp.mapping({
						i = cmp.mapping.abort(),
						c = cmp.mapping.close(),
					}),
					['<CR>'] = cmp.mapping.confirm({ select = true }),
				},
				sources = cmp.config.sources({
					{ name = 'nvim_lsp' },
					{ name = 'luasnip' },
				}, {
					{ name = 'buffer' },
					{ name = 'path' },
				})
			})

			-- use buffer source for '/'
			cmp.setup.cmdline('/', {
				sources = {
					{ name = 'buffer' }
				}
			})

			-- use cmdline & path source for ':'
			cmp.setup.cmdline(':', {
				sources = cmp.config.sources({
					{ name = 'path' }
				}, {
					{ name = 'cmdline' }
				})
			})
		end
	}

	-- configuration for built in treesitter support (i.e. syntax highlighting)
	use {
		'nvim-treesitter/nvim-treesitter',
		run = ':TSUpdate',
		config = function() require('nvim-treesitter.configs').setup({
			ensure_installed = "maintained",
			sync_install = false,
			highlight = {
				enable = true,
				additional_vim_regex_highlighting = false,
			},
		}) end
	}
	
	-- comment code
	use 'tpope/vim-commentary'
end)