mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-02-16 20:23:04 +01:00
initial nix cfg
This commit is contained in:
commit
9b8f797264
16 changed files with 1968 additions and 0 deletions
68
nvim/lua/completion.lua
Normal file
68
nvim/lua/completion.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
require'lsp_signature'.on_attach()
|
||||
|
||||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
min_length = 1;
|
||||
preselect = 'enable';
|
||||
throttle_time = 80;
|
||||
source_timeout = 200;
|
||||
incomplete_delay = 400;
|
||||
max_abbr_width = 100;
|
||||
max_kind_width = 100;
|
||||
max_menu_width = 100;
|
||||
documentation = true;
|
||||
|
||||
source = {
|
||||
path = true;
|
||||
buffer = true;
|
||||
calc = true;
|
||||
nvim_lsp = true;
|
||||
nvim_lua = true;
|
||||
vsnip = true;
|
||||
spell = true;
|
||||
};
|
||||
}
|
||||
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
local check_back_space = function()
|
||||
local col = vim.fn.col('.') - 1
|
||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Use (s-)tab to:
|
||||
--- move to prev/next item in completion menuone
|
||||
--- jump to prev/next snippet's placeholder
|
||||
_G.tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-n>"
|
||||
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
||||
return t "<Plug>(vsnip-expand-or-jump)"
|
||||
elseif check_back_space() then
|
||||
return t "<Tab>"
|
||||
else
|
||||
return vim.fn['compe#complete']()
|
||||
end
|
||||
end
|
||||
_G.s_tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-p>"
|
||||
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||
return t "<Plug>(vsnip-jump-prev)"
|
||||
else
|
||||
return t "<S-Tab>"
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||
95
nvim/lua/lsp.lua
Normal file
95
nvim/lua/lsp.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
vim.lsp.set_log_level("debug")
|
||||
|
||||
local lsp_status = require('lsp-status')
|
||||
lsp_status.register_progress()
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities = vim.tbl_extend('keep', capabilities, lsp_status.capabilities)
|
||||
|
||||
require('lspkind').init({})
|
||||
|
||||
require'lspconfig'.rust_analyzer.setup{
|
||||
on_attach=lsp_status.on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true
|
||||
},
|
||||
updates = {
|
||||
channel = "nightly"
|
||||
},
|
||||
}
|
||||
},
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require'lspconfig'.jsonls.setup{
|
||||
on_attach=lsp_status.on_attach,
|
||||
cmd = { "json-languageserver", "--stdio" },
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.bashls.setup{
|
||||
on_attach=lsp_status.on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.clangd.setup{
|
||||
on_attach = lsp_status.on_attach,
|
||||
handlers = lsp_status.extensions.clangd.setup(),
|
||||
init_options = { clangdFileStatus = true},
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.texlab.setup{
|
||||
on_attach = lsp_status.on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require'lspconfig'.rnix.setup{
|
||||
on_attach = lsp_status.on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
--[[ local system_name
|
||||
if vim.fn.has("mac") == 1 then
|
||||
system_name = "macOS"
|
||||
elseif vim.fn.has("unix") == 1 then
|
||||
system_name = "Linux"
|
||||
elseif vim.fn.has('win32') == 1 then
|
||||
system_name = "Windows"
|
||||
else
|
||||
print("Unsupported system for sumneko")
|
||||
end
|
||||
|
||||
local sumneko_root_path = "/home/traxys/softs/lua-language-server"
|
||||
local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server"
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
on_attach=lsp_status.on_attach,
|
||||
capabilities = capabilities,
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ';'),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
||||
},
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
} ]]
|
||||
1
nvim/lua/misc.lua
Normal file
1
nvim/lua/misc.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require'nvim-web-devicons'.setup{default=true}
|
||||
56
nvim/lua/plugins.lua
Normal file
56
nvim/lua/plugins.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
local execute = vim.api.nvim_command
|
||||
local fn = vim.fn
|
||||
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
|
||||
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
|
||||
execute 'packadd packer.nvim'
|
||||
end
|
||||
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function()
|
||||
use {'wbthomason/packer.nvim', opt = true}
|
||||
|
||||
use { 'aklt/plantuml-syntax' }
|
||||
|
||||
use {'kyazdani42/nvim-web-devicons'}
|
||||
|
||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||
use { 'neovim/nvim-lspconfig' }
|
||||
use { 'nvim-lua/lsp-status.nvim' }
|
||||
|
||||
use { 'kosayoda/nvim-lightbulb' }
|
||||
use { 'Yggdroot/indentLine'}
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
config = function()
|
||||
require('gitsigns').setup()
|
||||
end
|
||||
}
|
||||
|
||||
use { 'bluz71/vim-moonfly-colors' }
|
||||
use { 'hrsh7th/vim-vsnip' }
|
||||
use { 'hrsh7th/nvim-compe' }
|
||||
|
||||
use { 'dpelle/vim-Grammalecte' }
|
||||
use { 'dpelle/vim-LanguageTool' }
|
||||
|
||||
use {'nvim-lua/lsp_extensions.nvim'}
|
||||
use {'ray-x/lsp_signature.nvim'}
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}
|
||||
}
|
||||
|
||||
use 'glepnir/galaxyline.nvim'
|
||||
use 'drmikehenry/vim-headerguard'
|
||||
use 'andymass/vim-matchup'
|
||||
use 'b3nj5m1n/kommentary'
|
||||
use 'onsails/lspkind-nvim'
|
||||
end)
|
||||
220
nvim/lua/statusline.lua
Normal file
220
nvim/lua/statusline.lua
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
local gl = require('galaxyline')
|
||||
local gls = gl.section
|
||||
gl.short_line_list = {'LuaTree','vista','dbui'}
|
||||
|
||||
local colors = {
|
||||
bg = '#282c34',
|
||||
yellow = '#fabd2f',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#afd700',
|
||||
orange = '#FF8800',
|
||||
purple = '#5d4d7a',
|
||||
magenta = '#d16d9e',
|
||||
grey = '#c0c0c0',
|
||||
blue = '#0087d7',
|
||||
red = '#ec5f67',
|
||||
violet = '#6860e7'
|
||||
}
|
||||
|
||||
local buffer_not_empty = function()
|
||||
if vim.fn.empty(vim.fn.expand('%:t')) ~= 1 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Start of line
|
||||
gls.left[1] = {
|
||||
FirstElement = {
|
||||
provider = function() return '▋' end,
|
||||
highlight = {colors.blue,colors.yellow}
|
||||
},
|
||||
}
|
||||
-- Vim mode
|
||||
gls.left[2] = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
local alias = {n = 'NORMAL ',i = 'INSERT ',c= 'COMMAND ',V= 'VISUAL ', [''] = 'VISUAL '}
|
||||
return alias[vim.fn.mode()]
|
||||
end,
|
||||
separator = '',
|
||||
separator_highlight = {colors.yellow,function()
|
||||
if not buffer_not_empty() then
|
||||
return colors.purple
|
||||
end
|
||||
return colors.darkblue
|
||||
end},
|
||||
highlight = {colors.violet,colors.yellow,'bold'},
|
||||
},
|
||||
}
|
||||
-- File Icon
|
||||
gls.left[3] ={
|
||||
FileIcon = {
|
||||
provider = 'FileIcon',
|
||||
condition = buffer_not_empty,
|
||||
highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.darkblue},
|
||||
},
|
||||
}
|
||||
-- File Name
|
||||
gls.left[4] = {
|
||||
FileName = {
|
||||
provider = {'FileName'},
|
||||
condition = buffer_not_empty,
|
||||
separator = '',
|
||||
separator_highlight = {colors.purple,colors.darkblue},
|
||||
highlight = {colors.magenta,colors.darkblue}
|
||||
}
|
||||
}
|
||||
-- GIT
|
||||
gls.left[5] = {
|
||||
GitIcon = {
|
||||
provider = function() return ' ' end,
|
||||
condition = buffer_not_empty,
|
||||
highlight = {colors.orange,colors.purple},
|
||||
}
|
||||
}
|
||||
gls.left[6] = {
|
||||
GitBranch = {
|
||||
provider = 'GitBranch',
|
||||
condition = buffer_not_empty,
|
||||
highlight = {colors.grey,colors.purple},
|
||||
}
|
||||
}
|
||||
|
||||
local vcs = require('galaxyline.provider_vcs')
|
||||
|
||||
local is_file_diff = function ()
|
||||
if vcs.diff_add() ~= nil or vcs.diff_modified() ~= nil or vcs.diff_remove() ~= nil then
|
||||
return ''
|
||||
end
|
||||
end
|
||||
|
||||
gls.left[7] = {
|
||||
GitModified = {
|
||||
provider = is_file_diff,
|
||||
highlight = {colors.green,colors.purple},
|
||||
}
|
||||
}
|
||||
gls.left[8] = {
|
||||
LeftEnd = {
|
||||
provider = function() return '' end,
|
||||
separator = '',
|
||||
separator_highlight = {colors.purple,colors.bg},
|
||||
highlight = {colors.purple,colors.purple}
|
||||
}
|
||||
}
|
||||
|
||||
local lsp_diag_error = function()
|
||||
local diagnostics = require('lsp-status/diagnostics')
|
||||
local buf_diagnostics = diagnostics()
|
||||
|
||||
if buf_diagnostics.errors and buf_diagnostics.errors > 0 then
|
||||
return buf_diagnostics.errors .. ' '
|
||||
end
|
||||
end
|
||||
local lsp_diag_warn = function()
|
||||
local diagnostics = require('lsp-status/diagnostics')
|
||||
local buf_diagnostics = diagnostics()
|
||||
|
||||
if buf_diagnostics.warnings and buf_diagnostics.warnings > 0 then
|
||||
return buf_diagnostics.warnings .. ' '
|
||||
end
|
||||
end
|
||||
local lsp_diag_info = function()
|
||||
local diagnostics = require('lsp-status/diagnostics')
|
||||
local buf_diagnostics = diagnostics()
|
||||
|
||||
if buf_diagnostics.info and buf_diagnostics.info > 0 then
|
||||
return buf_diagnostics.info .. ' '
|
||||
end
|
||||
end
|
||||
local has_lsp = function ()
|
||||
return #vim.lsp.buf_get_clients() > 0
|
||||
end
|
||||
|
||||
local has_curent_func = function ()
|
||||
if not has_lsp then
|
||||
return false
|
||||
end
|
||||
local current_function = vim.b.lsp_current_function
|
||||
return current_function and current_function ~= ''
|
||||
end
|
||||
local lsp_current_func = function ()
|
||||
local current_function = vim.b.lsp_current_function
|
||||
if current_function and current_function ~= '' then
|
||||
return '(' .. current_function .. ') '
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
gls.right[1] = {
|
||||
LspText = {
|
||||
provider = function() return '' end,
|
||||
separator = '',
|
||||
separator_highlight = {colors.darkblue,colors.bg},
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[2] = {
|
||||
LspError = {
|
||||
provider = lsp_diag_error,
|
||||
condition = has_lsp,
|
||||
icon = ' ',
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[3] = {
|
||||
LspWarning = {
|
||||
provider = lsp_diag_warn,
|
||||
condition = has_lsp,
|
||||
icon = ' ',
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[4] = {
|
||||
LspInfo = {
|
||||
provider = lsp_diag_info,
|
||||
condition = has_lsp,
|
||||
icon = ' ',
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[5] = {
|
||||
LspCurrentFunc = {
|
||||
provider = lsp_current_func,
|
||||
condition = has_current_func,
|
||||
icon = '𝒇',
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[6]= {
|
||||
FileFormat = {
|
||||
provider = 'FileFormat',
|
||||
separator = '',
|
||||
separator_highlight = {colors.darkblue,colors.purple},
|
||||
highlight = {colors.grey,colors.purple},
|
||||
}
|
||||
}
|
||||
gls.right[7] = {
|
||||
LineInfo = {
|
||||
provider = 'LineColumn',
|
||||
separator = ' | ',
|
||||
separator_highlight = {colors.darkblue,colors.purple},
|
||||
highlight = {colors.grey,colors.purple},
|
||||
},
|
||||
}
|
||||
gls.right[8] = {
|
||||
PerCent = {
|
||||
provider = 'LinePercent',
|
||||
separator = '',
|
||||
separator_highlight = {colors.darkblue,colors.purple},
|
||||
highlight = {colors.grey,colors.darkblue},
|
||||
}
|
||||
}
|
||||
gls.right[9] = {
|
||||
ScrollBar = {
|
||||
provider = 'ScrollBar',
|
||||
highlight = {colors.yellow,colors.purple},
|
||||
}
|
||||
}
|
||||
18
nvim/lua/tree_sitter.lua
Normal file
18
nvim/lua/tree_sitter.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {"rust", "c", "cpp", "json", "lua", "python", "toml", "latex", "nix"},
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = {"elixir", "teal"}, -- list of language that will be disabled
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = { enable = true },
|
||||
highlight_current_scope = { enable = false },
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
smart_rename = "grr",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue