diff --git a/profiles/nvim/nvim.nix b/profiles/nvim/nvim.nix index fb27acdb..407f3974 100644 --- a/profiles/nvim/nvim.nix +++ b/profiles/nvim/nvim.nix @@ -79,6 +79,8 @@ in nvim-treesitter nvim-treesitter-context cmp-treesitter + dashboard-nvim + FTerm-nvim # kitaab stuff vimwiki @@ -242,16 +244,24 @@ in nmap gh :diffget //3 nmap gl :diffget //2 nmap gc :GCheckout - nnoremap gp :G push + nnoremap gp :G push " kitaab map zs :ZettelSearch map zo :ZettelOpen map zn :ZettelNew - " NERDTree - " open on directory - autocmd StdinReadPre * let s:std_in=1 + let g:mapleader="\" + let g:dashboard_default_executive = 'telescope' + nmap ss :SessionSave + nmap sl :SessionLoad + nnoremap fh :DashboardFindHistory + nnoremap ff :DashboardFindFile + nnoremap tc :DashboardChangeColorscheme + nnoremap fa :DashboardFindWord + nnoremap fb :DashboardJumpMark + nnoremap cn :DashboardNewFile + autocmd FileType dashboard set showtabline=0 | autocmd WinLeave set showtabline=2 " fzf let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } @@ -282,64 +292,64 @@ require('nvim-autopairs').setup{} local cmp = require('cmp') local cmp_autopairs = require('nvim-autopairs.completion.cmp') local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) + return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil end cmp.setup { - formatting = { - format = function(entry, vim_item) - -- fancy icons and a name of kind - vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. - " " .. vim_item.kind - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - cmp_tabnine = "[TabNine]", - look = "[Look]", - path = "[Path]", - spell = "[Spell]", - calc = "[Calc]", - })[entry.source.name] - return vim_item - end - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, {"i", "s"}), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i", "s" }), - }, - sources = { - {name = 'buffer'}, {name = 'nvim_lsp'}, - {name = "look"}, {name = "path"}, - {name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"}, - {name = 'cmp-conjure'} - }, - completion = {completeopt = 'menu,menuone,noinsert'} + formatting = { + format = function(entry, vim_item) + -- fancy icons and a name of kind + vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. + " " .. vim_item.kind + -- set a name for each source + vim_item.menu = ({ + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + cmp_tabnine = "[TabNine]", + look = "[Look]", + path = "[Path]", + spell = "[Spell]", + calc = "[Calc]", + })[entry.source.name] + return vim_item + end + }, + mapping = { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, {"i", "s"}), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }), + }, + sources = { + {name = 'buffer'}, {name = 'nvim_lsp'}, + {name = "look"}, {name = "path"}, + {name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"}, + {name = 'cmp-conjure'} + }, + completion = {completeopt = 'menu,menuone,noinsert'} } cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) -- TabNine cmp @@ -364,37 +374,42 @@ require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', ' require('nvim-gps').setup {} local gps = require('nvim-gps') require('lualine').setup { - sections = { - lualine_c = { - 'filename', { gps.get_location, condition=gps.is_available }, - }, - lualine_y = { - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end - }, - } + sections = { + lualine_c = { + 'filename', { gps.get_location, condition=gps.is_available }, + }, + lualine_y = { + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end + }, + } } -- nvim-lint require('lint').linters_by_ft = { - markdown = {'vale'}, - clojure = {'clj-kondo'}, - python = {'black'} + markdown = {'vale'}, + clojure = {'clj-kondo'}, + python = {'black'} } +-- f_term +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } +map('n', '', 'lua require("FTerm").toggle()', opts) +map('t', '', 'lua require("FTerm").toggle()', opts) EOF ''; };