nix format doesn't like tabs

This commit is contained in:
Anish L 2022-03-17 00:56:53 +10:00
parent 779a0243d6
commit 49d9907b32

View file

@ -1,438 +1,441 @@
{ pkgs, ... }: { pkgs, ... }:
let let
customPlugins = { customPlugins = {
vim-zettel = pkgs.vimUtils.buildVimPlugin { vim-zettel = pkgs.vimUtils.buildVimPlugin {
name = "vim-zettel"; name = "vim-zettel";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "michal-h21"; owner = "michal-h21";
repo = "vim-zettel"; repo = "vim-zettel";
rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d"; rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d";
sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4=";
}; };
}; };
lsp-format = pkgs.vimUtils.buildVimPlugin { lsp-format = pkgs.vimUtils.buildVimPlugin {
name = "lsp-format"; name = "lsp-format";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "lukas-reineke"; owner = "lukas-reineke";
repo = "lsp-format.nvim"; repo = "lsp-format.nvim";
rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff"; rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff";
sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4="; sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4=";
}; };
}; };
}; };
my-python-packages = python-packages: with python-packages; [ my-python-packages = python-packages: with python-packages; [
tasklib tasklib
pynvim pynvim
six six
python-lsp-server python-lsp-server
pylsp-mypy pylsp-mypy
python-lsp-black python-lsp-black
pylint pylint
black black
# other python packages you want # other python packages you want
]; ];
python-with-my-packages = pkgs.python3.withPackages my-python-packages; python-with-my-packages = pkgs.python3.withPackages my-python-packages;
in in
{ {
environment.variables.EDITOR = "nvim"; environment.variables.EDITOR = "nvim";
environment.shellAliases = { environment.shellAliases = {
k = "cd ~/vimwiki; vim -c :VimwikiIndex"; k = "cd ~/vimwiki; vim -c :VimwikiIndex";
kz = "cd ~/vimwiki; vim -c :VimwikiIndex -c :ZettelNew"; kz = "cd ~/vimwiki; vim -c :VimwikiIndex -c :ZettelNew";
}; };
environment.systemPackages = with pkgs // customPlugins; [ environment.systemPackages = with pkgs // customPlugins; [
nodejs nodejs
python-with-my-packages python-with-my-packages
clojure-lsp clojure-lsp
rnix-lsp rnix-lsp
terraform-lsp terraform-lsp
vale vale
clj-kondo clj-kondo
# Other LSPs or linters # Other LSPs or linters
( neovim.override { (neovim.override {
vimAlias = true; vimAlias = true;
withPython3 = true; withPython3 = true;
extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; extraPython3Packages = pkgs: with pkgs; [ tasklib six ];
configure = { configure = {
packages.myPlugins = with pkgs.vimPlugins; { packages.myPlugins = with pkgs.vimPlugins; {
start = [ start = [
# general # general
vim-nix vim-nix
fzf-vim fzf-vim
vim-elixir vim-elixir
emmet-vim emmet-vim
nerdtree nerdtree
ayu-vim ayu-vim
goyo-vim goyo-vim
csv-vim csv-vim
rainbow_parentheses-vim rainbow_parentheses-vim
vim-surround vim-surround
vim-devicons vim-devicons
nvim-web-devicons nvim-web-devicons
direnv-vim direnv-vim
vim-peekaboo vim-peekaboo
undotree undotree
telescope-nvim telescope-nvim
plenary-nvim plenary-nvim
lualine-nvim lualine-nvim
nvim-gps nvim-gps
nvim-treesitter nvim-treesitter
nvim-treesitter-context nvim-treesitter-context
dashboard-nvim dashboard-nvim
FTerm-nvim FTerm-nvim
barbar-nvim barbar-nvim
# kitaab stuff # kitaab stuff
vimwiki vimwiki
taskwiki taskwiki
vim-zettel vim-zettel
# lsp stuff # lsp stuff
nvim-lint nvim-lint
nvim-lspconfig nvim-lspconfig
nvim-cmp nvim-cmp
cmp-nvim-lsp cmp-nvim-lsp
cmp-treesitter cmp-treesitter
nvim-lsp-ts-utils nvim-lsp-ts-utils
cmp-conjure cmp-conjure
cmp-buffer cmp-buffer
cmp-tabnine cmp-tabnine
lspkind-nvim lspkind-nvim
cmp-path cmp-path
cmp-spell cmp-spell
nvim-autopairs nvim-autopairs
cmp_luasnip cmp_luasnip
luasnip luasnip
lsp-format lsp-format
# git stuff # git stuff
vim-fugitive vim-fugitive
gitsigns-nvim gitsigns-nvim
fzf-checkout-vim fzf-checkout-vim
# Clojure stuff # Clojure stuff
conjure conjure
vim-sexp vim-sexp
vim-sexp-mappings-for-regular-people vim-sexp-mappings-for-regular-people
# testing # testing
#vim-processing #vim-processing
#vim-tidal #vim-tidal
]; ];
}; };
customRC = '' customRC = ''
set tabstop=2 set tabstop=2
set showmatch set showmatch
set shiftwidth=2 set shiftwidth=2
set noexpandtab set noexpandtab
set autoindent set autoindent
set undofile set undofile
set signcolumn=auto:4 set signcolumn=auto:4
" set foldmethod=indent " fold based on indent " set foldmethod=indent " fold based on indent
set number set number
set nocompatible set nocompatible
set relativenumber set relativenumber
set showtabline=2 set showtabline=2
set noexpandtab set noexpandtab
set autowriteall set autowriteall
syntax on syntax on
set list lcs=tab:\|\ set list lcs=tab:\|\
filetype plugin on filetype plugin on
set termguicolors set termguicolors
let ayucolor="mirage" let ayucolor="mirage"
colorscheme ayu colorscheme ayu
" set spell " set spell
set spelllang=en_gb set spelllang=en_gb
set ignorecase set ignorecase
set smartcase set smartcase
set incsearch set incsearch
" if hidden is not set, TextEdit might fail. " if hidden is not set, TextEdit might fail.
set hidden set hidden
" Some servers have issues with backup files, see #649 " Some servers have issues with backup files, see #649
set nobackup set nobackup
set nowritebackup set nowritebackup
" Better display for messages " Better display for messages
set cmdheight=2 set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000. " You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300 set updatetime=300
" don't give |ins-completion-menu| messages. " don't give |ins-completion-menu| messages.
set shortmess+=c set shortmess+=c
" always show signcolumns " always show signcolumns
set signcolumn=yes set signcolumn=yes
" window " window
nmap <leader>wh :topleft vnew<CR> nmap <leader>wh :topleft vnew<CR>
nmap <leader>wl :botright vnew<CR> nmap <leader>wl :botright vnew<CR>
nmap <leader>wk :topleft new<CR> nmap <leader>wk :topleft new<CR>
nmap <leader>wj :botright new<CR> nmap <leader>wj :botright new<CR>
" tabs " tabs
nmap <leader>rt :retab!<CR> nmap <leader>rt :retab!<CR>
vmap <leader>rt :retab!<CR>
let mapleader = "\<Space>" let mapleader = "\<Space>"
let maplocalleader = "," let maplocalleader = ","
" moving splits with vim movements. " moving splits with vim movements.
:tnoremap <A-h> <C-\><C-N><C-w>h :tnoremap <A-h> <C-\><C-N><C-w>h
:tnoremap <A-j> <C-\><C-N><C-w>j :tnoremap <A-j> <C-\><C-N><C-w>j
:tnoremap <A-k> <C-\><C-N><C-w>k :tnoremap <A-k> <C-\><C-N><C-w>k
:tnoremap <A-l> <C-\><C-N><C-w>l :tnoremap <A-l> <C-\><C-N><C-w>l
:inoremap <A-h> <C-\><C-N><C-w>h :inoremap <A-h> <C-\><C-N><C-w>h
:inoremap <A-j> <C-\><C-N><C-w>j :inoremap <A-j> <C-\><C-N><C-w>j
:inoremap <A-k> <C-\><C-N><C-w>k :inoremap <A-k> <C-\><C-N><C-w>k
:inoremap <A-l> <C-\><C-N><C-w>l :inoremap <A-l> <C-\><C-N><C-w>l
:nnoremap <A-h> <leader>h :nnoremap <A-h> <leader>h
:nnoremap <A-j> <leader>j :nnoremap <A-j> <leader>j
:nnoremap <A-k> <leader>k :nnoremap <A-k> <leader>k
:nnoremap <A-l> <leader>l :nnoremap <A-l> <leader>l
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M")<CR> :nnoremap <F5> "=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M")<CR> :inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F4> <C-R>=strftime("%H:%M")<CR> :inoremap <F4> <C-R>=strftime("%H:%M")<CR>
" telescope " telescope
" Find files using Telescope command-line sugar. " Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr> nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr> nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr> nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr> nnoremap <leader>fh <cmd>Telescope help_tags<cr>
nnoremap <leader>ft <cmd>Telescope tags<cr> nnoremap <leader>ft <cmd>Telescope tags<cr>
" exit normal mode in terminal " exit normal mode in terminal
:tnoremap <C-n> <C-\><C-n> :tnoremap <C-n> <C-\><C-n>
" Sexp in Conjure (since it's fennel) " Sexp in Conjure (since it's fennel)
" let g:sexp_filetypes = [ "fennel" ] " let g:sexp_filetypes = [ "fennel" ]
let g:rainbow_active = 0 let g:rainbow_active = 0
autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll
" general commands " general commands
map <leader>t :NERDTreeToggle<CR> map <leader>t :NERDTreeToggle<CR>
map <leader>s :w<CR> map <leader>s :w<CR>
map <leader>q :wq<CR> map <leader>q :wq<CR>
map <leader>r :RainbowParenthesesToggleAll<CR> map <leader>r :RainbowParenthesesToggleAll<CR>
map <leader><BS> :noh<CR> map <leader><BS> :noh<CR>
nnoremap Y y$ nnoremap Y y$
" center moving " center moving
nnoremap n nzzzv nnoremap n nzzzv
nnoremap N Nzzzv nnoremap N Nzzzv
nnoremap J mzJ'z nnoremap J mzJ'z
" undo points " undo points
inoremap , ,<c-g>u inoremap , ,<c-g>u
inoremap . .<c-g>u inoremap . .<c-g>u
inoremap ! !<c-g>u inoremap ! !<c-g>u
inoremap ? ?<c-g>u inoremap ? ?<c-g>u
inoremap ( (<c-g>u inoremap ( (<c-g>u
inoremap ) )<c-g>u inoremap ) )<c-g>u
inoremap [ [<c-g>u inoremap [ [<c-g>u
inoremap ] ]<c-g>u inoremap ] ]<c-g>u
inoremap { {<c-g>u inoremap { {<c-g>u
inoremap } }<c-g>u inoremap } }<c-g>u
" moving text " moving text
vnoremap J :m '>+1<CR>gv=gv vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '>-2<CR>gv=gv vnoremap K :m '>-2<CR>gv=gv
inoremap <c-j> <esc>:m .+1<CR>== inoremap <c-j> <esc>:m .+1<CR>==
inoremap <c-k> <esc>:m .-2<CR>== inoremap <c-k> <esc>:m .-2<CR>==
nnoremap <leader>j <esc>:m .+1<CR>== nnoremap <leader>j <esc>:m .+1<CR>==
nnoremap <leader>k <esc>:m .-2<CR>== nnoremap <leader>k <esc>:m .-2<CR>==
" Pasting " Pasting
:map <leader>sy :!xclip -i<CR><CR> :map <leader>sy :!xclip -i<CR><CR>
:vmap <leader>sy "*y :vmap <leader>sy "*y
:map <leader>sp :r!xclip -o<CR> :map <leader>sp :r!xclip -o<CR>
" barbar " barbar
nnoremap <silent> gT :BufferPrevious<CR> nnoremap <silent> gT :BufferPrevious<CR>
nnoremap <silent> gt :BufferNext<CR> nnoremap <silent> gt :BufferNext<CR>
nnoremap <silent> gj :BufferPick<CR> nnoremap <silent> gj :BufferPick<CR>
nnoremap <silent> gc :BufferClose<CR> nnoremap <silent> gc :BufferClose<CR>
" git " git
nnoremap <leader>ga :G fetch --all nnoremap <leader>ga :G fetch --all
nmap <leader>gs :G<CR> nmap <leader>gs :G<CR>
nmap <leader>gh :diffget //3 nmap <leader>gh :diffget //3
nmap <leader>gl :diffget //2 nmap <leader>gl :diffget //2
nmap <leader>gc :GBranches<CR> nmap <leader>gc :GBranches<CR>
nnoremap <leader>gp :Git! push<CR> nnoremap <leader>gp :Git! push<CR>
nnoremap <leader>gd :Gdiff<CR>
nnoremap <space>gt :Gcommit -v -q %:p<CR>
nnoremap <Leader>gb :Gblame<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>
map <leader>zf :Telescope oldfiles only_cwd=true<CR> map <leader>zf :Telescope oldfiles only_cwd=true<CR>
let g:mapleader="\<Space>" let g:mapleader="\<Space>"
let g:dashboard_default_executive = 'telescope' let g:dashboard_default_executive = 'telescope'
nmap <Leader>ss :<C-u>SessionSave<CR> nmap <Leader>ss :<C-u>SessionSave<CR>
nmap <Leader>sl :<C-u>SessionLoad<CR> nmap <Leader>sl :<C-u>SessionLoad<CR>
nnoremap <silent> <Leader>fh :DashboardFindHistory<CR> nnoremap <silent> <Leader>fh :DashboardFindHistory<CR>
nnoremap <silent> <Leader>ff :DashboardFindFile<CR> nnoremap <silent> <Leader>ff :DashboardFindFile<CR>
nnoremap <silent> <Leader>fa :DashboardFindWord<CR> nnoremap <silent> <Leader>fm :DashboardJumpMark<CR>
nnoremap <silent> <Leader>fm :DashboardJumpMark<CR> nnoremap <silent> <Leader>cn :DashboardNewFile<CR>
nnoremap <silent> <Leader>cn :DashboardNewFile<CR> nnoremap <silent> <Leader>tn :tabnew<CR>
nnoremap <silent> <Leader>tn :tabnew<CR> autocmd FileType dashboard set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2
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 } } " not sure we even use this
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
" lsp commands " lsp commands
nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR> nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
nnoremap <leader>vi :lua require('telescope.builtin').lsp_implementation()<CR> nnoremap <leader>vi :lua require('telescope.builtin').lsp_implementation()<CR>
nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR> nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
nnoremap <leader>vrr :lua require('telescope.builtin').lsp_references()<CR> nnoremap <leader>vrr :lua require('telescope.builtin').lsp_references()<CR>
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR> nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR> nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR> nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR> nnoremap <leader>vsd :lua rim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR> nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <leader>vll :call LspLocationList()<CR> nnoremap <leader>vll :call LspLocationList()<CR>
nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr> nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr>
" lua config " lua config
lua <<EOF lua <<EOF
-- autopairs -- autopairs
require('nvim-autopairs').setup{} require('nvim-autopairs').setup{}
-- Setup nvim-cmp. -- Setup nvim-cmp.
local has_words_before = function() local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
local luasnip = require("luasnip") local luasnip = require("luasnip")
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()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
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()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
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
local tabnine = require('cmp_tabnine.config') local tabnine = require('cmp_tabnine.config')
tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true}) tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true})
-- Setup lspconfig -- Setup lspconfig
require("lsp-format").setup {} require("lsp-format").setup {}
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach}
require('gitsigns').setup { sign_priority=80 } require('gitsigns').setup { sign_priority=80 }
-- treesitter -- treesitter
require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'typescript'}} require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'typescript'}}
-- lualine -- lualine
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'}, }
python = {'black'}
} -- f_term
local map = vim.api.nvim_set_keymap
-- f_term local opts = { noremap = true, silent = true }
local map = vim.api.nvim_set_keymap map('n', '<C-i>', '<CMD>lua require("FTerm").toggle()<CR>', opts)
local opts = { noremap = true, silent = true } map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
map('n', '<C-i>', '<CMD>lua require("FTerm").toggle()<CR>', opts) EOF
map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts) '';
EOF };
''; }
}; )
} ];
)];
} }