diff options
| author | Vito G. Graffagnino <vito@graffagnino.xyz> | 2022-05-28 12:20:16 +0100 |
|---|---|---|
| committer | Vito G. Graffagnino <vito@graffagnino.xyz> | 2022-05-28 12:20:16 +0100 |
| commit | 7ccd48274bdd76b76fcffe9073de62289bcfcc22 (patch) | |
| tree | a79f9ba2191902c5832c85dde55c0d13a198f713 /lua/user | |
| parent | 03427b87604b573f2fd4c2683de378e4806f86fc (diff) | |
| parent | e76f0ee92723ec238521383e4b4d3af0281a462b (diff) | |
Merge branch 'vgg' into 18-impatient18-impatient
Diffstat (limited to 'lua/user')
| -rw-r--r-- | lua/user/cmp.lua | 2 | ||||
| -rw-r--r-- | lua/user/colorscheme.lua | 7 | ||||
| -rw-r--r-- | lua/user/keymaps.lua | 27 | ||||
| -rw-r--r-- | lua/user/lsp/handlers.lua | 8 | ||||
| -rw-r--r-- | lua/user/lsp/lsp-installer.lua | 5 | ||||
| -rw-r--r-- | lua/user/lsp/null-ls.lua | 3 | ||||
| -rw-r--r-- | lua/user/lsp/settings/jsonls.lua | 18 | ||||
| -rw-r--r-- | lua/user/lsp/settings/pyright.lua | 10 | ||||
| -rw-r--r-- | lua/user/nvim-tree.lua | 3 | ||||
| -rw-r--r-- | lua/user/options.lua | 8 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 6 | ||||
| -rw-r--r-- | lua/user/telescope.lua | 8 | ||||
| -rw-r--r-- | lua/user/treesitter.lua | 23 |
13 files changed, 80 insertions, 48 deletions
diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index a151214..0ba1fc7 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -102,6 +102,7 @@ cmp.setup { -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind vim_item.menu = ({ nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", luasnip = "[Snippet]", buffer = "[Buffer]", path = "[Path]", @@ -111,6 +112,7 @@ cmp.setup { }, sources = { { name = "nvim_lsp" }, + { name = "nvim_lua" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index b1e21f6..4ccd3ff 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -6,3 +6,10 @@ catch /^Vim\%((\a\+)\)\=:E185/ set background=dark endtry ]] +local colorscheme = "default" + +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not status_ok then + vim.notify("colorscheme " .. colorscheme .. " not found!") + return +end diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index bf8afd8..49087c7 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -6,9 +6,9 @@ local term_opts = { silent = true } local keymap = vim.api.nvim_set_keymap --Remap space as leader key -keymap("", "<Space>", "<Nop>", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " +-- keymap("", "<Space>", "<Nop>", opts) +vim.g.mapleader = "," +vim.g.maplocalleader = "," -- Modes -- normal_mode = "n", @@ -26,8 +26,8 @@ keymap("n", "<C-k>", "<C-w>k", opts) keymap("n", "<C-l>", "<C-w>l", opts) -- Resize with arrows -keymap("n", "<C-Up>", ":resize -2<CR>", opts) -keymap("n", "<C-Down>", ":resize +2<CR>", opts) +keymap("n", "<C-Up>", ":resize +2<CR>", opts) +keymap("n", "<C-Down>", ":resize -2<CR>", opts) keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts) keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) @@ -35,10 +35,6 @@ keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) keymap("n", "<S-l>", ":bnext<CR>", opts) keymap("n", "<S-h>", ":bprevious<CR>", opts) --- Move text up and down -keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts) -keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts) - -- Insert -- -- Press jk fast to enter keymap("i", "jk", "<ESC>", opts) @@ -62,10 +58,15 @@ keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts) -- Terminal -- -- Better terminal navigation --- keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts) --- keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) --- keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) --- keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) +keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts) +keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) +keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) +keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) -- Nvimtree keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts) +keymap("n", "<leader>f", ":Format<cr>", opts) +-- keymap("n", "<leader>f", "<cmd>Telescope find_files<cr>", opts) +keymap("n", "<leader>f", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", opts) +keymap("n", "<c-t>", "<cmd>Telescope live_grep<cr>", opts) + diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index fb8b7f8..4868b79 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -72,13 +72,7 @@ local function lsp_keymaps(bufnr) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - "n", - "gl", - '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })<CR>', - opts - ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts) vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua index 2fe4af2..f539050 100644 --- a/lua/user/lsp/lsp-installer.lua +++ b/lua/user/lsp/lsp-installer.lua @@ -21,6 +21,11 @@ lsp_installer.on_server_ready(function(server) opts = vim.tbl_deep_extend("force", sumneko_opts, opts) end + if server.name == "pyright" then + local pyright_opts = require("user.lsp.settings.pyright") + opts = vim.tbl_deep_extend("force", pyright_opts, opts) + end + -- This setup() function is exactly the same as lspconfig's setup function. -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md server:setup(opts) diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index 874e19c..b261418 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -1,7 +1,6 @@ local null_ls_status_ok, null_ls = pcall(require, "null-ls") if not null_ls_status_ok then return -end -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting local formatting = null_ls.builtins.formatting @@ -14,6 +13,6 @@ null_ls.setup({ formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), formatting.black.with({ extra_args = { "--fast" } }), formatting.stylua, - -- diagnostics.flake8 + diagnostics.flake8 }, }) diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua index 1fffa68..be362c9 100644 --- a/lua/user/lsp/settings/jsonls.lua +++ b/lua/user/lsp/settings/jsonls.lua @@ -1,9 +1,4 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - +-- Find more schemas here: https://www.schemastore.org/json/ local schemas = { { description = "TypeScript compiler configuration file", @@ -168,19 +163,10 @@ local schemas = { }, } -local function extend(tab1, tab2) - for _, value in ipairs(tab2) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - local opts = { settings = { json = { - schemas = extended_schemas, + schemas = schemas, }, }, setup = { diff --git a/lua/user/lsp/settings/pyright.lua b/lua/user/lsp/settings/pyright.lua new file mode 100644 index 0000000..6354274 --- /dev/null +++ b/lua/user/lsp/settings/pyright.lua @@ -0,0 +1,10 @@ +return { + settings = { + + python = { + analysis = { + typeCheckingMode = "off" + } + } + }, +} diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua index 9c5170c..c64c5e1 100644 --- a/lua/user/nvim-tree.lua +++ b/lua/user/nvim-tree.lua @@ -94,10 +94,13 @@ nvim_tree.setup { number = false, relativenumber = false, }, +<<<<<<< HEAD trash = { cmd = "trash", require_confirm = true, }, +======= +>>>>>>> vgg quit_on_open = 0, git_hl = 1, disable_window_picker = 0, diff --git a/lua/user/options.lua b/lua/user/options.lua index 6b38e23..cf23784 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -7,16 +7,16 @@ local options = { fileencoding = "utf-8", -- the encoding written to a file hlsearch = true, -- highlight all matches on previous search pattern ignorecase = true, -- ignore case in search patterns - mouse = "a", -- allow the mouse to be used in neovim + mouse = "", -- allow the mouse to be used in neovim pumheight = 10, -- pop up menu height - showmode = false, -- we don't need to see things like -- INSERT -- anymore + showmode = true, -- we don't need to see things like -- INSERT -- anymore showtabline = 2, -- always show tabs smartcase = true, -- smart case smartindent = true, -- make indenting smarter again splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile - -- termguicolors = true, -- set term gui colors (most terminals support this) + termguicolors = true, -- set term gui colors (most terminals support this) timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) @@ -26,7 +26,7 @@ local options = { tabstop = 2, -- insert 2 spaces for a tab cursorline = true, -- highlight the current line number = true, -- set numbered lines - relativenumber = false, -- set relative numbered lines + relativenumber = true, -- set relative numbered lines numberwidth = 4, -- set number column width to 2 {default 4} signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time wrap = false, -- display lines as one long line diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 5588703..9157f06 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -54,6 +54,8 @@ return packer.startup(function(use) use "akinsho/toggleterm.nvim" use "ahmedkhalf/project.nvim" use 'lewis6991/impatient.nvim' + use 'kyazdani42/nvim-web-devicons' + use 'kyazdani42/nvim-tree.lua' -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out @@ -66,6 +68,7 @@ return packer.startup(function(use) use "hrsh7th/cmp-cmdline" -- cmdline completions use "saadparwaiz1/cmp_luasnip" -- snippet completions use "hrsh7th/cmp-nvim-lsp" + use "hrsh7th/cmp-nvim-lua" -- snippets use "L3MON4D3/LuaSnip" --snippet engine @@ -79,6 +82,7 @@ return packer.startup(function(use) -- Telescope use "nvim-telescope/telescope.nvim" + use 'nvim-telescope/telescope-media-files.nvim' -- Treesitter use { @@ -89,6 +93,8 @@ return packer.startup(function(use) -- Git use "lewis6991/gitsigns.nvim" + use "p00f/nvim-ts-rainbow" + use "nvim-treesitter/playground" -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index 0706b51..d4bf410 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -3,6 +3,8 @@ if not status_ok then return end +telescope.load_extension('media_files') + local actions = require "telescope.actions" telescope.setup { @@ -87,6 +89,12 @@ telescope.setup { -- builtin picker }, extensions = { + media_files = { + -- filetypes whitelist + -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} + filetypes = {"png", "webp", "jpg", "jpeg"}, + find_cmd = "rg" -- find command (defaults to `fd`) + } -- Your extension configuration goes here: -- extension_name = { -- extension_config_key = value, diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index 6f14cfc..db78f70 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -1,11 +1,21 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end + + + + + + + + + + + + + +local configs = require("nvim-treesitter.configs") configs.setup { - ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) + ensure_installed = "maintained", + sync_install = false, ignore_install = { "" }, -- List of parsers to ignore installing autopairs = { enable = true, @@ -14,6 +24,7 @@ configs.setup { enable = true, -- false will disable the whole extension disable = { "" }, -- list of language that will be disabled additional_vim_regex_highlighting = true, + }, indent = { enable = true, disable = { "yaml" } }, context_commentstring = { |
