I honestly don't know anymore
This commit is contained in:
parent
bebd4c1ff9
commit
a8818ea92a
2
init.lua
2
init.lua
@ -1,6 +1,6 @@
|
||||
-- init.lua
|
||||
|
||||
require'plugins'.init()
|
||||
require'plugins'
|
||||
require'settings'.init()
|
||||
require'maps'.init()
|
||||
require'commands'
|
||||
|
@ -1,8 +1,10 @@
|
||||
-- commands.lua
|
||||
|
||||
vim.cmd'autocmd! User GoyoEnter Limelight'
|
||||
vim.cmd'autocmd! User GoyoLeave Limelight!'
|
||||
vim.cmd 'autocmd! User GoyoEnter Limelight'
|
||||
vim.cmd 'autocmd! User GoyoLeave Limelight!'
|
||||
|
||||
vim.cmd'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
|
||||
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
|
||||
|
||||
vim.cmd'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
|
||||
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
|
@ -11,6 +11,7 @@ end
|
||||
function maps.toggleGoyo()
|
||||
map('n', '<C-g>', ':Goyo<Enter>', {noremap = false})
|
||||
end
|
||||
|
||||
function maps.term()
|
||||
-- Open and move to resized terminal
|
||||
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', {noremap = false})
|
||||
@ -65,7 +66,7 @@ function maps.init()
|
||||
maps.fixIndent()
|
||||
maps.moveByRow()
|
||||
maps.centeredSearch()
|
||||
maps.moveToWindow()
|
||||
-- maps.moveToWindow()
|
||||
end
|
||||
|
||||
return maps
|
||||
|
@ -1,49 +1,59 @@
|
||||
-- plugin.lua
|
||||
|
||||
local plugins = {}
|
||||
|
||||
function plugins.load(pluginList)
|
||||
for _, plugin in pairs(pluginList) do
|
||||
require'paq-nvim'.paq(plugin)
|
||||
end
|
||||
end
|
||||
|
||||
local pluginList = {
|
||||
require "paq" {
|
||||
-- Handle itself
|
||||
{'savq/paq-nvim', opt=true},
|
||||
'savq/paq-nvim';
|
||||
|
||||
-- Theme
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'rktjmp/lush.nvim',
|
||||
'briones-gabriel/darcula-solid.nvim',
|
||||
'kyazdani42/nvim-web-devicons';
|
||||
'rktjmp/lush.nvim';
|
||||
'briones-gabriel/darcula-solid.nvim';
|
||||
|
||||
-- treesitter
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'nvim-treesitter/nvim-treesitter';
|
||||
'nvim-treesitter/playground';
|
||||
|
||||
-- Utils
|
||||
'akinsho/nvim-bufferline.lua',
|
||||
'hoob3rt/lualine.nvim',
|
||||
'airblade/vim-gitgutter',
|
||||
'nvim-lua/popup.nvim',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'akinsho/nvim-bufferline.lua';
|
||||
'hoob3rt/lualine.nvim';
|
||||
'j-hui/fidget.nvim';
|
||||
'airblade/vim-gitgutter';
|
||||
'nvim-lua/popup.nvim';
|
||||
'nvim-lua/plenary.nvim';
|
||||
|
||||
-- File Navigation
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
'kyazdani42/nvim-tree.lua';
|
||||
'nvim-telescope/telescope.nvim';
|
||||
|
||||
-- lsp
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/nvim-lsp-installer',
|
||||
'williamboman/mason.nvim';
|
||||
'williamboman/mason-lspconfig.nvim';
|
||||
'neovim/nvim-lspconfig';
|
||||
'onsails/lspkind-nvim'; -- pictograms
|
||||
'simrat39/rust-tools.nvim';
|
||||
|
||||
-- completion
|
||||
'hrsh7th/cmp-nvim-lsp';
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help';
|
||||
'hrsh7th/cmp-buffer';
|
||||
'hrsh7th/cmp-path';
|
||||
'hrsh7th/cmp-nvim-lua';
|
||||
'hrsh7th/cmp-cmdline';
|
||||
'hrsh7th/nvim-cmp';
|
||||
|
||||
-- snippets needed for cmp
|
||||
'L3MON4D3/LuaSnip';
|
||||
'saadparwaiz1/cmp_luasnip';
|
||||
|
||||
-- autopair
|
||||
'windwp/nvim-autopairs';
|
||||
|
||||
-- Linting & formtatting
|
||||
'jose-elias-alvarez/null-ls.nvim';
|
||||
|
||||
-- writing
|
||||
'vimwiki/vimwiki',
|
||||
'junegunn/goyo.vim',
|
||||
'junegunn/limelight.vim',
|
||||
'vimwiki/vimwiki';
|
||||
'junegunn/goyo.vim';
|
||||
'junegunn/limelight.vim';
|
||||
}
|
||||
|
||||
function plugins.init()
|
||||
vim.cmd 'packadd paq-nvim'
|
||||
plugins.load(pluginList)
|
||||
end
|
||||
|
||||
return plugins
|
||||
|
73
lua/settings/completion.lua
Normal file
73
lua/settings/completion.lua
Normal file
@ -0,0 +1,73 @@
|
||||
-- Completion
|
||||
|
||||
local completion = {}
|
||||
local cmp = require'cmp'
|
||||
local lspkind = require'lspkind'
|
||||
|
||||
vim.opt.shortmess:append 'c'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
}),
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 5 },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[api]",
|
||||
path = "[path]",
|
||||
luasnip = "[snip]",
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (basically search words in buffer)
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- autopair
|
||||
require('nvim-autopairs').setup {}
|
||||
|
||||
return completion
|
@ -28,6 +28,7 @@ function settings.initMisc()
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
end
|
||||
|
||||
function settings.initVimWiki()
|
||||
@ -39,6 +40,8 @@ function settings.init()
|
||||
settings.initVimWiki()
|
||||
require'settings.theme'.init()
|
||||
require'settings.lsp'.init()
|
||||
require'settings.completion'
|
||||
require'settings.tree'
|
||||
end
|
||||
|
||||
return settings
|
||||
|
@ -2,54 +2,60 @@
|
||||
|
||||
local lsp = {}
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
local lsp_attach = function(client, buf)
|
||||
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workleader_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workleader_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workleader_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
local bufopts = { noremap=true, silent=true, buffer=buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
end
|
||||
|
||||
function lsp.init()
|
||||
local lsp_installer = require'nvim-lsp-installer'
|
||||
require'mason'.setup()
|
||||
require'mason-lspconfig'.setup()
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
if server.name == 'sumneko_lua' then
|
||||
opts.settings = {
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local lspconfig = require'lspconfig'
|
||||
|
||||
lspconfig.sumneko_lua.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
},
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
end
|
||||
opts.on_attach = on_attach
|
||||
opts.flags = {
|
||||
debounce_text_changes = 150,
|
||||
lspconfig.tsserver.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
server:setup(opts)
|
||||
end)
|
||||
lspconfig.gopls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
--lspconfig.rust_analyzer.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = lsp_attach
|
||||
--}
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach,
|
||||
standalone = false
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return lsp
|
||||
|
@ -6,6 +6,10 @@ function theme.initFont()
|
||||
vim.opt.guifont = 'Source Code Pro for Powerline'
|
||||
end
|
||||
|
||||
function theme.lsp_status()
|
||||
require'fidget'.setup {}
|
||||
end
|
||||
|
||||
function theme.initStatusline()
|
||||
require'lualine'.setup {
|
||||
options = {
|
||||
@ -28,6 +32,7 @@ end
|
||||
|
||||
function theme.init()
|
||||
theme.initFont()
|
||||
theme.lsp_status()
|
||||
theme.initStatusline()
|
||||
theme.initBufferline()
|
||||
theme.initColorscheme()
|
||||
|
60
lua/settings/tree.lua
Normal file
60
lua/settings/tree.lua
Normal file
@ -0,0 +1,60 @@
|
||||
-- Tree
|
||||
|
||||
local tree = {}
|
||||
|
||||
require'nvim-tree'.setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {}
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {}
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {}
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tree
|
Loading…
Reference in New Issue
Block a user