nix/prog/nvim: move plugins config to lua
This commit is contained in:
parent
5762db06cc
commit
754f0a0859
4 changed files with 83 additions and 70 deletions
|
@ -1,2 +1,3 @@
|
|||
lua require 'basic'
|
||||
lua require 'plugins'
|
||||
lua require 'coc'
|
||||
|
|
|
@ -12,7 +12,6 @@ let
|
|||
plugins = pkgs.vimPlugins // customPlugins;
|
||||
|
||||
myVimPlugins = with plugins; [
|
||||
coc-nvim # LSP client + autocompletion plugin
|
||||
coc-tsserver # typescript LSP
|
||||
coc-eslint # eslint LSP
|
||||
coc-rust-analyzer # rust LSP
|
||||
|
@ -39,11 +38,7 @@ let
|
|||
];
|
||||
additionalPackages = lspPackages ++ toolsPackages;
|
||||
|
||||
baseConfig = builtins.readFile ./config.vim;
|
||||
pluginsConfig = builtins.readFile ./plugins.vim;
|
||||
cocSettings = builtins.toJSON (import ./coc_settings.nix);
|
||||
|
||||
vimConfig = baseConfig + pluginsConfig;
|
||||
vimConfig = builtins.readFile ./config.vim;
|
||||
in
|
||||
{
|
||||
options.progs.nvim = {
|
||||
|
@ -69,11 +64,14 @@ in
|
|||
plugins = myVimPlugins;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
coc = {
|
||||
enable = true;
|
||||
settings = ./coc_settings.nix;
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"nvim/lua".source = ./lua;
|
||||
"nvim/coc-settings.json".text = cocSettings;
|
||||
};
|
||||
|
||||
home.sessionVariables = mkIf cfg.default {
|
||||
|
|
77
nix/progs/nvim/lua/plugins.lua
Normal file
77
nix/progs/nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1,77 @@
|
|||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- NerdTree
|
||||
--
|
||||
|
||||
vim.g.NERDTreeDirArrowExpandable = '▸'
|
||||
vim.g.NERDTreeDirArrowCollapsible = '▾'
|
||||
|
||||
vim.g.NERDTreeMiniamlUI = 1
|
||||
vim.g.NERDTreeDirArrows = 1
|
||||
|
||||
-- Nerdtree git plugin symbols
|
||||
vim.g.NERDTreeGitStatusIndicatorMapCustom = {
|
||||
Modified = 'ᵐ',
|
||||
Staged = 'ˢ',
|
||||
Untracked = 'ᵘ',
|
||||
Renamed = 'ʳ',
|
||||
Unmerged = 'ᶴ',
|
||||
Deleted = 'ˣ',
|
||||
Dirty = '˜',
|
||||
Clean = 'ᵅ',
|
||||
Unknown = '?',
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>nt', ':NERDTreeToggle<CR>')
|
||||
vim.keymap.set('n', '<leader>nf', ':NERDTreeFind<CR>')
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- NeoFormat
|
||||
--
|
||||
vim.g.neoformat_try_node_exe = 1
|
||||
vim.g.neoformat_only_msg_on_error = 1
|
||||
vim.g.neoformat_enabled_markdown = {"denofmt"}
|
||||
|
||||
local format_augroup = vim.api.nvim_create_augroup('format', {})
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
pattern = '*',
|
||||
group = spell_check_augroup,
|
||||
callback = 'try | undojoin | NeoFormat | catch /E790/ | NeoFormat | endtry'
|
||||
})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- GitGutter
|
||||
--
|
||||
vim.g.gitgutter_sign_priority = 1
|
||||
vim.g.gitgutter_set_sign_backgrounds = 0
|
||||
vim.g.gitgutter_map_keys = 0
|
||||
|
||||
vim.keymap.set('n', '<leader>ghp', ':GitGutterPreviewHunk<CR>')
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- TreeSitter
|
||||
--
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {
|
||||
"typescript",
|
||||
"tsx",
|
||||
"rust",
|
||||
"haskell",
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
" Nerdtree
|
||||
|
||||
noremap <leader>nt :NERDTreeToggle<CR>
|
||||
noremap <leader>nf :NERDTreeFind<CR>
|
||||
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
|
||||
let g:NERDTreeMiniamlUI = 1
|
||||
let g:NERDTreeDirArrows = 1
|
||||
|
||||
" Nerdtree git plugin symbols
|
||||
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
||||
\ "Modified" : "ᵐ",
|
||||
\ "Staged" : "ˢ",
|
||||
\ "Untracked" : "ᵘ",
|
||||
\ "Renamed" : "ʳ",
|
||||
\ "Unmerged" : "ᶴ",
|
||||
\ "Deleted" : "ˣ",
|
||||
\ "Dirty" : "˜",
|
||||
\ "Clean" : "ᵅ",
|
||||
\ "Unknown" : "?"
|
||||
\ }
|
||||
|
||||
" NeoFormat
|
||||
let g:neoformat_try_node_exe = 1
|
||||
let g:neoformat_only_msg_on_error = 1
|
||||
let g:neoformat_enabled_markdown = ["denofmt"]
|
||||
aug fmt
|
||||
au!
|
||||
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
|
||||
aug END
|
||||
|
||||
" GitGutter
|
||||
let g:gitgutter_sign_priority = 1
|
||||
let g:gitgutter_set_sign_backgrounds = 0
|
||||
let g:gitgutter_map_keys = 0
|
||||
|
||||
nnoremap <leader>ghp :GitGutterPreviewHunk<CR>
|
||||
|
||||
" TreeSitter
|
||||
lua << EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {
|
||||
"typescript",
|
||||
"tsx",
|
||||
"rust",
|
||||
"haskell",
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
EOF
|
Loading…
Reference in a new issue