nvim: update
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and
|
||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
|
||||
col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
-- require('lspconfig')['solargraph'].setup({ capabilities = capabilities })
|
||||
|
||||
-- require("luasnip.loaders.from_lua").lazy_load()
|
||||
|
||||
require('luasnip').filetype_extend("ruby", {"rails"})
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
@@ -1,5 +0,0 @@
|
||||
vim.g.gitgutter_sign_added = '│'
|
||||
vim.g.gitgutter_sign_modified = '│'
|
||||
vim.g.gitgutter_sign_removed = '│'
|
||||
vim.g.gitgutter_sign_modified_removed = '│'
|
||||
vim.g.gitgutter_sign_removed_first_line = '│'
|
||||
@@ -1,17 +0,0 @@
|
||||
-- place this in one of your configuration file(s)
|
||||
local hop = require('hop')
|
||||
local directions = require('hop.hint').HintDirection
|
||||
vim.keymap.set('', 'f', function()
|
||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('', 'F', function()
|
||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('', 't', function()
|
||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
|
||||
end, {remap=true})
|
||||
vim.keymap.set('', 'T', function()
|
||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
|
||||
end, {remap=true})
|
||||
|
||||
require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
|
||||
130
vim/.config/nvim/lua/plugins/init.lua
Normal file
130
vim/.config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,130 @@
|
||||
local cmd, fn, opt, g = vim.cmd, vim.fn, vim.opt, vim.g
|
||||
|
||||
cmd [[packadd packer.nvim]]
|
||||
local packer = require('packer')
|
||||
local use = packer.use
|
||||
|
||||
-- NB: Difference between config and setup (https://github.com/wbthomason/packer.nvim#specifying-plugins)
|
||||
--
|
||||
-- `config` - Specifies code to run after this plugin is loaded.
|
||||
--
|
||||
-- The setup key implies opt = true
|
||||
-- `setup` - Specifies code to run before this plugin is loaded. The code is ran even if
|
||||
-- the plugin is waiting for other conditions (ft, cond...) to be met.
|
||||
|
||||
packer.startup(function()
|
||||
use { 'wbthomason/packer.nvim', opt = true }
|
||||
|
||||
use 'lewis6991/impatient.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
|
||||
use {
|
||||
'shaunsingh/nord.nvim',
|
||||
config = function()
|
||||
require('plugins.nord').config()
|
||||
end,
|
||||
setup = function()
|
||||
require('plugins.nord').setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
event = { 'BufRead', 'BufNewFile' },
|
||||
config = function()
|
||||
require('plugins/treesitter').config()
|
||||
end,
|
||||
requires = {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
after = 'nvim-treesitter'
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/playground',
|
||||
cmd = 'TSPlaygroundToggle',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use { 'nvim-tree/nvim-tree.lua',
|
||||
config = function()
|
||||
require('plugins/nvim-tree').config()
|
||||
end
|
||||
}
|
||||
|
||||
use 'numtostr/comment.nvim'
|
||||
use 'ellisonleao/glow.nvim'
|
||||
|
||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = fn.executable "make" == 1 }
|
||||
use { 'nvim-telescope/telescope.nvim',
|
||||
module = 'telescope',
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('plugins/telescope').config()
|
||||
end,
|
||||
setup = function()
|
||||
require('plugins/telescope').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- Vimscript
|
||||
use 'junegunn/vim-easy-align'
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
|
||||
-- tpope
|
||||
use 'tpope/vim-surround'
|
||||
use 'tpope/vim-fugitive'
|
||||
use 'tpope/vim-rails'
|
||||
use 'tpope/vim-rhubarb'
|
||||
use 'tpope/vim-repeat'
|
||||
|
||||
-- tests
|
||||
use 'vim-test/vim-test'
|
||||
use 'benmills/vimux'
|
||||
|
||||
-- TODO: find lua replacement / or learn :grep / cfdo
|
||||
use 'dyng/ctrlsf.vim'
|
||||
|
||||
use 'andrewradev/splitjoin.vim'
|
||||
|
||||
use {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v1.x',
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'}, -- Required
|
||||
{ -- Optional
|
||||
'williamboman/mason.nvim',
|
||||
run = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
use { "dstein64/vim-startuptime", cmd = "StartupTime" }
|
||||
|
||||
-- EXPERIMENTAL: trying out different plugins
|
||||
use { 'skywind3000/asyncrun.vim' }
|
||||
|
||||
use {'kevinhwang91/nvim-bqf', ft = 'qf'} -- better qf
|
||||
end)
|
||||
|
||||
require('plugins.lsp')
|
||||
require('plugins.comment')
|
||||
require('plugins.gitsigns')
|
||||
@@ -78,25 +78,35 @@
|
||||
|
||||
|
||||
|
||||
local lsp = require('lsp-zero')
|
||||
-- local lsp = require('lsp-zero')
|
||||
|
||||
-- lsp.preset('recommended')
|
||||
lsp.set_preferences({
|
||||
suggest_lsp_servers = true,
|
||||
setup_servers_on_start = true,
|
||||
-- lsp.set_preferences({
|
||||
-- suggest_lsp_servers = true,
|
||||
-- setup_servers_on_start = true,
|
||||
-- set_lsp_keymaps = true,
|
||||
-- configure_diagnostics = true,
|
||||
-- cmp_capabilities = true,
|
||||
-- manage_nvim_cmp = true,
|
||||
-- call_servers = 'local',
|
||||
-- sign_icons = {
|
||||
-- error = 'E',
|
||||
-- warn = 'W',
|
||||
-- hint = 'H',
|
||||
-- info = 'I'
|
||||
-- }
|
||||
-- })
|
||||
|
||||
local lsp = require('lsp-zero').preset({
|
||||
name = 'minimal',
|
||||
set_lsp_keymaps = true,
|
||||
configure_diagnostics = true,
|
||||
cmp_capabilities = true,
|
||||
manage_nvim_cmp = true,
|
||||
call_servers = 'local',
|
||||
sign_icons = {
|
||||
error = 'E',
|
||||
warn = 'W',
|
||||
hint = 'H',
|
||||
info = 'I'
|
||||
}
|
||||
suggest_lsp_servers = false,
|
||||
})
|
||||
|
||||
-- (Optional) Configure lua language server for neovim
|
||||
-- lsp.nvim_workspace()
|
||||
|
||||
lsp.setup()
|
||||
|
||||
-- should be after setup
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
-- require("mason").setup({})
|
||||
-- require("mason-tool-installer").setup({
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
|
||||
-- ensure_installed = { "bash-language-server", "black", "dockerfile-language-server",
|
||||
-- "isort", "json-lsp", "jsonlint", "lua-language-server", "marksman", "prettierd",
|
||||
-- "python-lsp-server", "rubocop", "shfmt", "solargraph", "terraform-ls",
|
||||
-- "vim-language-server", "yaml-language-server",
|
||||
-- },
|
||||
-- auto_update = true,
|
||||
-- run_on_start = true
|
||||
-- })
|
||||
@@ -1,30 +0,0 @@
|
||||
-- TODO: figure this out
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.jq,
|
||||
require("null-ls").builtins.formatting.gofmt,
|
||||
require("null-ls").builtins.formatting.prettierd,
|
||||
require("null-ls").builtins.formatting.terraform_fmt,
|
||||
require("null-ls").builtins.diagnostics.jsonlint,
|
||||
},
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({group = augroup, buffer = bufnr})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
async = false,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1,14 +1,20 @@
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
renderer = {
|
||||
icons = {
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false,
|
||||
git = false,
|
||||
}
|
||||
},
|
||||
group_empty = true,
|
||||
}
|
||||
})
|
||||
local M = {}
|
||||
|
||||
function M.config()
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
renderer = {
|
||||
icons = {
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false,
|
||||
git = false,
|
||||
}
|
||||
},
|
||||
group_empty = true,
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -29,6 +29,7 @@ function M.config()
|
||||
textobjects = { -- syntax-aware textobjects
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
disable = {},
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
@@ -48,6 +49,8 @@ function M.config()
|
||||
['im'] = '@call.inner',
|
||||
['ad'] = '@comment.outer',
|
||||
['id'] = '@comment.inner',
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user