diff --git a/ginit.gtk.vim b/ginit.gtk.vim new file mode 100644 index 0000000..d98f71f --- /dev/null +++ b/ginit.gtk.vim @@ -0,0 +1,40 @@ +"" +"" Misc. +"" +set termguicolors +set background=light +hi ColorColumn guibg=#deddda + +call rpcnotify(1, 'Gui', 'Option', 'Popupmenu', 0) +call rpcnotify(1, 'Gui', 'Option', 'Tabline', 0) +call rpcnotify(1, 'Gui', 'Command', 'SetCursorBlink', '0') +"" +"" Font Setup +"" + +"" parameters +let s:defaultfontsize = 10 +let s:fontname = "Source Code Pro" + +"" set default font +:execute "Guifont " . s:fontname . ":h" . s:defaultfontsize + +"" increase/decrease font size function +let s:fontsize = s:defaultfontsize +function! AdjustFontSize(amount) + let s:fontsize = s:fontsize+a:amount + :execute "Guifont " . s:fontname . ":h" . s:fontsize +endfunction + +"" reset font size +function! ResetFontSize() + :execute "Guifont " . s:fontname . ":h" . s:defaultfontsize +endfunction + +"" font size keybindings +noremap :call AdjustFontSize(1) +noremap :call AdjustFontSize(-1) +noremap :call ResetFontSize() +inoremap :call AdjustFontSize(1)a +inoremap :call AdjustFontSize(-1)a +inoremap :call ResetFontSize()a diff --git a/ginit.vim b/ginit.vim index 3f48ea0..d96cb65 100644 --- a/ginit.vim +++ b/ginit.vim @@ -1,9 +1,47 @@ -"" Font Setup -Guifont SauceCodePro\ Nerd\ Font\ Mono:h10 -"GuiRenderLigatures 1 -GuiScrollBar 1 -GuiTabline 0 - -"" Colorscheme -set background=dark +"" +"" Misc. +"" set termguicolors +GuiScrollBar 0 +GuiTabline 0 +GuiRenderLigatures 0 + +"" get colorscheme from gtk +let gtk_colorscheme = substitute(system('gsettings get org.gnome.desktop.interface color-scheme'), '\n', '', '') +if gtk_colorscheme == "'prefer-dark'" + set background=dark +else + set background=light + hi ColorColumn guibg=#c0bfbc +endif + +"" +"" Font Setup +"" + +"" parameters +let s:defaultfontsize = 10 +let s:fontname = "Source Code Pro" + +"" set default font +:execute "Guifont " . s:fontname . ":h" . s:defaultfontsize + +"" increase/decrease font size function +let s:fontsize = s:defaultfontsize +function! AdjustFontSize(amount) + let s:fontsize = s:fontsize+a:amount + :execute "Guifont " . s:fontname . ":h" . s:fontsize +endfunction + +"" reset font size +function! ResetFontSize() + :execute "Guifont " . s:fontname . ":h" . s:defaultfontsize +endfunction + +"" font size keybindings +noremap :call AdjustFontSize(1) +noremap :call AdjustFontSize(-1) +noremap :call ResetFontSize() +inoremap :call AdjustFontSize(1)a +inoremap :call AdjustFontSize(-1)a +inoremap :call ResetFontSize()a diff --git a/lua/binds.lua b/lua/binds.lua index c2990f0..aef2664 100644 --- a/lua/binds.lua +++ b/lua/binds.lua @@ -28,6 +28,6 @@ ct.map('n', 'q', ':bd') -- -- Commands -- -ct.defcmd('Xrdb', '!xrdb %') +-- ct.defcmd('Xrdb', '!xrdb %') ct.defcmd('ExTerm', '!' .. defs.external_term .. '&') ct.defcmd('ExFileMgr', '!' .. defs.external_filemgr .. '. &') diff --git a/lua/defs.lua b/lua/defs.lua index 7d69ee6..11c5c3e 100644 --- a/lua/defs.lua +++ b/lua/defs.lua @@ -1,8 +1,7 @@ return { - -- Yes, I use the Mate desktop environment template_dir = '~/templates', - external_term = 'mate-terminal', - external_filemgr = 'caja', - external_pdfviewer = 'atril', + external_term = 'kgx', + external_filemgr = 'nautilus', + external_pdfviewer = 'evince', lsp_path = vim.env.HOME .. '/.local/share/lsp_servers' } diff --git a/lua/filetypes.lua b/lua/filetypes.lua index 183c5b5..78a2c70 100644 --- a/lua/filetypes.lua +++ b/lua/filetypes.lua @@ -21,7 +21,14 @@ ct.augroup('templates', -- ct.augroup('filetypeSettings', {'FileType', 'python', 'setlocal', 'tabstop=4 shiftwidth=4 expandtab'}, - {'FileType', 'html', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'}, - {'FileType', 'javascript', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'}, - {'FileType', 'vue', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'} + {'FileType', 'html', 'setlocal', 'tabstop=2 shiftwidth=2'}, + {'FileType', 'javascript', 'setlocal', 'tabstop=2 shiftwidth=2'}, + {'FileType', 'typescript', 'setlocal', 'tabstop=2 shiftwidth=2'}, + {'FileType', 'typescriptreact','setlocal', 'tabstop=2 shiftwidth=2'}, + {'FileType', 'vue', 'setlocal', 'tabstop=2 shiftwidth=2'} ) + +-- +-- Misc. +-- +vim.cmd 'autocmd BufWritePost *.go,*.py,*.js,*.ts,*tsx,*.tex LspFormat' -- run lspformat when saving in go diff --git a/lua/ide.lua b/lua/ide.lua index 5496e2a..4a1d252 100644 --- a/lua/ide.lua +++ b/lua/ide.lua @@ -8,12 +8,11 @@ local pk_use = require 'packer'.use -- -- Tree Sitter -- ---[[ pk_use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', config = function() - require('nvim-treesitter.configs').setup{ + require('nvim-treesitter.configs').setup { ensure_installed = { "bash", "bibtex", @@ -22,11 +21,14 @@ pk_use { "css", "go", "html", + "http", "javascript", "json", "latex", + "lua", "python", "typescript", + "tsx", "vim", }, sync_install = false, @@ -36,7 +38,6 @@ pk_use { } end } -]]-- -- -- Autocompletion @@ -48,6 +49,7 @@ pk_use { vim.cmd([[autocmd VimEnter * COQnow -s]]) end } + pk_use { 'ms-jpq/coq.artifacts', branch = 'artifacts' @@ -56,22 +58,25 @@ pk_use { -- -- Language Configurations -- --- pk_use 'ap/vim-css-color' +pk_use 'ap/vim-css-color' -- close tags in html languages pk_use { 'alvan/closetag.vim', - ft = {"html", "vue"} -} -pk_use { - 'fatih/vim-go', - ft = 'go' + ft = { "html", "vue", "typescriptreact" } } +-- pk_use { +-- 'fatih/vim-go', +-- ft = 'go' +-- } + pk_use { 'udalov/kotlin-vim', ft = 'kotlin' } +pk_use 'bellinitte/uxntal.vim' + -- -- Language Server -- @@ -85,9 +90,9 @@ pk_use { config = function() require('conftool').map('n', 'e', ':AerialToggle') require('aerial').setup({ - backends = {'lsp', 'markdown', 'man'}, + backends = { 'lsp', 'markdown', 'man' }, layout = { - max_width = 25 + min_width = 25 } }) end @@ -108,15 +113,30 @@ pk_use { } end } -pk_use { +pk_use { 'williamboman/mason-lspconfig.nvim', requires = { + 'neovim/nvim-lspconfig', 'williamboman/mason.nvim', 'ms-jpq/coq_nvim', 'stevearc/aerial.nvim' }, config = function() local masonlsp = require 'mason-lspconfig' + --[[ + masonlsp.setup { + ensure_installed = { + "bashls", + "clangd", + "html", + "jsonls", + "lua_ls", + "pyright", + "texlab", + "tsserver" + }, + } + --]] masonlsp.setup_handlers { function(server_name) require('lspconfig')[server_name].setup(require('coq').lsp_ensure_capabilities { @@ -125,7 +145,7 @@ pk_use { basics.make_lsp_commands(client, bufnr) basics.make_lsp_mappings(client, bufnr) end - }) + }) end } end @@ -135,7 +155,7 @@ pk_use { 'neovim/nvim-lspconfig', config = function() -- disable inline error messages - vim.diagnostic.config({virtual_text = false}) + vim.diagnostic.config({ virtual_text = false }) end } @@ -161,7 +181,7 @@ pk_use { end } --- +--[[ -- Latex Live Preview -- pk_use { @@ -171,8 +191,21 @@ pk_use { vim.g.livepreview_previewer = require('defs').external_pdfviewer vim.g.livepreview_engine = "xelatex" end -} +}]] +-- +-- Markdown Live Preview +-- +pk_use { + "iamcco/markdown-preview.nvim", + ft = 'markdown', + run = function() + vim.fn["mkdp#util#install"]() + end, + config = function() + vim.g.mkdp_theme = 'light' + end +} -- Debugger Adapter Protocol --[[ @@ -185,3 +218,32 @@ pk_use { } --]] +-- +-- Misc +-- +pk_use { + "rest-nvim/rest.nvim", + requires = { "nvim-lua/plenary.nvim" }, + config = function() + + -- commands + local ct = require('conftool') + ct.defcmd('RestNvim', 'lua require(\'rest-nvim\').run()') + ct.defcmd('RestNvimPreview', 'lua require(\'rest-nvim\').run(true)') + ct.defcmd('RestNvimLast', 'lua require(\'rest-nvim\').last()') + + ct.map('n', 'r', 'RestNvim') + ct.map('n', 'R', 'RestNvimLast') + ct.map('n', '', 'RestNvimPreview') + + require("rest-nvim").setup({ + -- Open request results in a horizontal split + result_split_horizontal = true, + -- Keep the http file buffer above|left when split horizontal|vertical + result_split_in_place = true, + result = { + show_curl_command = false, + } + }) + end +} diff --git a/lua/keys b/lua/keys deleted file mode 100644 index 5234549..0000000 --- a/lua/keys +++ /dev/null @@ -1,104 +0,0 @@ - - - -n !> ~/keys -x # * y?\V" - Nvim builtin - Last set from Lua -o % (MatchitOperationForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 73 -x % (MatchitVisualForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 71 -n % (MatchitNormalForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 69 -n & * :&& - Nvim builtin - Last set from Lua -x * * y/\V" - Nvim builtin - Last set from Lua -n > ~/keys -n Y * y$ - Nvim builtin - Last set from Lua -o [% (MatchitOperationMultiBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 81 -x [% (MatchitVisualMultiBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 79 -n [% (MatchitNormalMultiBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 77 -o ]% (MatchitOperationMultiForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 82 -x ]% (MatchitVisualMultiForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 80 -n ]% (MatchitNormalMultiForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 78 -x a% (MatchitVisualTextObject) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 85 -x gx NetrwBrowseXVis - Last set from /usr/share/nvim/runtime/plugin/netrwPlugin.vim line 88 -n gx NetrwBrowseX - Last set from /usr/share/nvim/runtime/plugin/netrwPlugin.vim line 82 -o g% (MatchitOperationBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 74 -x g% (MatchitVisualBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 72 -n g% (MatchitNormalBackward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 70 -n * lua COQ.Nav_mark() - Last set from API client (channel id 0) -v * lua COQ.Nav_mark() - Last set from API client (channel id 0) -n * i - Last set from API client (channel id 0) -v * i - Last set from API client (channel id 0) - * lua require("packer.load")({'vim-visual-multi'}, { keys = "", prefix = "" }, _G.packer_plugins) - Last set from Lua - * lua require("packer.load")({'vim-visual-multi'}, { keys = "", prefix = "" }, _G.packer_plugins) - Last set from Lua -n * :TroubleToggle - Last set from Lua - GuiTreeviewToggle & :call 26_TreeViewToggle() - Last set from /usr/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim line 221 - GuiTreeviewHide & :call 26_TreeViewShowHide(0) - Last set from /usr/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim line 211 - GuiTreeviewShow & :call 26_TreeViewShowHide(1) - Last set from /usr/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim line 210 -x NetrwBrowseXVis * :call netrw#BrowseXVis() - Last set from /usr/share/nvim/runtime/plugin/netrwPlugin.vim line 90 -n NetrwBrowseX * :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX())) - Last set from /usr/share/nvim/runtime/plugin/netrwPlugin.vim line 84 -x (MatchitVisualTextObject) (MatchitVisualMultiBackward)o(MatchitVisualMultiForward) - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 66 -o (MatchitOperationMultiForward) * :call matchit#MultiMatch("W", "o") - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 63 -o (MatchitOperationMultiBackward) * :call matchit#MultiMatch("bW", "o") - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 62 -x (MatchitVisualMultiForward) * :call matchit#MultiMatch("W", "n")m'gv`` - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 61 -x (MatchitVisualMultiBackward) * :call matchit#MultiMatch("bW", "n")m'gv`` - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 60 -n (MatchitNormalMultiForward) * :call matchit#MultiMatch("W", "n") - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 59 -n (MatchitNormalMultiBackward) * :call matchit#MultiMatch("bW", "n") - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 58 -o (MatchitOperationBackward) * :call matchit#Match_wrapper('',0,'o') - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 55 -o (MatchitOperationForward) * :call matchit#Match_wrapper('',1,'o') - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 54 -x (MatchitVisualBackward) * :call matchit#Match_wrapper('',0,'v')m'gv`` - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 53 -x (MatchitVisualForward) * :call matchit#Match_wrapper('',1,'v'):if col("''") != col("$") | exe ":normal! m'" | endifgv`` - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 51 -n (MatchitNormalBackward) * :call matchit#Match_wrapper('',0,'n') - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 50 -n (MatchitNormalForward) * :call matchit#Match_wrapper('',1,'n') - Last set from /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim line 49 -n * :set spell! - Last set from Lua -n * ggVG - Last set from Lua -n * nohlsearch|diffupdate|normal! - Nvim builtin - Last set from Lua diff --git a/lua/misc.lua b/lua/misc.lua index c2b88e9..abe5d07 100644 --- a/lua/misc.lua +++ b/lua/misc.lua @@ -57,6 +57,7 @@ vim.g.netrw_chgwin = 1 -- -- EtC. -- +vim.opt.clipboard = "unnamedplus" vim.opt.compatible = false vim.opt.autowrite = true vim.opt.foldmethod = "marker" @@ -66,5 +67,3 @@ vim.cmd('autocmd BufEnter * silent! lcd %:p:h') vim.g.markdown_fenced_languages = {'html', 'vim', 'python', 'c', 'bash=sh'} -- auto close delimiters (eg. parentheses, brackets) pk_use 'Raimondi/delimitMate' - - diff --git a/lua/ui.lua b/lua/ui.lua index 4e14280..c9c0bfb 100644 --- a/lua/ui.lua +++ b/lua/ui.lua @@ -4,41 +4,63 @@ local ct = require 'conftool' -- -- Theme -- ---vim.cmd('syntax on') ---vim.cmd('colo borterm') + pk_use { - 'navarasu/onedark.nvim', - setup = function() - require('conftool').set({'background', 'dark'}) - end, + 'Mofiqul/adwaita.nvim', config = function() - local theme = require('onedark') - theme.setup { - style = 'darker', - } - theme.load() + local ct = require('conftool') + ct.set({'background', 'dark'}) + -- vim.g.adwaita_darker = true + vim.cmd [[colo adwaita]] + vim.keymap.set( + 'n', + 'c', + function() + if vim.o.background == 'light' then + vim.o.background = 'dark' + else + vim.o.background = 'light' + vim.api.nvim_set_hl(0, 'ColorColumn', {bg = '#c0bfbc'}) + vim.cmd('redraw') + vim.cmd('redraw') + end + end, + {noremap = true} + ) + end } + -- -- Buffer Bar -- +--[[ pk_use { 'romgrk/barbar.nvim', config = function() require('bufferline').setup { animation = false, auto_hide = true, - icons = false, - icon_separator_active = '|', - icon_separator_inactive = ' ', - icon_close_tab = 'X', - icon_close_tab_modified = '*', - icon_pinned = '!' - + icons = { + filetype = { + custom_colors = false, + enabled = false + }, + inactive = {left = ' '}, + modified = {button = '*'}, + -- separator = {left = '|'}, + pinned = {button = '!'}, + button = 'X' + }, + sidebar_filetypes = { + aerial = true, + netrw = true + } } end } +--]] -- -- Indentation @@ -51,12 +73,14 @@ ct.set({'tabstop', 5}, {'shiftwidth', 5}) -- Indent indicators -- vim.opt.list = true -vim.cmd([[set lcs=tab:\|\ ]]) +--vim.cmd([[set lcs=tab:\|\ ]]) pk_use { - 'Yggdroot/indentLine', + 'nathanaelkane/vim-indent-guides', setup = function() - vim.g.indentLine_char = '|' - vim.g.indentLine_setConceal = 0 + vim.g.indent_guides_guide_size = 1 + vim.g.indent_guides_tab_guides = 0 + vim.g.indent_guides_start_level = 2 + vim.g.indent_guides_enable_on_vim_startup = 1 end } @@ -74,6 +98,11 @@ ct.set( {'wrapmargin', 0} ) +-- Rainbow Delimiters +pk_use { + 'hiphish/rainbow-delimiters.nvim', +} + -- dont show line number in terminal window vim.cmd('autocmd TermOpen * setlocal nonu') -- turn on mouse