Add nvim-treesitter configs

This commit is contained in:
Dave Gallant
2021-07-18 10:40:00 -04:00
parent 5b966cf192
commit 68a6282cc9
5 changed files with 59 additions and 24 deletions

View File

@@ -180,6 +180,7 @@ in
audio-recorder audio-recorder
calibre calibre
cryptsetup cryptsetup
firejail
glibcLocales glibcLocales
gnome3.gnome-tweaks gnome3.gnome-tweaks
gnomeExtensions.appindicator gnomeExtensions.appindicator

12
flake.lock generated
View File

@@ -27,11 +27,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1626073055, "lastModified": 1626356862,
"narHash": "sha256-vocByfpVu6m9zvtJugDvmd6/9iT2HJuG4tmDICKd0lI=", "narHash": "sha256-4ONLWH4UygF4pI0XBej8+2OMUrdb8HsUUFsiRDFmjrk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "775cb20bd4af7781fbf336fb201df02ee3d544bb", "rev": "c476cc61b2dd8c7f868b213b7757b565bdf2bb7d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -58,11 +58,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1626046891, "lastModified": 1626464457,
"narHash": "sha256-Zt8saH+hAehXskW0iFAzk+iMillYoFBxvLReYNqGT9E=", "narHash": "sha256-u2PCh/+8vQSLwf0mPpKHKQ8hAPB3l4uNZR3r0TdK2Lg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d8f8f31af9d77a48220e4e8a301d1e79774cb7d2", "rev": "c6c4a3d45ab200f17805d2d86a1ff1cc7ca2b186",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -296,9 +296,13 @@ in
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
completion-nvim completion-nvim
gruvbox gruvbox
# gruvbox-nvim # TODO: Not working for some reason?
# lush-nvim # required by gruvbox-nvim
lualine-nvim lualine-nvim
nerdtree nerdtree
nvim-lspconfig nvim-lspconfig
nvim-treesitter
nvim-ts-rainbow
rust-vim rust-vim
supertab supertab
syntastic syntastic
@@ -316,6 +320,7 @@ in
vim-repeat vim-repeat
vim-sneak vim-sneak
vim-surround vim-surround
vim-signify
vim-terraform vim-terraform
]; ];
@@ -329,6 +334,6 @@ in
}; };
home.file.".config/srv/config.yml".source = ./srv/config.yml; home.file.".config/nvim/init2.lua".source = ./nvim/init2.lua;
} }

View File

@@ -2,8 +2,6 @@ set autoread
set cursorline set cursorline
set encoding=utf-8 set encoding=utf-8
set expandtab set expandtab
set foldlevel=99
set foldmethod=indent
set hlsearch set hlsearch
set ignorecase set ignorecase
set incsearch set incsearch
@@ -58,7 +56,8 @@ au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Python indentation " Python indentation
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix
let python_highlight_all=1 let python_highlight_all=1
syntax on
set background=dark
colorscheme gruvbox colorscheme gruvbox
" Highlight whitespace " Highlight whitespace
@@ -150,17 +149,4 @@ set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion " Avoid showing message extra message when using completion
set shortmess+=c set shortmess+=c
lua << EOF luafile ~/.config/nvim/init2.lua
require('lualine').setup()
require'lspconfig'.bashls.setup{}
require'lspconfig'.gopls.setup{}
require'lspconfig'.pyright.setup{}
require'lspconfig'.rls.setup{}
require'lspconfig'.rnix.setup{}
require'lspconfig'.solargraph.setup{}
require'lspconfig'.terraformls.setup{}
require'lspconfig'.tflint.setup{}
require'lspconfig'.yamlls.setup{}
EOF

43
home/nvim/init2.lua Normal file
View File

@@ -0,0 +1,43 @@
-- status line
require('lualine').setup()
-- lsp
require'lspconfig'.bashls.setup{}
require'lspconfig'.gopls.setup{}
require'lspconfig'.pyright.setup{}
require'lspconfig'.rls.setup{}
require'lspconfig'.rnix.setup{}
require'lspconfig'.solargraph.setup{}
require'lspconfig'.terraformls.setup{}
require'lspconfig'.tflint.setup{}
require'lspconfig'.yamlls.setup{}
-- treesitter
require('nvim-treesitter.configs').setup({
ensure_installed = "all",
highlight = {
enable = true,
custom_captures = {
-- ["<capture group>"] = "<highlight group>",
-- ["keyword"] = "TSString",
},
},
indent = {
enable = true
},
rainbow = {
enable = true,
extended_mode = true
},
})
vim.api.nvim_exec([[
set foldmethod=expr
set foldlevel=20
set nofoldenable
set foldexpr=nvim_treesitter#foldexpr()
]], true)