summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRevaz Nakhutsrishvili <r@revaz.xyz>2024-09-03 11:02:19 +0400
committerRevaz Nakhutsrishvili <r@revaz.xyz>2024-09-03 11:02:19 +0400
commit72bac3930e8442faaea834724c2ef80440c505ed (patch)
tree0910c73f912cc9f747921f408decbd73a97fecb9
parentaa8c3484100b2b7e84a7aa8c7e416dde484b25ee (diff)
add neovim config
-rw-r--r--.config/nvim/after/ftplugin/c.vim2
-rw-r--r--.config/nvim/after/ftplugin/javascript.vim1
-rw-r--r--.config/nvim/after/ftplugin/json.vim1
-rw-r--r--.config/nvim/after/ftplugin/lua.vim1
-rw-r--r--.config/nvim/after/ftplugin/typescript.vim1
-rw-r--r--.config/nvim/after/ftplugin/vim.vim1
-rw-r--r--.config/nvim/init.lua7
-rw-r--r--.config/nvim/lazy-lock.json20
-rw-r--r--.config/nvim/lua/module/keymaps.lua9
-rw-r--r--.config/nvim/lua/module/lsp.lua72
-rw-r--r--.config/nvim/lua/module/options.lua25
-rw-r--r--.config/nvim/lua/module/plugins.lua51
-rw-r--r--.config/nvim/lua/module/telescope.lua43
-rw-r--r--.config/nvim/lua/module/treesitter.lua21
14 files changed, 255 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/c.vim b/.config/nvim/after/ftplugin/c.vim
new file mode 100644
index 0000000..5d78f8b
--- /dev/null
+++ b/.config/nvim/after/ftplugin/c.vim
@@ -0,0 +1,2 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
+setlocal commentstring=//\ %s
diff --git a/.config/nvim/after/ftplugin/javascript.vim b/.config/nvim/after/ftplugin/javascript.vim
new file mode 100644
index 0000000..469d9d0
--- /dev/null
+++ b/.config/nvim/after/ftplugin/javascript.vim
@@ -0,0 +1 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
diff --git a/.config/nvim/after/ftplugin/json.vim b/.config/nvim/after/ftplugin/json.vim
new file mode 100644
index 0000000..469d9d0
--- /dev/null
+++ b/.config/nvim/after/ftplugin/json.vim
@@ -0,0 +1 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
diff --git a/.config/nvim/after/ftplugin/lua.vim b/.config/nvim/after/ftplugin/lua.vim
new file mode 100644
index 0000000..469d9d0
--- /dev/null
+++ b/.config/nvim/after/ftplugin/lua.vim
@@ -0,0 +1 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
diff --git a/.config/nvim/after/ftplugin/typescript.vim b/.config/nvim/after/ftplugin/typescript.vim
new file mode 100644
index 0000000..469d9d0
--- /dev/null
+++ b/.config/nvim/after/ftplugin/typescript.vim
@@ -0,0 +1 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
diff --git a/.config/nvim/after/ftplugin/vim.vim b/.config/nvim/after/ftplugin/vim.vim
new file mode 100644
index 0000000..469d9d0
--- /dev/null
+++ b/.config/nvim/after/ftplugin/vim.vim
@@ -0,0 +1 @@
+setlocal tabstop=2 shiftwidth=2 expandtab smarttab
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..33249f1
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,7 @@
+require "module.options"
+require "module.keymaps"
+
+require "module.plugins"
+require "module.telescope"
+require "module.treesitter"
+require "module.lsp"
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..79517b2
--- /dev/null
+++ b/.config/nvim/lazy-lock.json
@@ -0,0 +1,20 @@
+{
+ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
+ "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
+ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
+ "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
+ "lsp-zero.nvim": { "branch": "v4.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "8db12610bcb7ce67013cfdfaba4dd47a23c6e851" },
+ "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" },
+ "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
+ "nvim-lspconfig": { "branch": "master", "commit": "4d38bece98300e3e5cd24a9aa0d0ebfea4951c16" },
+ "nvim-treesitter": { "branch": "master", "commit": "3b5704440f88ecc98fb5afb5378b95acd4b2fa7f" },
+ "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
+ "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
+ "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
+ "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
+ "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
+ "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
+ "vim-colors-paramount": { "branch": "master", "commit": "a5601d36fb6932e8d1a6f8b37b179a99b1456798" }
+}
diff --git a/.config/nvim/lua/module/keymaps.lua b/.config/nvim/lua/module/keymaps.lua
new file mode 100644
index 0000000..718e471
--- /dev/null
+++ b/.config/nvim/lua/module/keymaps.lua
@@ -0,0 +1,9 @@
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+
+vim.keymap.set("n", "<leader>e", ":Ex<CR>")
+
+vim.keymap.set("i", "<C-c>", "<Esc>")
+
+vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
+vim.keymap.set({"n", "v"}, "<leader>p", [["+gP]])
diff --git a/.config/nvim/lua/module/lsp.lua b/.config/nvim/lua/module/lsp.lua
new file mode 100644
index 0000000..89b96cd
--- /dev/null
+++ b/.config/nvim/lua/module/lsp.lua
@@ -0,0 +1,72 @@
+local lsp_zero = require "lsp-zero"
+
+lsp_zero.on_attach(function(client, bufnr)
+ lsp_zero.default_keymaps({ buffer = bufnr })
+
+ local opts = { buffer = bufnr }
+ vim.keymap.set("n", "<leader>r", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
+ vim.keymap.set("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
+ vim.keymap.set("v", "<leader>fc", "<cmd>lua vim.lsp.buf.format()<cr>", opts)
+end)
+
+local cmp = require "cmp"
+
+cmp.setup {
+ mapping = cmp.mapping.preset.insert({
+ ["<CR>"] = cmp.mapping.confirm({ select = false }),
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<C-j>"] = cmp.mapping.select_next_item(),
+ ["<C-k>"] = cmp.mapping.select_prev_item(),
+ ["<C-u>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-d>"] = cmp.mapping.scroll_docs(4),
+ }),
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ }, {
+ { name = "buffer" },
+ })
+}
+
+cmp.setup.cmdline({ "/", "?" }, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = "buffer" }
+ }
+})
+
+cmp.setup.cmdline(":", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" }
+ }, {
+ { name = "cmdline" }
+ }),
+ matching = { disallow_symbol_nonprefix_matching = false }
+})
+
+local lspconfig = require "lspconfig"
+local mason = require "mason"
+mason.setup {}
+
+local cmp_nvim = require "cmp_nvim_lsp"
+local mason_lspconfig = require "mason-lspconfig"
+mason_lspconfig.setup {
+ ensure_installed = {
+ "lua_ls",
+ "rust_analyzer",
+ "jedi_language_server",
+ "tsserver",
+ "eslint",
+ "jsonls",
+ "clangd",
+ "cmake",
+ "bashls"
+ },
+ handlers = {
+ function(server_name)
+ lspconfig[server_name].setup {
+ capabilities = cmp_nvim.default_capabilities()
+ }
+ end,
+ }
+}
diff --git a/.config/nvim/lua/module/options.lua b/.config/nvim/lua/module/options.lua
new file mode 100644
index 0000000..a2ad5ec
--- /dev/null
+++ b/.config/nvim/lua/module/options.lua
@@ -0,0 +1,25 @@
+vim.g.mapleader = " "
+vim.g.maplocalleader = " "
+
+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.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.termguicolors = true
+
+vim.opt.scrolloff = 8
+vim.opt.signcolumn = "yes"
+
+vim.opt.updatetime = 100
+
+vim.opt.colorcolumn = "80"
diff --git a/.config/nvim/lua/module/plugins.lua b/.config/nvim/lua/module/plugins.lua
new file mode 100644
index 0000000..2033151
--- /dev/null
+++ b/.config/nvim/lua/module/plugins.lua
@@ -0,0 +1,51 @@
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or 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)
+
+plugins = {
+ {
+ "owickstrom/vim-colors-paramount",
+ config = function()
+ vim.cmd.colorscheme "paramount"
+ end,
+ },
+ {
+ "nvim-telescope/telescope.nvim", tag = "0.1.6",
+ dependencies = { "nvim-lua/plenary.nvim" },
+ },
+ { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ dependencies = {
+ "nvim-treesitter/nvim-treesitter-textobjects",
+ "nvim-treesitter/nvim-treesitter-refactor",
+ "nvim-treesitter/playground",
+ },
+ },
+ "williamboman/mason.nvim",
+ "williamboman/mason-lspconfig.nvim",
+ "VonHeikemen/lsp-zero.nvim",
+ "neovim/nvim-lspconfig",
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-cmdline",
+ },
+ },
+}
+opts = {}
+
+require"lazy".setup(plugins, opts)
diff --git a/.config/nvim/lua/module/telescope.lua b/.config/nvim/lua/module/telescope.lua
new file mode 100644
index 0000000..21869d1
--- /dev/null
+++ b/.config/nvim/lua/module/telescope.lua
@@ -0,0 +1,43 @@
+local telescope = require "telescope"
+local builtin = require "telescope.builtin"
+local actions = require "telescope.actions"
+
+telescope.load_extension "fzf"
+telescope.setup{
+ defaults = {
+ file_ignore_patterns = {
+ ".git",
+ "node_modules"
+ },
+ mappings = {
+ i = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ }
+ }
+ },
+ pickers = {
+ find_files = {
+ hidden = true
+ },
+ live_grep = {
+ additional_args = { "--hidden" }
+ },
+ grep_string = {
+ additional_args = { "--hidden" }
+ },
+ buffers = {
+ previewer = false,
+ mappings = {
+ i = {
+ ["<C-d>"] = actions.delete_buffer
+ }
+ }
+ },
+ }
+}
+
+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, {})
+vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
diff --git a/.config/nvim/lua/module/treesitter.lua b/.config/nvim/lua/module/treesitter.lua
new file mode 100644
index 0000000..e04b1c1
--- /dev/null
+++ b/.config/nvim/lua/module/treesitter.lua
@@ -0,0 +1,21 @@
+local treesitter = require "nvim-treesitter.configs"
+
+treesitter.setup{
+ ensure_installed = {
+ "c",
+ "lua",
+ "vim",
+ "vimdoc",
+ "query",
+ "javascript",
+ "typescript",
+ "json",
+ "python"
+ },
+ sync_install = false,
+ auto_install = true,
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = false,
+ },
+}