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-context
cmp-treesitter
dashboard-nvim
FTerm-nvim
# kitaab stuff
vimwiki
@ -242,16 +244,24 @@ in
nmap <leader>gh :diffget //3
nmap <leader>gl :diffget //2
nmap <leader>gc :GCheckout<CR>
nnoremap <leader>gp :G push<CR>
nnoremap <leader>gp :G push<CR>
" kitaab
map <leader>zs :ZettelSearch<CR>
map <leader>zo :ZettelOpen<CR>
map <leader>zn :ZettelNew<CR>
" NERDTree
" open on directory
autocmd StdinReadPre * let s:std_in=1
let g:mapleader="\<Space>"
let g:dashboard_default_executive = 'telescope'
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
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 = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = 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 = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = 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', '<C-i>', '<CMD>lua require("FTerm").toggle()<CR>', opts)
map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
EOF
'';
};