themes, cursor shape, lsp, completion, snippets
This commit is contained in:
parent
1b606ac756
commit
3cb0415ed3
2 changed files with 139 additions and 7 deletions
125
init.lua
125
init.lua
|
@ -23,6 +23,17 @@ vim.opt.hlsearch = true
|
|||
--incsearch
|
||||
vim.cmd([[highlight ColorColumn ctermbg=9]])
|
||||
|
||||
-- don't use NeoVim's thin cursor
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.g.tokyonight_style = "night"
|
||||
vim.cmd([[colorscheme tokyonight]])
|
||||
--vim.cmd([[colorscheme PaperColor]])
|
||||
--vim.cmd([[colorscheme moonfly]])
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<SPACE>", "<Nop>", { noremap = true })
|
||||
vim.g.mapleader = " "
|
||||
|
||||
for _, mode in ipairs({"n", "i"}) do
|
||||
vim.api.nvim_set_keymap(mode, "<Up>", "g<Up>", { noremap = true })
|
||||
vim.api.nvim_set_keymap(mode, "<Down>", "g<Down>", { noremap = true })
|
||||
|
@ -32,8 +43,120 @@ for _, mode in ipairs({"n", "i"}) do
|
|||
vim.api.nvim_set_keymap(mode, "<Up>", "<Nop>", { noremap = true })
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader>o", "<Cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true })
|
||||
|
||||
require('plugins')
|
||||
require'lspconfig'.pyright.setup{}
|
||||
-- require'lspconfig'.pyright.setup{}
|
||||
local nvim_lsp = require'lspconfig'
|
||||
nvim_lsp.pyright.setup{}
|
||||
|
||||
-- local on_attach = function(client)
|
||||
-- require'completion'.on_attach(client)
|
||||
-- end
|
||||
|
||||
|
||||
-- require('snippy').setup({
|
||||
-- mappings = {
|
||||
-- is = {
|
||||
-- ['<Tab>'] = 'expand_or_advance',
|
||||
-- ['<S-Tab>'] = 'previous',
|
||||
-- },
|
||||
-- nx = {
|
||||
-- ['<leader>x'] = 'cut_text',
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
local cmp = require'cmp'
|
||||
local snippy = require('snippy')
|
||||
|
||||
cmp.setup({
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
snippy.expand_snippet(args.body)
|
||||
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(),
|
||||
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif snippy.can_expand_or_advance() then
|
||||
snippy.expand_or_advance()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif snippy.can_jump(-1) then
|
||||
snippy.previous()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'snippy' },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
nvim_lsp.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
signs = true,
|
||||
virtual_text = true,
|
||||
float = {
|
||||
show_header = true,
|
||||
source = 'if_many',
|
||||
border = 'rounded',
|
||||
focusable = false,
|
||||
}
|
||||
})
|
||||
|
||||
-- -- trouble.nvim mappings
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
|
||||
|
||||
|
||||
|
||||
-- original init.vim
|
||||
|
|
|
@ -2,9 +2,18 @@
|
|||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
local packer = require('packer')
|
||||
packer.startup(function(use)
|
||||
packer.startup(
|
||||
function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'mg979/vim-visual-multi'
|
||||
use 'farmergreg/vim-lastplace'
|
||||
end)
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'dcampos/nvim-snippy'
|
||||
use 'dcampos/cmp-snippy'
|
||||
use 'folke/tokyonight.nvim'
|
||||
use 'bluz71/vim-moonfly-colors'
|
||||
use 'NLKNguyen/papercolor-theme'
|
||||
end
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue