Added some more stuff to neovim lua config
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
-- local vim = vim
|
||||||
require('plugins')
|
require('plugins')
|
||||||
require('keymaps')
|
require('keymaps')
|
||||||
|
|
||||||
@@ -6,12 +7,21 @@ vim.api.nvim_exec([[
|
|||||||
augroup Packer
|
augroup Packer
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePost init.lua PackerCompile
|
autocmd BufWritePost init.lua PackerCompile
|
||||||
|
autocmd BufWritePost keymaps.lua PackerCompile
|
||||||
autocmd BufWritePost plugins.lua PackerCompile
|
autocmd BufWritePost plugins.lua PackerCompile
|
||||||
augroup end
|
augroup end
|
||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
augroup AutoSaveGroup
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!
|
||||||
|
autocmd BufWinEnter ?* silent! loadview
|
||||||
|
augroup end
|
||||||
|
]], false)
|
||||||
|
|
||||||
vim.o.timeoutlen = 700
|
vim.o.timeoutlen = 700
|
||||||
vim.o.guifont='FiraCode Nerd Font Mono'
|
vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font'
|
||||||
|
|
||||||
vim.o.undodir=vim.fn.stdpath('cache')..'/undodir'
|
vim.o.undodir=vim.fn.stdpath('cache')..'/undodir'
|
||||||
vim.o.undofile = true
|
vim.o.undofile = true
|
||||||
@@ -19,8 +29,13 @@ vim.o.undofile = true
|
|||||||
vim.o.showmode = false
|
vim.o.showmode = false
|
||||||
vim.o.showtabline = 2
|
vim.o.showtabline = 2
|
||||||
vim.o.autoindent = true
|
vim.o.autoindent = true
|
||||||
|
|
||||||
vim.o.tabstop=4
|
vim.o.tabstop=4
|
||||||
|
vim.o.softtabstop=4
|
||||||
|
|
||||||
vim.o.shiftwidth=4
|
vim.o.shiftwidth=4
|
||||||
|
vim.bo.shiftwidth=4
|
||||||
|
|
||||||
vim.o.expandtab = true
|
vim.o.expandtab = true
|
||||||
vim.o.hidden = true
|
vim.o.hidden = true
|
||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
@@ -28,3 +43,20 @@ vim.o.smartcase = true
|
|||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
-- No clue why window scoped
|
-- No clue why window scoped
|
||||||
vim.wo.signcolumn='yes'
|
vim.wo.signcolumn='yes'
|
||||||
|
|
||||||
|
-- vim.o.modifiable = true
|
||||||
|
-- vim.bo.modifiable = true
|
||||||
|
vim.g.dashboard_default_executive = 'fzf'
|
||||||
|
vim.g.python_highlight_all = 1
|
||||||
|
|
||||||
|
vim.g.test = {
|
||||||
|
default = {
|
||||||
|
default = {
|
||||||
|
complete_items = { 'lsp', 'snippet' },
|
||||||
|
mode = 'file',
|
||||||
|
},
|
||||||
|
comment = {},
|
||||||
|
string = { complete_items = { 'path' } },
|
||||||
|
},
|
||||||
|
rust = { { complete_items = {'ts'} } },
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,34 +15,49 @@ local normal_mode_maps = {
|
|||||||
|
|
||||||
-- fzf
|
-- fzf
|
||||||
{ key = '<leader>;', map = [[<cmd>Buffers<cr>]] },
|
{ key = '<leader>;', map = [[<cmd>Buffers<cr>]] },
|
||||||
{ key = '<leader>f', map = [[<cmd>Files<cr>]] },
|
{ key = '<leader>ff', map = [[<cmd>Files<cr>]] },
|
||||||
|
{ key = '<leader>fb', map = [[<cmd>Marks<cr>]] },
|
||||||
|
{ key = '<leader>fh', map = [[<cmd>History<cr>]] },
|
||||||
|
{ key = '<leader>fa', map = [[<cmd>History<cr>]] },
|
||||||
|
|
||||||
|
{ key = '<leader>tc', map = [[<cmd>Colors<cr>]] },
|
||||||
{ key = '<leader>g', map = [[<cmd>Rg<cr>]] },
|
{ key = '<leader>g', map = [[<cmd>Rg<cr>]] },
|
||||||
|
|
||||||
|
-- Session
|
||||||
|
{ key = '<leader>ss', map = [[<cmd>SessionSave<cr>]] },
|
||||||
|
{ key = '<leader>sl', map = [[<cmd>SessionLoad<cr>]] },
|
||||||
|
|
||||||
-- lsp
|
-- lsp
|
||||||
{ key = 'K', map = [[<cmd>lua vim.lsp.buf.hover()<cr>]] },
|
{ key = 'K', map = [[<cmd>lua vim.lsp.buf.hover()<cr>]] },
|
||||||
{ key = 'gd', map = [[<cmd>lua vim.lsp.buf.definition()<cr>]] },
|
{ key = '<C-k>', map = [[<cmd>lua vim.lsp.buf.definition()<cr>]] },
|
||||||
{ key = 'gi', map = [[<cmd>lua vim.lsp.buf.implementation()<cr>]] },
|
{ key = 'gi', map = [[<cmd>lua vim.lsp.buf.implementation()<cr>]] },
|
||||||
{ key = '<leader>o', map = [[<cmd>LspTroubleToggle<cr>]] },
|
{ key = '<leader>o', map = [[<cmd>LspTroubleToggle<cr>]] },
|
||||||
{ key = '<leader>a', map = [[<cmd>lua vim.lsp.buf.document_highlight()<cr>]] },
|
-- { key = '<leader>a', map = [[<cmd>lua vim.lsp.buf.document_highlight()<cr>]] },
|
||||||
{ key = '<leader>c', map = [[<cmd>lua vim.lsp.buf.clear_references()<cr>]] },
|
-- { key = '<leader>c', map = [[<cmd>lua vim.lsp.buf.clear_references()<cr>]] },
|
||||||
|
{ key = '<leader>"', map = [["+]] },
|
||||||
{ key = 'F', map = [[<cmd>lua vim.lsp.buf.formatting()<cr>]] },
|
{ key = 'F', map = [[<cmd>lua vim.lsp.buf.formatting()<cr>]] },
|
||||||
|
{ key = 'T', map = [[<cmd>lua require'lsp_extensions'.inlay_hints()<cr>]] },
|
||||||
|
|
||||||
-- Other
|
-- Other
|
||||||
{ key = '<leader>m', map = [[<cmd>silent !mpcfzf<cr>]] },
|
{ key = '<leader>m', map = [[<cmd>silent !mpcfzf<cr>]] },
|
||||||
}
|
}
|
||||||
|
|
||||||
local insert_mode_maps = {
|
|
||||||
{
|
|
||||||
key = '<Tab>',
|
|
||||||
map = [[pumvisible() ? "\<C-n>" : "\<Tab>"]],
|
|
||||||
options = { noremap = true, silent = true, expr = true }
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
vim.api.nvim_command([[imap <tab> <Plug>(completion_smart_tab)]])
|
||||||
key = '<S-Tab>',
|
vim.api.nvim_command([[imap <s-tab> <Plug>(completion_smart_s_tab)]])
|
||||||
map = [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]],
|
|
||||||
options = { noremap = true, silent = true, expr = true }
|
local insert_mode_maps = {
|
||||||
},
|
-- {
|
||||||
|
-- key = '<Tab>',
|
||||||
|
-- map = [[pumvisible() ? "\<C-n>" : "\<Tab>"]],
|
||||||
|
-- options = { noremap = true, silent = true, expr = true }
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- {
|
||||||
|
-- key = '<S-Tab>',
|
||||||
|
-- map = [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]],
|
||||||
|
-- options = { noremap = true, silent = true, expr = true }
|
||||||
|
-- },
|
||||||
|
|
||||||
-- { key = '<tab>', map = '(completion_smart_tab)', options = { plug = true } },
|
-- { key = '<tab>', map = '(completion_smart_tab)', options = { plug = true } },
|
||||||
-- { key = '<s-tab>', map = '(completion_smart_s_tab)', options = { plug = true } },
|
-- { key = '<s-tab>', map = '(completion_smart_s_tab)', options = { plug = true } },
|
||||||
@@ -55,10 +70,10 @@ for idx = 1, #normal_mode_maps do
|
|||||||
if normal_mode_maps[idx].options then
|
if normal_mode_maps[idx].options then
|
||||||
local options = normal_mode_maps[idx].options
|
local options = normal_mode_maps[idx].options
|
||||||
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
|
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
|
||||||
else
|
else
|
||||||
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
|
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for idx = 1, #insert_mode_maps do
|
for idx = 1, #insert_mode_maps do
|
||||||
if insert_mode_maps[idx].options then
|
if insert_mode_maps[idx].options then
|
||||||
@@ -67,4 +82,13 @@ for idx = 1, #insert_mode_maps do
|
|||||||
else
|
else
|
||||||
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options)
|
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- local ff = {
|
||||||
|
-- { 'this', 'and this' },
|
||||||
|
-- { 'that', 'and that' },
|
||||||
|
-- }
|
||||||
|
-- print(ff[1][2])
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
require("lsp.rust-analyzer")
|
require("lsp.rust-analyzer")
|
||||||
require("lsp.lua-language-server")
|
require("lsp.lua-language-server")
|
||||||
|
require("lsp.pyls")
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt= "menuone,noinsert,noselect"
|
vim.o.completeopt= "menuone,noinsert,noselect"
|
||||||
|
|||||||
6
config/nvim/lua/lsp/pyls.lua
Normal file
6
config/nvim/lua/lsp/pyls.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
local lspconfig = require'lspconfig'
|
||||||
|
|
||||||
|
lspconfig.pyls.setup{
|
||||||
|
cmd = { "pyls" },
|
||||||
|
filetypes = { "python" },
|
||||||
|
}
|
||||||
@@ -11,10 +11,11 @@ lspconfig.rust_analyzer.setup{
|
|||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = {
|
["rust-analyzer"] = {
|
||||||
checkOnSave = {
|
checkOnSave = {
|
||||||
command = "clippy";
|
command = "clippy",
|
||||||
},
|
},
|
||||||
cargo = {
|
cargo = {
|
||||||
allFeatures = true;
|
allFeatures = true,
|
||||||
|
-- target = "aarch64-linux-android"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
local vim = vim
|
||||||
local execute = vim.api.nvim_command
|
local execute = vim.api.nvim_command
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
|
||||||
@@ -44,30 +45,41 @@ return require('packer').startup(function()
|
|||||||
'tpope/vim-commentary',
|
'tpope/vim-commentary',
|
||||||
'tpope/vim-fugitive',
|
'tpope/vim-fugitive',
|
||||||
}
|
}
|
||||||
|
|
||||||
use { 'norcalli/nvim-colorizer.lua', config = function() require'colorizer'.setup() end, }
|
use { 'norcalli/nvim-colorizer.lua', config = function() require'colorizer'.setup() end, }
|
||||||
|
|
||||||
-- lsp
|
-- lsp
|
||||||
use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, }
|
use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, }
|
||||||
use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup {} end, }
|
use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, }
|
||||||
use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }
|
use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }
|
||||||
use { 'nvim-lua/completion-nvim' }
|
use { 'nvim-lua/completion-nvim' }
|
||||||
use { 'nvim-lua/lsp-status.nvim' }
|
use { 'nvim-lua/lsp-status.nvim' }
|
||||||
use {
|
-- use { 'folke/lsp-colors.nvim' }
|
||||||
'nvim-lua/lsp_extensions.nvim',
|
use { 'nvim-lua/lsp_extensions.nvim' }
|
||||||
config =
|
-- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end,
|
||||||
function()
|
--
|
||||||
vim.api.nvim_command([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints{}]])
|
-- Qol
|
||||||
end
|
use { 'sindrets/diffview.nvim' }
|
||||||
|
use { 'justinmk/vim-sneak' }
|
||||||
|
use {
|
||||||
|
'akinsho/nvim-toggleterm.lua',
|
||||||
|
config = function() require'setup.toggleterm' end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
use { 'airblade/vim-rooter' }
|
use { 'airblade/vim-rooter' }
|
||||||
|
use { 'glepnir/dashboard-nvim' }
|
||||||
|
|
||||||
-- rust {{{
|
-- Treesitter {{{
|
||||||
|
use { 'nvim-treesitter/nvim-treesitter' }
|
||||||
|
use { 'nvim-treesitter/completion-treesitter' }
|
||||||
|
--- }}}
|
||||||
|
|
||||||
|
--: rust {{{
|
||||||
use {
|
use {
|
||||||
'rust-lang/rust.vim',
|
'rust-lang/rust.vim',
|
||||||
'mhinz/vim-crates',
|
'mhinz/vim-crates',
|
||||||
'cespare/vim-toml',
|
'cespare/vim-toml',
|
||||||
}
|
}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
use { 'vim-python/python-syntax' }
|
||||||
end)
|
end)
|
||||||
|
|||||||
31
config/nvim/lua/setup/toggleterm.lua
Normal file
31
config/nvim/lua/setup/toggleterm.lua
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
require("toggleterm").setup{
|
||||||
|
size = 70,
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
|
shade_filetypes = {},
|
||||||
|
shade_terminals = true,
|
||||||
|
shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
||||||
|
start_in_insert = true,
|
||||||
|
persist_size = true,
|
||||||
|
-- direction = 'vertical' | 'horizontal' | 'window' | 'float',
|
||||||
|
direction = 'vertical',
|
||||||
|
close_on_exit = true, -- close the terminal window when the process exits
|
||||||
|
shell = vim.o.shell, -- change the default shell
|
||||||
|
-- This field is only relevant if direction is set to 'float'
|
||||||
|
float_opts = {
|
||||||
|
-- The border key is *almost* the same as 'nvim_win_open'
|
||||||
|
-- see :h nvim_win_open for details on borders however
|
||||||
|
-- the 'curved' border is a custom border type
|
||||||
|
-- not natively supported but implemented in this plugin.
|
||||||
|
|
||||||
|
-- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
|
||||||
|
border = 'single',
|
||||||
|
width = 30,
|
||||||
|
height = 30,
|
||||||
|
winblend = 3,
|
||||||
|
highlights = {
|
||||||
|
border = "Normal",
|
||||||
|
background = "Normal",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ local gl = require('galaxyline')
|
|||||||
|
|
||||||
local condition = require('galaxyline.condition')
|
local condition = require('galaxyline.condition')
|
||||||
-- local diagnostic = require('galaxyline.provider_diagnostic')
|
-- local diagnostic = require('galaxyline.provider_diagnostic')
|
||||||
local diagnostics = require('lsp-status.diagnostics')
|
-- local diagnostics = require('lsp-status.diagnostics')
|
||||||
local vcs = require('galaxyline.provider_vcs')
|
local vcs = require('galaxyline.provider_vcs')
|
||||||
local fileinfo = require('galaxyline.provider_fileinfo')
|
local fileinfo = require('galaxyline.provider_fileinfo')
|
||||||
-- local extension = require('galaxyline.provider_extensions')
|
-- local extension = require('galaxyline.provider_extensions')
|
||||||
@@ -36,12 +36,13 @@ local colors = {
|
|||||||
bg_blue = '#85d3f2',
|
bg_blue = '#85d3f2',
|
||||||
diff_blue = '#354157',
|
diff_blue = '#354157',
|
||||||
|
|
||||||
|
yellow = '#e7c664',
|
||||||
diff_yellow = '#4e432f',
|
diff_yellow = '#4e432f',
|
||||||
|
|
||||||
fg = '#e2e2e3',
|
fg = '#e2e2e3',
|
||||||
|
|
||||||
red = '#fc5d7c',
|
red = '#fc5d7c',
|
||||||
orange = '#f39660',
|
orange = '#f39660',
|
||||||
yellow = '#e7c664',
|
|
||||||
green = '#9ed072',
|
green = '#9ed072',
|
||||||
blue = '#76cce0',
|
blue = '#76cce0',
|
||||||
purple = '#b39df3',
|
purple = '#b39df3',
|
||||||
@@ -107,14 +108,6 @@ gls.left[1] = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- gls.left[2] = {
|
|
||||||
-- GitIcon = {
|
|
||||||
-- provider = function() return ' ' end,
|
|
||||||
-- condition = condition.check_git_workspace,
|
|
||||||
-- highlight = { colors.purple , colors.bg1 },
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
|
|
||||||
gls.left[2] = {
|
gls.left[2] = {
|
||||||
GitBranch = {
|
GitBranch = {
|
||||||
provider = function() return vcs.get_git_branch()..' ' end,
|
provider = function() return vcs.get_git_branch()..' ' end,
|
||||||
@@ -129,15 +122,7 @@ gls.left[2] = {
|
|||||||
gls.left[3] = {
|
gls.left[3] = {
|
||||||
ShowLspStatus = {
|
ShowLspStatus = {
|
||||||
provider = lspstatus.status,
|
provider = lspstatus.status,
|
||||||
-- condition = function ()
|
highlight = { colors.grey , colors.dark_black, 'bold' }
|
||||||
-- local tbl = {['dashboard'] = true,['']=true}
|
|
||||||
-- if tbl[vim.bo.filetype] then
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
-- return true
|
|
||||||
-- end,
|
|
||||||
-- icon = ' LSP:',
|
|
||||||
highlight = { colors.diff_yellow , colors.dark_black, 'bold' }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user