diff --git a/arch/base.deps b/arch/base.deps index 3f6a9ca..c9a2b26 100644 --- a/arch/base.deps +++ b/arch/base.deps @@ -4,3 +4,5 @@ bat calcurse pam-gnupg zfxtop +nvim +lua diff --git a/editors/nvim/colors/hybrid.vim b/editors/nvim/config/colors/hybrid.vim similarity index 100% rename from editors/nvim/colors/hybrid.vim rename to editors/nvim/config/colors/hybrid.vim diff --git a/editors/nvim/config/init.lua b/editors/nvim/config/init.lua new file mode 100644 index 0000000..2a6c417 --- /dev/null +++ b/editors/nvim/config/init.lua @@ -0,0 +1,40 @@ +require('keymap') +require('plugins') +require('calcurse') + +-- prevent cursor override +vim.cmd('set guicursor=') +-- basic settings +vim.cmd('filetype plugin indent on') +vim.cmd('set ts=4 sts=4 sw=4 expandtab') + +vim.opt.relativenumber = true + +vim.opt.compatible = false + +-- colorscheme and syntax settings +vim.cmd([[ + syntax enable + colorscheme hybrid + hi Normal ctermbg=NONE +]]) + +-- defaults to transparent +transparent = true + +-- timeouts +vim.opt.ttimeout = true +vim.opt.ttimeoutlen = 100 + +-- nvim tree basics + +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- vimwiki changes +vim.cmd([[ + let g:vimwiki_list = [{'path': '~/vimwiki/', + \ 'syntax': 'markdown', 'ext':'.md'}] +]]) + + diff --git a/editors/nvim/config/lua/calcurse.lua b/editors/nvim/config/lua/calcurse.lua new file mode 100644 index 0000000..c27546d --- /dev/null +++ b/editors/nvim/config/lua/calcurse.lua @@ -0,0 +1,7 @@ +-- calcurse -> markdown +vim.api.nvim_create_autocmd({"BufRead","BufNewFile"}, { + pattern = {"/tmp/calcurse*","~/.local/share/calcurse/notes/*"}, + command = "set filetype=markdown", +}) + + diff --git a/editors/nvim/config/lua/keymap.lua b/editors/nvim/config/lua/keymap.lua new file mode 100644 index 0000000..f3f86c5 --- /dev/null +++ b/editors/nvim/config/lua/keymap.lua @@ -0,0 +1,20 @@ +require("transparent") + +vim.g.mapleader = " " + +vim.keymap.set("n", "b", ":lua toggleTransparent()") + +-- nvim-tree bindings + +vim.keymap.set("n", "t", ":NvimTreeToggle") + +vim.keymap.set("n", "s", ":lua spellToggle()") + +-- toggle spell check +function spellToggle() + if vim.o.spell == nil or vim.o.spell then + vim.o.spell = false + else + vim.o.spell = true + end +end diff --git a/editors/nvim/config/lua/plugins.lua b/editors/nvim/config/lua/plugins.lua new file mode 100644 index 0000000..1dfc555 --- /dev/null +++ b/editors/nvim/config/lua/plugins.lua @@ -0,0 +1,12 @@ +require('tree') + +-- airline settings +if vim.g.airline_symbols == nil then + vim.g.airline_symbols = vim.empty_dict() +end + +vim.g.airline_powerline_fonts = 1 +vim.g.airline_symbols.linenr = '' +vim.g.airline_symbols.maxlinenr = '' +vim.g.airline_symbols.dirty = '' + diff --git a/editors/nvim/lua/transparent.lua b/editors/nvim/config/lua/transparent.lua similarity index 99% rename from editors/nvim/lua/transparent.lua rename to editors/nvim/config/lua/transparent.lua index a61b360..a691ebe 100644 --- a/editors/nvim/lua/transparent.lua +++ b/editors/nvim/config/lua/transparent.lua @@ -1,9 +1,10 @@ + function toggleTransparent() + transparent = not transparent if transparent then + vim.cmd("hi Normal ctermbg=NONE") + else vim.cmd("set background=dark") vim.cmd("syntax enable") - else - vim.cmd("hi Normal ctermbg=NONE") end - transparent = not transparent end diff --git a/editors/nvim/config/lua/tree.lua b/editors/nvim/config/lua/tree.lua new file mode 100644 index 0000000..f562094 --- /dev/null +++ b/editors/nvim/config/lua/tree.lua @@ -0,0 +1,40 @@ +require('nvim-tree').setup({ + filters = { + dotfiles = true, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, +}) +showHiddenFiles = false + +local function open_nvim_tree(data) + + -- buffer is a directory + local directory = vim.fn.isdirectory(data.file) == 1 + + local empty_file = data.file == "" + print(empty_file) + + if not directory and not empty_file then + return + end + + if directory then + vim.cmd.cd(data.file) + + end + vim.cmd.enew() + vim.cmd.bw(data.buf) + -- change to directory and open + require("nvim-tree.api").tree.open() +end + +-- toggle dotfiles visibility +vim.keymap.set("n", "d", ":lua require('nvim-tree.api').tree.toggle_hidden_filter()") + +-- nvim-tree open at startup +vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree, }) + diff --git a/editors/nvim/init.vim b/editors/nvim/init.vim deleted file mode 100644 index 1fd93c2..0000000 --- a/editors/nvim/init.vim +++ /dev/null @@ -1,23 +0,0 @@ -lua require('keymap') - -filetype plugin indent on - -set ts=4 sts=4 sw=4 expandtab -set backspace=indent,eol,start - -set relativenumber - -set nocompatible - -syntax enable -colorscheme hybrid - -" transparent settings -hi Normal ctermbg=NONE -:lua transparent = true - -" calcurse notes in markdown -autocmd BufRead,BufNewFile /tmp/calcurse* set filetype=markdown -autocmd BufRead,BufNewFile ~/.local/share/calcurse/notes/* set filetype=markdown - - diff --git a/editors/nvim/lua/keymap.lua b/editors/nvim/lua/keymap.lua deleted file mode 100644 index 77ed481..0000000 --- a/editors/nvim/lua/keymap.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("transparent") - -vim.g.mapleader = " " - -vim.keymap.set("n", "b", ":lua toggleTransparent()") diff --git a/editors/nvim/site/after/ftplugin/go.lua b/editors/nvim/site/after/ftplugin/go.lua new file mode 100644 index 0000000..59c3b62 --- /dev/null +++ b/editors/nvim/site/after/ftplugin/go.lua @@ -0,0 +1,8 @@ +vim.cmd('packadd vim-go') + +vim.g.go_hightlight_types = 1 +vim.g.go_hightlight_fields = 1 +vim.g.go_hightlight_functions = 1 +vim.g.go_hightlight_function_calls = 1 +vim.g.go_hightlight_operators = 1 +vim.g.go_hightlight_extra_types = 1 diff --git a/editors/nvim/site/after/ftplugin/markdown.lua b/editors/nvim/site/after/ftplugin/markdown.lua new file mode 100644 index 0000000..53b61cd --- /dev/null +++ b/editors/nvim/site/after/ftplugin/markdown.lua @@ -0,0 +1,14 @@ +-- adding packages +vim.cmd('packadd vim-markdown') +vim.cmd('packadd vimwiki') +-- setting spell check +vim.cmd([[ + setlocal spell + setlocal wrap +]]) + +-- markdown plugin settings +vim.opt.conceallevel = 2 +vim.g.vim_markdown_folding_disabled = 1 +vim.g.vim_markdown_math = 1 +vim.g.vim_markdown_strikethrough = 1 diff --git a/meta/configs/nvim.yaml b/meta/configs/nvim.yaml new file mode 100644 index 0000000..76bd2ad --- /dev/null +++ b/meta/configs/nvim.yaml @@ -0,0 +1,7 @@ +- clean: + ~/.config/nvim: + ~/.local/share/nvim: + +- link: + ~/.config/nvim: editors/nvim/config + ~/.local/share/nvim/site: editors/nvim/site diff --git a/meta/profiles/arch.desktop b/meta/profiles/arch.desktop index 9da56f9..cf80605 100644 --- a/meta/profiles/arch.desktop +++ b/meta/profiles/arch.desktop @@ -3,6 +3,7 @@ arch.i3 arch.picom arch.polybar vim +nvim zsh oh-my-zsh fzf