nix/prog/nvim: move plugins config to lua

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-19 11:43:01 +03:00
parent 5762db06cc
commit 754f0a0859
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
4 changed files with 83 additions and 70 deletions

View file

@ -1,2 +1,3 @@
lua require 'basic' lua require 'basic'
lua require 'plugins'
lua require 'coc' lua require 'coc'

View file

@ -12,7 +12,6 @@ let
plugins = pkgs.vimPlugins // customPlugins; plugins = pkgs.vimPlugins // customPlugins;
myVimPlugins = with plugins; [ myVimPlugins = with plugins; [
coc-nvim # LSP client + autocompletion plugin
coc-tsserver # typescript LSP coc-tsserver # typescript LSP
coc-eslint # eslint LSP coc-eslint # eslint LSP
coc-rust-analyzer # rust LSP coc-rust-analyzer # rust LSP
@ -39,11 +38,7 @@ let
]; ];
additionalPackages = lspPackages ++ toolsPackages; additionalPackages = lspPackages ++ toolsPackages;
baseConfig = builtins.readFile ./config.vim; vimConfig = builtins.readFile ./config.vim;
pluginsConfig = builtins.readFile ./plugins.vim;
cocSettings = builtins.toJSON (import ./coc_settings.nix);
vimConfig = baseConfig + pluginsConfig;
in in
{ {
options.progs.nvim = { options.progs.nvim = {
@ -69,11 +64,14 @@ in
plugins = myVimPlugins; plugins = myVimPlugins;
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
coc = {
enable = true;
settings = ./coc_settings.nix;
};
}; };
xdg.configFile = { xdg.configFile = {
"nvim/lua".source = ./lua; "nvim/lua".source = ./lua;
"nvim/coc-settings.json".text = cocSettings;
}; };
home.sessionVariables = mkIf cfg.default { home.sessionVariables = mkIf cfg.default {

View 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,
},
}

View file

@ -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