summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/module
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/module')
-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
6 files changed, 221 insertions, 0 deletions
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,
+ },
+}