dashboard + FTerm, look i'm sorry okay

This commit is contained in:
Anish L 2022-02-26 21:47:03 +10:00
parent fc96c7f620
commit aa0e2d0101

View file

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