summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua76
-rw-r--r--lazy-lock.json21
-rw-r--r--lua/autocomplete/autocomplete.lua101
-rw-r--r--lua/nvim_settings/remap.lua16
-rw-r--r--lua/nvim_settings/set.lua31
-rw-r--r--lua/statusline/statusline.lua40
-rw-r--r--lua/theme/gruvbox.lua1
-rw-r--r--lua/theme/kanagawa.lua1
-rw-r--r--lua/theme/seoul.lua1
-rw-r--r--lua/treesitter/treesitter.lua41
10 files changed, 329 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..ffa7c8c
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,76 @@
+-- Use of lazy
+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", -- latest stable release
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+-- lazy setup
+require("lazy").setup({
+ -- Loading theme
+ { "rebelot/kanagawa.nvim",
+ -- "ellisonleao/gruvbox.nvim",
+ config = function()
+ require("theme/kanagawa")
+ end,},
+
+ -- LSP
+ {
+ {'VonHeikemen/lsp-zero.nvim',
+ config = function()
+ require("autocomplete/autocomplete")
+ end
+ },
+ 'neovim/nvim-lspconfig',
+
+
+ {'williamboman/mason.nvim',
+ config = function()
+ require('mason').setup()
+ end},
+ 'williamboman/mason-lspconfig.nvim' , -- Optional
+
+ -- Autocompletion
+ 'hrsh7th/nvim-cmp' , -- Required
+ 'hrsh7th/cmp-nvim-lsp' , -- Required
+ 'hrsh7th/cmp-buffer' , -- Optional
+ 'hrsh7th/cmp-path' , -- Optional
+ 'saadparwaiz1/cmp_luasnip' , -- Optional
+ 'hrsh7th/cmp-nvim-lua' , -- Optional
+
+ -- Snippets
+ 'L3MON4D3/LuaSnip' , -- Required
+ 'rafamadriz/friendly-snippets' , -- Optional
+ },
+ {"xiyaowong/transparent.nvim",
+ config = function()
+ enable = true
+ end},
+
+ {
+ "nvim-treesitter/nvim-treesitter",
+ config = function()
+ require('treesitter/treesitter')
+ end
+ },
+
+ {
+ 'nvim-lualine/lualine.nvim',
+ -- dependencies = {'nvim-tree/nvim-web-devicons'},
+ config = function()
+ require('statusline/statusline')
+ end
+ },
+ {"rose-pine/neovim"},
+ {"tiagovla/tokyodark.nvim"}
+})
+
+-- nvim settings
+require("nvim_settings/set")
+require("nvim_settings/remap")
diff --git a/lazy-lock.json b/lazy-lock.json
new file mode 100644
index 0000000..5f19d4d
--- /dev/null
+++ b/lazy-lock.json
@@ -0,0 +1,21 @@
+{
+ "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
+ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
+ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
+ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
+ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
+ "friendly-snippets": { "branch": "main", "commit": "5cc1f45c6aac699ad008fb85f6ae03236062667d" },
+ "kanagawa.nvim": { "branch": "master", "commit": "ab41956c4559c3eb21e713fcdf54cda1cb6d5f40" },
+ "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
+ "lsp-zero.nvim": { "branch": "v2.x", "commit": "9a686513eaaa13d737d0fec8956a18268ead8b29" },
+ "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
+ "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
+ "neovim": { "branch": "main", "commit": "f01ce3a71748a92997d266cfe2c985decd18c601" },
+ "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
+ "nvim-lspconfig": { "branch": "master", "commit": "ae91a303a2258cb9cd9501e9d20c2dc92792d362" },
+ "nvim-treesitter": { "branch": "master", "commit": "f6342874b1113984dfedfcf595ad321c4cd1a896" },
+ "tokyodark.nvim": { "branch": "master", "commit": "b6f365cf5b6a2a2fa7de2578ca047db0721335ec" },
+ "transparent.nvim": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" }
+} \ No newline at end of file
diff --git a/lua/autocomplete/autocomplete.lua b/lua/autocomplete/autocomplete.lua
new file mode 100644
index 0000000..3e81bc6
--- /dev/null
+++ b/lua/autocomplete/autocomplete.lua
@@ -0,0 +1,101 @@
+local lspconfig = require('lspconfig')
+lspconfig.pyright.setup{}
+lspconfig.clangd.setup{}
+require("mason").setup()
+require("mason-lspconfig").setup()
+local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
+lspconfig.pyright.setup({
+ capabilities = lsp_capabilities,
+})
+
+vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
+local cmp = require('cmp')
+local luasnip = require('luasnip')
+
+local select_opts = {behavior = cmp.SelectBehavior.Select}
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end
+ },
+ sources = {
+ {name = 'path'},
+ {name = 'nvim_lsp', keyword_length = 1},
+ {name = 'buffer', keyword_length = 3},
+ {name = 'luasnip', keyword_length = 2},
+ },
+ window = {
+ -- completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered()
+ },
+ formatting = {
+ fields = {'menu', 'abbr', 'kind'},
+ format = function(entry, item)
+ local menu_icon = {
+ nvim_lsp = 'λ',
+ luasnip = '⋗',
+ buffer = 'Ω',
+ path = '🖫',
+ }
+
+ item.menu = menu_icon[entry.source.name]
+ return item
+ end,
+ },
+ performance = {
+ max_view_entries = 7
+ },
+ mapping = {
+ ['<Up>'] = cmp.mapping.select_prev_item(select_opts),
+ ['<Down>'] = cmp.mapping.select_next_item(select_opts),
+
+ ['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
+ ['<C-n>'] = cmp.mapping.select_next_item(select_opts),
+
+ ['<C-u>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-d>'] = cmp.mapping.scroll_docs(4),
+
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<C-y>'] = cmp.mapping.confirm({select = true}),
+ ['<CR>'] = cmp.mapping.confirm({select = false}),
+
+ ['<C-f>'] = cmp.mapping(function(fallback)
+ if luasnip.jumpable(1) then
+ luasnip.jump(1)
+ else
+ fallback()
+ end
+ end, {'i', 's'}),
+
+ ['<C-b>'] = cmp.mapping(function(fallback)
+ if luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ else
+ fallback()
+ end
+ end, {'i', 's'}),
+
+ ['<Tab>'] = cmp.mapping(function(fallback)
+ local col = vim.fn.col('.') - 1
+
+ if cmp.visible() then
+ cmp.select_next_item(select_opts)
+ elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
+ fallback()
+ else
+ cmp.complete()
+ end
+ end, {'i', 's'}),
+
+ ['<S-Tab>'] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item(select_opts)
+ else
+ fallback()
+ end
+ end, {'i', 's'}),
+ },
+})
+
diff --git a/lua/nvim_settings/remap.lua b/lua/nvim_settings/remap.lua
new file mode 100644
index 0000000..2e4bbe1
--- /dev/null
+++ b/lua/nvim_settings/remap.lua
@@ -0,0 +1,16 @@
+vim.g.mapleader = " "
+vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
+
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+vim.keymap.set("n", "J", "mzJ`z")
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+
+vim.keymap.set("x", "<leader>p", [["_dP]])
+
+vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
diff --git a/lua/nvim_settings/set.lua b/lua/nvim_settings/set.lua
new file mode 100644
index 0000000..44f703c
--- /dev/null
+++ b/lua/nvim_settings/set.lua
@@ -0,0 +1,31 @@
+vim.opt.guicursor = ""
+
+vim.opt.nu = true
+vim.opt.relativenumber = true
+
+vim.opt.tabstop = 4
+vim.opt.softtabstop = 4
+vim.opt.shiftwidth = 4
+vim.opt.expandtab = true
+
+vim.opt.smartindent = true
+
+vim.opt.wrap = false
+
+vim.opt.swapfile = false
+vim.opt.backup = false
+vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
+vim.opt.undofile = true
+
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.termguicolors = true
+
+vim.opt.scrolloff = 8
+vim.opt.signcolumn = "yes"
+vim.opt.isfname:append("@-@")
+
+vim.opt.updatetime = 50
+
+-- vim.opt.colorcolumn = "80"
diff --git a/lua/statusline/statusline.lua b/lua/statusline/statusline.lua
new file mode 100644
index 0000000..0297163
--- /dev/null
+++ b/lua/statusline/statusline.lua
@@ -0,0 +1,40 @@
+require('lualine').setup {
+ options = {
+ icons_enabled = false,
+ theme = 'material',
+ component_separators = { left = '', right = ''},
+ section_separators = { left = '', right = ''},
+ disabled_filetypes = {
+ statusline = {},
+ winbar = {},
+ },
+ ignore_focus = {},
+ always_divide_middle = true,
+ globalstatus = false,
+ refresh = {
+ statusline = 1000,
+ tabline = 1000,
+ winbar = 1000,
+ }
+ },
+ sections = {
+ lualine_a = {'mode'},
+ lualine_b = {'branch', 'diff', 'diagnostics'},
+ lualine_c = {'filename'},
+ lualine_x = {'encoding', 'fileformat', 'filetype'},
+ lualine_y = {'progress'},
+ lualine_z = {'location'}
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = {'filename'},
+ lualine_x = {'location'},
+ lualine_y = {},
+ lualine_z = {}
+ },
+ tabline = {},
+ winbar = {},
+ inactive_winbar = {},
+ extensions = {}
+}
diff --git a/lua/theme/gruvbox.lua b/lua/theme/gruvbox.lua
new file mode 100644
index 0000000..869cc44
--- /dev/null
+++ b/lua/theme/gruvbox.lua
@@ -0,0 +1 @@
+vim.cmd([[colorscheme gruvbox]])
diff --git a/lua/theme/kanagawa.lua b/lua/theme/kanagawa.lua
new file mode 100644
index 0000000..de4da4f
--- /dev/null
+++ b/lua/theme/kanagawa.lua
@@ -0,0 +1 @@
+vim.cmd([[colorscheme kanagawa-dragon]])
diff --git a/lua/theme/seoul.lua b/lua/theme/seoul.lua
new file mode 100644
index 0000000..daa643c
--- /dev/null
+++ b/lua/theme/seoul.lua
@@ -0,0 +1 @@
+vim.cmd([[colorscheme seoul256]])
diff --git a/lua/treesitter/treesitter.lua b/lua/treesitter/treesitter.lua
new file mode 100644
index 0000000..59d0d2f
--- /dev/null
+++ b/lua/treesitter/treesitter.lua
@@ -0,0 +1,41 @@
+require'nvim-treesitter.configs'.setup {
+ -- A list of parser names, or "all" (the five listed parsers should always be installed)
+ ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc"},
+
+ -- Install parsers synchronously (only applied to `ensure_installed`)
+ sync_install = false,
+
+ -- Automatically install missing parsers when entering buffer
+ -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
+ auto_install = true,
+
+ -- List of parsers to ignore installing (or "all")
+ ignore_install = { "javascript" },
+
+ ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
+ -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
+
+ highlight = {
+ enable = true,
+
+ -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
+ -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
+ -- the name of the parser)
+ -- list of language that will be disabled
+ -- disable = { "c", "rust" },
+ -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
+ disable = function(lang, buf)
+ local max_filesize = 100 * 1024 -- 100 KB
+ local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
+ if ok and stats and stats.size > max_filesize then
+ return true
+ end
+ end,
+
+ -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
+ -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+ -- Using this option may slow down your editor, and you may see some duplicate highlights.
+ -- Instead of true it can also be a list of languages
+ additional_vim_regex_highlighting = false,
+ },
+}